diff options
-rw-r--r-- | py/mock/backend.py | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/py/mock/backend.py b/py/mock/backend.py index 64d7455..3f60a08 100644 --- a/py/mock/backend.py +++ b/py/mock/backend.py @@ -13,8 +13,13 @@ import logging import os import shutil import stat -import uuid import grp +try: + import uuid + gotuuid = True +except: + gotuuid = False + # our imports import mock.util @@ -244,14 +249,15 @@ class Root(object): os.remove(hostspath) shutil.copy2('/etc/hosts', etcdir) - # Anything that tries to use libdbus inside the chroot will require this - # FIXME - merge this code with other OS-image building code - machine_uuid = uuid.uuid4().hex - dbus_uuid_path = self.makeChrootPath('var', 'lib', 'dbus', 'machine-id') - f = open(dbus_uuid_path, 'w') - f.write(machine_uuid) - f.write('\n') - f.close() + if gotuuid: + # Anything that tries to use libdbus inside the chroot will require this + # FIXME - merge this code with other OS-image building code + machine_uuid = uuid.uuid4().hex + dbus_uuid_path = self.makeChrootPath('var', 'lib', 'dbus', 'machine-id') + f = open(dbus_uuid_path, 'w') + f.write(machine_uuid) + f.write('\n') + f.close() # files in /etc that need doing for key in self.chroot_file_contents: |