remove exports_uri as the inventory isn't cached anymore
diff --git a/reclass/__init__.py b/reclass/__init__.py
index eeb8f7f..c86b880 100644
--- a/reclass/__init__.py
+++ b/reclass/__init__.py
@@ -11,9 +11,9 @@
from storage.loader import StorageBackendLoader
from storage.memcache_proxy import MemcacheProxy
-def get_storage(storage_type, nodes_uri, classes_uri, exports_uri, **kwargs):
+def get_storage(storage_type, nodes_uri, classes_uri, **kwargs):
storage_class = StorageBackendLoader(storage_type).load()
- return MemcacheProxy(storage_class(nodes_uri, classes_uri, exports_uri, **kwargs))
+ return MemcacheProxy(storage_class(nodes_uri, classes_uri, **kwargs))
def output(data, fmt, pretty_print=False, no_refs=False):
diff --git a/reclass/adapters/ansible.py b/reclass/adapters/ansible.py
index ad9f97a..f9d08a6 100755
--- a/reclass/adapters/ansible.py
+++ b/reclass/adapters/ansible.py
@@ -55,8 +55,7 @@
add_options_cb=add_ansible_options_group,
defaults=defaults)
- storage = get_storage(options.storage_type, options.nodes_uri,
- options.classes_uri, options.exports_uri)
+ storage = get_storage(options.storage_type, options.nodes_uri, options.classes_uri)
class_mappings = defaults.get('class_mappings')
reclass = Core(storage, class_mappings)
diff --git a/reclass/adapters/salt.py b/reclass/adapters/salt.py
index 805cfa6..68b9eee 100755
--- a/reclass/adapters/salt.py
+++ b/reclass/adapters/salt.py
@@ -23,14 +23,11 @@
inventory_base_uri=OPT_INVENTORY_BASE_URI,
nodes_uri=OPT_NODES_URI,
classes_uri=OPT_CLASSES_URI,
- exports_uri=OPT_EXPORTS_URI,
class_mappings=None,
propagate_pillar_data_to_reclass=False):
- nodes_uri, classes_uri, exports_uri = path_mangler(inventory_base_uri, nodes_uri,
- classes_uri, exports_uri)
- storage = get_storage(storage_type, nodes_uri, classes_uri,
- exports_uri, default_environment='base')
+ nodes_uri, classes_uri = path_mangler(inventory_base_uri, nodes_uri, classes_uri)
+ storage = get_storage(storage_type, nodes_uri, classes_uri, default_environment='base')
input_data = None
if propagate_pillar_data_to_reclass:
input_data = pillar
@@ -48,13 +45,10 @@
def top(minion_id, storage_type=OPT_STORAGE_TYPE,
inventory_base_uri=OPT_INVENTORY_BASE_URI, nodes_uri=OPT_NODES_URI,
- classes_uri=OPT_CLASSES_URI, exports_uri=OPT_EXPORTS_URI,
- class_mappings=None):
+ classes_uri=OPT_CLASSES_URI class_mappings=None):
- nodes_uri, classes_uri, exports_uri = path_mangler(inventory_base_uri, nodes_uri,
- classes_uri, exports_uri)
- storage = get_storage(storage_type, nodes_uri, classes_uri,
- exports_uri, default_environment='base')
+ nodes_uri, classes_uri = path_mangler(inventory_base_uri, nodes_uri, classes_uri)
+ storage = get_storage(storage_type, nodes_uri, classes_uri, default_environment='base')
reclass = Core(storage, class_mappings, input_data=None)
# if the minion_id is not None, then return just the applications for the
diff --git a/reclass/cli.py b/reclass/cli.py
index 7083917..386d351 100644
--- a/reclass/cli.py
+++ b/reclass/cli.py
@@ -28,8 +28,7 @@
defaults=defaults)
storage = get_storage(options.storage_type, options.nodes_uri,
- options.classes_uri, options.exports_uri,
- default_environment='base')
+ options.classes_uri, default_environment='base')
class_mappings = defaults.get('class_mappings')
reclass = Core(storage, class_mappings)
diff --git a/reclass/config.py b/reclass/config.py
index 52fbe4c..0f3b023 100644
--- a/reclass/config.py
+++ b/reclass/config.py
@@ -29,9 +29,6 @@
ret.add_option('-c', '--classes-uri', dest='classes_uri',
default=defaults.get('classes_uri', OPT_CLASSES_URI),
help='the URI to the classes storage [%default]'),
- ret.add_option('-e', '--exports-uri', dest='exports_uri',
- default=defaults.get('exports_uri', OPT_EXPORTS_URI),
- help='the URI to the exports file [%default]')
return ret
@@ -130,13 +127,11 @@
parser.error('Must specify --inventory-base-uri or --nodes-uri')
elif options.inventory_base_uri is None and options.classes_uri is None:
parser.error('Must specify --inventory-base-uri or --classes-uri')
- elif options.inventory_base_uri is None and options.exports_uri is None:
- parser.error('Must specify --inventory-base-uri or --exports-uri')
return parser, option_checker
-def path_mangler(inventory_base_uri, nodes_uri, classes_uri, exports_uri):
+def path_mangler(inventory_base_uri, nodes_uri, classes_uri):
if inventory_base_uri is None:
# if inventory_base is not given, default to current directory
@@ -144,21 +139,20 @@
nodes_uri = nodes_uri or 'nodes'
classes_uri = classes_uri or 'classes'
- exports_uri = exports_uri or 'exports'
def _path_mangler_inner(path):
ret = os.path.join(inventory_base_uri, path)
ret = os.path.expanduser(ret)
return os.path.abspath(ret)
- n, c, e = map(_path_mangler_inner, (nodes_uri, classes_uri, exports_uri))
- if n == c or n == e or c == e:
- raise errors.DuplicateUriError(n, c, e)
+ n, c = map(_path_mangler_inner, (nodes_uri, classes_uri))
+ if n == c:
+ raise errors.DuplicateUriError(n, c)
common = os.path.commonprefix((n, c))
if common == n or common == c:
raise errors.UriOverlapError(n, c)
- return n, c, e
+ return n, c
def get_options(name, version, description,
@@ -184,9 +178,8 @@
options, args = parser.parse_args()
checker(options, args)
- options.nodes_uri, options.classes_uri, options.exports_uri = \
- path_mangler(options.inventory_base_uri, options.nodes_uri,
- options.classes_uri, options.exports_uri)
+ options.nodes_uri, options.classes_uri = \
+ path_mangler(options.inventory_base_uri, options.nodes_uri, options.classes_uri)
return options
diff --git a/reclass/defaults.py b/reclass/defaults.py
index d3ac29d..557d511 100644
--- a/reclass/defaults.py
+++ b/reclass/defaults.py
@@ -14,7 +14,6 @@
OPT_INVENTORY_BASE_URI = os.path.join('/etc', RECLASS_NAME)
OPT_NODES_URI = 'nodes'
OPT_CLASSES_URI = 'classes'
-OPT_EXPORTS_URI = 'exports'
OPT_PRETTY_PRINT = True
OPT_NO_REFS = False
OPT_OUTPUT = 'yaml'
diff --git a/reclass/storage/yaml_fs/__init__.py b/reclass/storage/yaml_fs/__init__.py
index abe8e3f..19b2b8f 100644
--- a/reclass/storage/yaml_fs/__init__.py
+++ b/reclass/storage/yaml_fs/__init__.py
@@ -25,7 +25,7 @@
class ExternalNodeStorage(NodeStorageBase):
- def __init__(self, nodes_uri, classes_uri, exports_uri, default_environment=None):
+ def __init__(self, nodes_uri, classes_uri, default_environment=None):
super(ExternalNodeStorage, self).__init__(STORAGE_NAME)
def name_mangler(relpath, name):
@@ -49,12 +49,10 @@
return relpath, '.'.join(parts)
self._classes_uri = classes_uri
self._classes = self._enumerate_inventory(classes_uri, name_mangler)
- self._exports_uri = exports_uri
self._default_environment = default_environment
nodes_uri = property(lambda self: self._nodes_uri)
classes_uri = property(lambda self: self._classes_uri)
- exports_uri = property(lambda self: self._exports_uri)
def _enumerate_inventory(self, basedir, name_mangler):
ret = {}
@@ -99,22 +97,5 @@
entity = YamlFile(path).get_entity(name)
return entity
- def get_exports(self):
- vvv('GET EXPORTS')
- path = os.path.join(self.exports_uri, 'exports{0}'.format(FILE_EXTENSION))
- if os.path.exists(path):
- data = YamlFile(path).get_data()
- else:
- data = dict()
- return data
-
- def put_exports(self, new):
- vvv('PUT EXPORTS')
- path = os.path.join(self.exports_uri, 'exports{0}'.format(FILE_EXTENSION))
- if not os.path.exists(self.exports_uri):
- os.mkdir(self.exports_uri)
- with open(path, 'w') as yaml_file:
- yaml.dump(new.as_dict(), yaml_file, default_flow_style=False, Dumper=ExplicitDumper)
-
def enumerate_nodes(self):
return self._nodes.keys()