How to restore jail templates after accidental deletion

Status
Not open for further replies.

ttblum

Dabbler
Joined
Mar 4, 2013
Messages
41
Hello,

I was trying to remove all my jails and start over from scratch, and in the process ended up deleting my jail templates as well.

How do you restore the jail templates? According to the following threads, it has something to do with recreating a 'jails' dataset, but I'm not exactly sure what to do. I am running 9.2.1.5.

http://forums.freenas.org/index.php?threads/deleted-jails-directory.14351/
http://forums.freenas.org/index.php?threads/reinstall-default-jail-templates.20362/#post-116099
https://bugs.freenas.org/issues/4845
 

ttblum

Dabbler
Joined
Mar 4, 2013
Messages
41
This results in:

Code:
# python /usr/local/www/freenasUI/manage.py migrate jails 0006
- Soft matched migration 0006 to 0006_add_field_JailsConfiguration_jc_collectionurl.
Running migrations for jails:
- Migrating backwards to just after 0006_add_field_JailsConfiguration_jc_collectionurl.
< jails:0016_add_field_NullMountPoint_fstype
< jails:0015_auto__add_field_jailtemplate_jt_arch
< jails:0014_add_32bit_templates
- Migration 'jails:0014_add_32bit_templates' is marked for no-dry-run.
< jails:0013_add_centos
- Migration 'jails:0013_add_centos' is marked for no-dry-run.
< jails:0012_auto__add_unique_jailtemplate_jt_name
< jails:0011_add_field_JailTemplate_jt_os
< jails:0010_add_9_2_0_release_templates
- Migration 'jails:0010_add_9_2_0_release_templates' is marked for no-dry-run.
! Error found during real run of migration! Aborting.
 
! Since you have a database that does not support running
! schema-altering statements in transactions, we have had
! to leave it in an interim state between migrations.
 
! The South developers regret this has happened, and would
! like to gently persuade you to consider a slightly
! easier-to-deal-with DBMS (one that supports DDL transactions)
! NOTE: The error which caused the migration to fail is further up.
Error in migration: jails:0010_add_9_2_0_release_templates
Traceback (most recent call last):
  File "/usr/local/www/freenasUI/manage.py", line 42, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python2.7/site-packages/django/core/management/base.py", line 242, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/usr/local/lib/python2.7/site-packages/django/core/management/base.py", line 285, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python2.7/site-packages/south/management/commands/migrate.py", line 111, in handle
    ignore_ghosts = ignore_ghosts,
  File "/usr/local/lib/python2.7/site-packages/south/migration/__init__.py", line 220, in migrate_app
    success = migrator.migrate_many(target, workplan, database)
  File "/usr/local/lib/python2.7/site-packages/south/migration/migrators.py", line 254, in migrate_many
    result = migrator.__class__.migrate_many(migrator, target, migrations, database)
  File "/usr/local/lib/python2.7/site-packages/south/migration/migrators.py", line 375, in migrate_many
    self.migrate(migration, database)
  File "/usr/local/lib/python2.7/site-packages/south/migration/migrators.py", line 133, in migrate
    result = self.run(migration, database)
  File "/usr/local/lib/python2.7/site-packages/south/migration/migrators.py", line 114, in run
    return self.run_migration(migration, database)
  File "/usr/local/lib/python2.7/site-packages/south/migration/migrators.py", line 84, in run_migration
    migration_function()
  File "/usr/local/lib/python2.7/site-packages/south/migration/migrators.py", line 60, in <lambda>
    return (lambda: direction(orm))
  File "/usr/local/www/freenasUI/../freenasUI/jails/migrations/0010_add_9_2_0_release_templates.py", line 41, in backwards
    t = orm['jails.Jailtemplate'].objects.filter(jt_name='%s' % t)[0]
  File "/usr/local/lib/python2.7/site-packages/django/db/models/query.py", line 132, in __getitem__
    return list(qs)[0]
IndexError: list index out of range
 
D

dlavigne

Guest
That output is worth its own bug report. Please post the issue number here after creating it at bugs.freenas.org.
 
D

dlavigne

Guest
Not sure. Does the traceback disappear if you create a dataset named jails?
 
Status
Not open for further replies.
Top