def get_image_metadata_all(only_node=None): key_val = etcd.get_all_dict('image') if only_node: for k in copy.copy(key_val): if not k.endswith('/' + only_node): del key_val[k] return key_val
def test_get_all_dict(self, mock_get_prefix): data = etcd.get_all_dict('objecttype', 'subtype') self.assertDictEqual( { '/sf/image/095fdd2b66625412aa/sf-2': { "checksum": "ed44b9745b8d62bcbbc180b5f36c24bb", "file_version": 1, "size": '359464960', "version": 1 }, '/sf/image/aca41cefa18b052074e092/sf-2': { "checksum": None, "file_version": 1, "size": '16338944', "version": 1 } }, data)