def forwards(self, orm): arch = platform.architecture() if arch[0] == '64bit': arch = 'x64' else: arch = 'x86' "Write your forwards methods here." # Note: Don't use "from appname.models import ModelName". # Use orm.ModelName to refer to models in this application, # and orm['appname.ModelName'] for models in other applications. db.execute("insert into jails_jailtemplate (jt_name, jt_os, jt_url) " "values ('centos-6.4', 'Linux', '%s/linux-centos-6.4.tgz')" % \ get_jails_index(release='9.2.0', arch=arch)) db.execute("update jails_jailtemplate set jt_url='%s/%s' " \ "where jt_name = 'debian-7.1.0'" % \ (get_jails_index(release='9.2.0', arch=arch), 'linux-debian-7.1.0.tgz') ) db.execute("update jails_jailtemplate set jt_url='%s/%s' " \ "where jt_name = 'gentoo-20130820'" % \ (get_jails_index(release='9.2.0', arch=arch), 'linux-gentoo-20130820.tgz') ) db.execute("update jails_jailtemplate set jt_url='%s/%s' " \ "where jt_name = 'ubuntu-13.04'" % \ (get_jails_index(release='9.2.0', arch=arch), 'linux-ubuntu-13.04.tgz') ) db.execute("update jails_jailtemplate set jt_url='%s/%s' " \ "where jt_name = 'suse-12.3'" % \ (get_jails_index(release='9.2.0', arch=arch), 'linux-suse-12.3.tgz') )
def forwards(self, orm): # Adding model 'JailTemplate' db.create_table(u'jails_jailtemplate', ( (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), ('jt_name', self.gf('django.db.models.fields.CharField')(max_length=120)), ('jt_url', self.gf('django.db.models.fields.CharField')(max_length=255)), )) db.send_create_signal(u'jails', ['JailTemplate']) # # The standard jail types # db.execute("insert into jails_jailtemplate (jt_name, jt_url) " "values ('pluginjail', '%s/freenas-pluginjail.tgz')" % get_jails_index()) db.execute("insert into jails_jailtemplate (jt_name, jt_url) " "values ('portjail', '%s/freenas-portjail.tgz')" % get_jails_index()) db.execute("insert into jails_jailtemplate (jt_name, jt_url) " "values ('standard', '%s/freenas-standard.tgz')" % get_jails_index()) # # And... some Linux jail templates # db.execute("insert into jails_jailtemplate (jt_name, jt_url) " "values ('debian-7.1.0', '%s/linux-debian-7.1.0.tgz')" % get_jails_index()) db.execute("insert into jails_jailtemplate (jt_name, jt_url) " "values ('gentoo-20130820', '%s/linux-gentoo-20130820.tgz')" % get_jails_index()) db.execute("insert into jails_jailtemplate (jt_name, jt_url) " "values ('ubuntu-13.04', '%s/linux-ubuntu-13.04.tgz')" % get_jails_index()) db.execute("insert into jails_jailtemplate (jt_name, jt_url) " "values ('centos-6.4', '%s/linux-centos-6.4.tgz')" % get_jails_index()) db.execute("insert into jails_jailtemplate (jt_name, jt_url) " "values ('fedora-19', '%s/linux-fedora-19.tgz')" % get_jails_index()) db.execute("insert into jails_jailtemplate (jt_name, jt_url) " "values ('suse-12.3', '%s/linux-suse-12.3.tgz')" % get_jails_index())
def forwards(self, orm): # Adding model 'JailTemplate' db.create_table(u'jails_jailtemplate', ( (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), ('jt_name', self.gf('django.db.models.fields.CharField')(max_length=120)), ('jt_url', self.gf('django.db.models.fields.CharField')(max_length=255)), )) db.send_create_signal(u'jails', ['JailTemplate']) # # The standard jail types # db.execute("insert into jails_jailtemplate (jt_name, jt_url) " "values ('pluginjail', '%s/freenas-pluginjail.tgz')" % get_jails_index()) db.execute("insert into jails_jailtemplate (jt_name, jt_url) " "values ('portjail', '%s/freenas-portjail.tgz')" % get_jails_index()) db.execute("insert into jails_jailtemplate (jt_name, jt_url) " "values ('standard', '%s/freenas-standard.tgz')" % get_jails_index()) # # And... some Linux jail templates # db.execute("insert into jails_jailtemplate (jt_name, jt_url) " "values ('debian-7.1.0', '%s/linux-debian-7.1.0.tgz')" % get_jails_index()) db.execute("insert into jails_jailtemplate (jt_name, jt_url) " "values ('gentoo-20130820', '%s/linux-gentoo-20130820.tgz')" % get_jails_index()) db.execute("insert into jails_jailtemplate (jt_name, jt_url) " "values ('ubuntu-13.04', '%s/linux-ubuntu-13.04.tgz')" % get_jails_index()) db.execute("insert into jails_jailtemplate (jt_name, jt_url) " "values ('centos-6.4', '%s/linux-centos-6.4.tgz')" % get_jails_index()) db.execute("insert into jails_jailtemplate (jt_name, jt_url) " "values ('suse-12.3', '%s/linux-suse-12.3.tgz')" % get_jails_index())
def forwards(self, orm): # Adding model 'JailTemplate' db.create_table(u'jails_jailtemplate', ( (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), ('jt_name', self.gf('django.db.models.fields.CharField')(max_length=120)), ('jt_url', self.gf('django.db.models.fields.CharField')(max_length=255)), )) db.send_create_signal(u'jails', ['JailTemplate']) db.execute("insert into jails_jailtemplate (jt_name, jt_url) " "values ('pluginjail', '%s/freenas-pluginjail.tgz')" % get_jails_index()) db.execute("insert into jails_jailtemplate (jt_name, jt_url) " "values ('portjail', '%s/freenas-portjail.tgz')" % get_jails_index()) db.execute("insert into jails_jailtemplate (jt_name, jt_url) " "values ('standard', '%s/freenas-standard.tgz')" % get_jails_index())
def forwards(self, orm): freebsd_release = '9.2-RELEASE' arch = platform.architecture() if arch[0] == '64bit': arch = 'x64' else: arch = 'x86' if arch == 'x64': db.execute("insert into jails_jailtemplate (jt_name, jt_os, jt_url) " "values ('pluginjail-x86', 'FreeBSD', '%s/freenas-pluginjail-%s.tgz')" % \ (get_jails_index(release='9.2.0', arch='x86'), freebsd_release)) db.execute("insert into jails_jailtemplate (jt_name, jt_os, jt_url) " "values ('portjail-x86', 'FreeBSD', '%s/freenas-portjail-%s.tgz')" % \ (get_jails_index(release='9.2.0', arch='x86'), freebsd_release)) db.execute("insert into jails_jailtemplate (jt_name, jt_os, jt_url) " "values ('standard-x86', 'FreeBSD', '%s/freenas-standard-%s.tgz')" % \ (get_jails_index(release='9.2.0', arch='x86'), freebsd_release))
def backwards(self, orm): templates = ['pluginjail', 'portjail', 'standard'] arch = platform.architecture() if arch[0] == '64bit': arch = 'x64' else: arch = 'x86' for t in templates: t = orm['jails.Jailtemplate'].objects.filter(jt_name='%s' % t)[0] t.jt_url = "%s/freenas-%s.tgz" % \ (get_jails_index(release='latest', arch=arch), t) t.save()
def jails_home(request): try: jailsconf = models.JailsConfiguration.objects.order_by("-id")[0] except IndexError: jailsconf = models.JailsConfiguration.objects.create() if not jailsconf.jc_collectionurl: jailsconf.jc_collectionurl = get_jails_index() jailsconf.save() return render(request, 'jails/index.html', { 'focus_form': request.GET.get('tab', 'jails.View'), 'jailsconf': jailsconf })
def forwards(self, orm): templates = ['pluginjail', 'portjail', 'standard'] freebsd_release = '9.2-RELEASE' freenas_release = '9.2.0' arch = platform.architecture() if arch[0] == '64bit': arch = 'x64' else: arch = 'x86' for t in templates: obj = orm['jails.JailTemplate'].objects.filter(jt_name='%s' % t)[0] obj.jt_url = "%s/freenas-%s-%s.tgz" % \ (get_jails_index(release='9.2.0', arch=arch), t, freebsd_release) obj.save()
def jails_home(request): default_iface = notifier().guess_default_interface() try: jailsconf = models.JailsConfiguration.objects.order_by("-id")[0] except IndexError: jailsconf = models.JailsConfiguration.objects.create() if not jailsconf.jc_collectionurl: jailsconf.jc_collectionurl = get_jails_index() jailsconf.save() return render( request, "jails/index.html", {"focus_form": request.GET.get("tab", "jails.View"), "jailsconf": jailsconf, "default_iface": default_iface}, )
def forwards(self, orm): db.execute("insert into jails_jailtemplate (jt_name, jt_os, jt_url, jt_arch) " "values ('VirtualBox-4.3.10', 'FreeBSD', '%s/vboxtemplate.tgz', 'x64')" % \ get_jails_index(release='9.2.0', arch='x64'))
def backwards(self, orm): "Write your backwards methods here." db.execute("insert into jails_jailtemplate (jt_name, jt_url) " "values ('centos-6.4', '%s/linux-centos-6.4.tgz')" % get_jails_index())