diff options
-rw-r--r-- | tests/unittests/test_datasource/test_altcloud.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/tests/unittests/test_datasource/test_altcloud.py b/tests/unittests/test_datasource/test_altcloud.py index 4ea820b3..eaaa90e6 100644 --- a/tests/unittests/test_datasource/test_altcloud.py +++ b/tests/unittests/test_datasource/test_altcloud.py @@ -33,6 +33,8 @@ import cloudinit.sources.DataSourceAltCloud from cloudinit.sources.DataSourceAltCloud import DataSourceAltCloud from cloudinit.sources.DataSourceAltCloud import read_user_data_callback +OS_UNAME_ORIG = getattr(os, 'uname') + def _write_cloud_info_file(value): ''' @@ -452,19 +454,16 @@ class TestReadUserDataCallback(TestCase): _remove_user_data_files(self.mount_dir) self.assertEquals(None, read_user_data_callback(self.mount_dir)) + def force_arch(arch=None): def _os_uname(): return ('LINUX', 'NODENAME', 'RELEASE', 'VERSION', arch) if arch: - orig = getattr(os, 'uname') - if not force_arch._orig: - force_arch._orig = orig setattr(os, 'uname', _os_uname) - elif force_arch._orig: - setattr(os, 'uname', force_arch._orig) + elif arch is None: + setattr(os, 'uname', OS_UNAME_ORIG) -force_arch._orig = None # vi: ts=4 expandtab |