← Back to team overview

vmbuilder team mailing list archive

[Merge] lp:~r.kintzi/vmbuilder/existing-chroot into lp:vmbuilder

 

Radosław Kintzi has proposed merging lp:~r.kintzi/vmbuilder/existing-chroot into lp:vmbuilder.

Requested reviews:
  VMBuilder (vmbuilder)
Related bugs:
  #592252 vmbuilder ignores host specific settings when existing chroot is used
  https://bugs.launchpad.net/bugs/592252

For more details, see:
https://code.launchpad.net/~r.kintzi/vmbuilder/existing-chroot/+merge/45398

- new --chroot-dir option to build chroot in specific directory (usefull wiht --only-chroot)
- /etc/hostname and /etc/hosts files are now generated at image build stage not at bootstrap (just like /etc/network/interfaces); This allows to use chroots (previously built with --only-chroot option) as templates for disk images


-- 
https://code.launchpad.net/~r.kintzi/vmbuilder/existing-chroot/+merge/45398
Your team VMBuilder is requested to review the proposed merge of lp:~r.kintzi/vmbuilder/existing-chroot into lp:vmbuilder.
=== modified file 'VMBuilder/contrib/cli.py'
--- VMBuilder/contrib/cli.py	2010-07-09 21:48:56 +0000
+++ VMBuilder/contrib/cli.py	2011-01-06 15:33:14 +0000
@@ -78,6 +78,8 @@
                              action='store_true',
                              help=("Only build the chroot. Don't install it "
                                    "on disk images or anything."))
+            group.add_option('--chroot-dir',
+                             help="Build the chroot in directory.")
             group.add_option('--existing-chroot',
                              help="Use existing chroot.")
             group.add_option('--tmp',
@@ -155,6 +157,9 @@
             destdir = self.options.destdir or ('%s-%s' % (distro.arg,
                                                           hypervisor.arg))
 
+            if self.options.tmpfs and self.options.chroot_dir:
+                raise VMBuilderUserError('--chroot-dir and --tmpfs can not be used together.')
+
             if os.path.exists(destdir):
                 if self.options.overwrite:
                     logging.debug('%s existed, but -o was specified. '
@@ -202,6 +207,9 @@
                     tmpfs_mount_point = util.set_up_tmpfs(
                         tmp_root=self.options.tmp_root, size=tmpfs_size)
                     chroot_dir = tmpfs_mount_point
+                elif self.options.chroot_dir:
+                    os.mkdir(self.options.chroot_dir)
+                    chroot_dir = self.options.chroot_dir
                 else:
                     chroot_dir = util.tmpdir(tmp_root=self.options.tmp_root)
                 distro.set_chroot_dir(chroot_dir)

=== modified file 'VMBuilder/plugins/ubuntu/distro.py'
--- VMBuilder/plugins/ubuntu/distro.py	2010-11-16 16:32:47 +0000
+++ VMBuilder/plugins/ubuntu/distro.py	2011-01-06 15:33:14 +0000
@@ -144,7 +144,6 @@
         self.suite.install_extras()
         self.suite.create_initial_user()
         self.suite.install_authorized_keys()
-        self.suite.config_host_and_domainname()
         self.suite.set_timezone()
         self.suite.set_locale()
         self.suite.update()
@@ -158,6 +157,7 @@
         self.suite.create_manifest()
 
     def configure_networking(self, nics):
+        self.suite.config_host_and_domainname()
         self.suite.config_interfaces(nics)
 
     def configure_mounting(self, disks, filesystems):


Follow ups