Exemple #1
0
 def test_inject_metadata(self):
     with utils.tempdir() as tmpdir:
         meta_objs = [{"key": "foo", "value": "bar"}]
         metadata = {"foo": "bar"}
         disk_api._inject_metadata_into_fs(meta_objs, tmpdir)
         json_file = os.path.join(tmpdir, 'meta.js')
         json_data = jsonutils.loads(open(json_file).read())
         self.assertEqual(metadata, json_data)
Exemple #2
0
 def test_inject_metadata(self):
     with utils.tempdir() as tmpdir:
         meta_objs = [{"key": "foo", "value": "bar"}]
         metadata = {"foo": "bar"}
         disk_api._inject_metadata_into_fs(meta_objs, tmpdir)
         json_file = os.path.join(tmpdir, 'meta.js')
         json_data = jsonutils.loads(open(json_file).read())
         self.assertEqual(metadata, json_data)
Exemple #3
0
    def test_inject_metadata(self):
        vfs = vfsguestfs.VFSGuestFS("/some/file", "qcow2")
        vfs.setup()

        diskapi._inject_metadata_into_fs([{"key": "foo", "value": "bar"}, {"key": "eek", "value": "wizz"}], vfs)

        self.assertTrue("/meta.js" in vfs.handle.files)
        self.assertEquals(
            vfs.handle.files["/meta.js"],
            {"content": '{"foo": "bar", ' + '"eek": "wizz"}', "gid": 100, "isdir": False, "mode": 0700, "uid": 100},
        )
Exemple #4
0
    def test_inject_metadata(self):
        vfs = vfsguestfs.VFSGuestFS("/some/file", "qcow2")
        vfs.setup()

        diskapi._inject_metadata_into_fs({"foo": "bar", "eek": "wizz"}, vfs)

        self.assertIn("/meta.js", vfs.handle.files)
        self.assertEqual({'content': '{"foo": "bar", ' +
                                     '"eek": "wizz"}',
                          'gid': 100,
                          'isdir': False,
                          'mode': 0o700,
                          'uid': 100},
                         vfs.handle.files["/meta.js"])
        vfs.teardown()
Exemple #5
0
    def test_inject_metadata(self):
        vfs = vfsguestfs.VFSGuestFS("/some/file", "qcow2")
        vfs.setup()

        diskapi._inject_metadata_into_fs({"foo": "bar", "eek": "wizz"}, vfs)

        self.assertIn("/meta.js", vfs.handle.files)
        self.assertEqual({'content': '{"foo": "bar", ' +
                                     '"eek": "wizz"}',
                          'gid': 100,
                          'isdir': False,
                          'mode': 0o700,
                          'uid': 100},
                         vfs.handle.files["/meta.js"])
        vfs.teardown()
    def test_inject_metadata(self):
        vfs = vfsguestfs.VFSGuestFS(self.file)
        vfs.setup()
        metadata = {"foo": "bar", "eek": "wizz"}
        metadata = OrderedDict(sorted(metadata.items()))
        diskapi._inject_metadata_into_fs(metadata, vfs)

        self.assertIn("/meta.js", vfs.handle.files)
        self.assertEqual({'content': '{"eek": "wizz", ' +
                                     '"foo": "bar"}',
                          'gid': 100,
                          'isdir': False,
                          'mode': 0o700,
                          'uid': 100},
                         vfs.handle.files["/meta.js"])
        vfs.teardown()
Exemple #7
0
    def test_inject_metadata(self):
        vfs = vfsguestfs.VFSGuestFS(self.file)
        vfs.setup()
        metadata = {"foo": "bar", "eek": "wizz"}
        metadata = OrderedDict(sorted(metadata.items()))
        diskapi._inject_metadata_into_fs(metadata, vfs)

        self.assertIn("/meta.js", vfs.handle.files)
        self.assertEqual({'content': '{"eek": "wizz", ' +
                                     '"foo": "bar"}',
                          'gid': 100,
                          'isdir': False,
                          'mode': 0o700,
                          'uid': 100},
                         vfs.handle.files["/meta.js"])
        vfs.teardown()
Exemple #8
0
    def test_inject_metadata(self):
        vfs = vfsguestfs.VFSGuestFS("/some/file", "qcow2")
        vfs.setup()

        diskapi._inject_metadata_into_fs([{"key": "foo",
                                           "value": "bar"},
                                          {"key": "eek",
                                           "value": "wizz"}], vfs)

        self.assertTrue("/meta.js" in vfs.handle.files)
        self.assertEquals(vfs.handle.files["/meta.js"],
                          {'content': '{"foo": "bar", ' +
                                      '"eek": "wizz"}',
                           'gid': 100,
                           'isdir': False,
                           'mode': 0700,
                           'uid': 100})
Exemple #9
0
    def test_inject_metadata(self):
        vfs = vfsguestfs.VFSGuestFS("/some/file", "qcow2")
        vfs.setup()

        diskapi._inject_metadata_into_fs([{"key": "foo",
                                           "value": "bar"},
                                          {"key": "eek",
                                           "value": "wizz"}], vfs)

        self.assertTrue("/meta.js" in vfs.handle.files)
        self.assertEquals(vfs.handle.files["/meta.js"],
                          {'content': '{"foo": "bar", ' +
                                      '"eek": "wizz"}',
                           'gid': 100,
                           'isdir': False,
                           'mode': 0o700,
                           'uid': 100})
        vfs.teardown()