Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions reclass/adapters/salt.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ def ext_pillar(minion_id, pillar,
nodes_uri=OPT_NODES_URI,
classes_uri=OPT_CLASSES_URI,
class_mappings=None,
propagate_pillar_data_to_reclass=False):
propagate_pillar_data_to_reclass=False,
ignore_class_notfound=False):

nodes_uri, classes_uri = path_mangler(inventory_base_uri,
nodes_uri, classes_uri)
Expand All @@ -33,7 +34,8 @@ def ext_pillar(minion_id, pillar,
input_data = None
if propagate_pillar_data_to_reclass:
input_data = pillar
reclass = Core(storage, class_mappings, input_data=input_data)
reclass = Core(storage, class_mappings, input_data=input_data,
ignore_class_notfound=ignore_class_notfound)

data = reclass.nodeinfo(minion_id)
params = data.get('parameters', {})
Expand All @@ -48,13 +50,14 @@ def ext_pillar(minion_id, pillar,
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,
class_mappings=None):
class_mappings=None, ignore_class_notfound=False):

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)
reclass = Core(storage, class_mappings, input_data=None,
ignore_class_notfound=ignore_class_notfound)

# if the minion_id is not None, then return just the applications for the
# specific minion, otherwise return the entire top data (which we need for
Expand Down
6 changes: 5 additions & 1 deletion reclass/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@

class Core(object):

def __init__(self, storage, class_mappings, input_data=None):
def __init__(self, storage, class_mappings, input_data=None,
ignore_class_notfound=False):
self._storage = storage
self._class_mappings = class_mappings
self._ignore_class_notfound = ignore_class_notfound
self._input_data = input_data

@staticmethod
Expand Down Expand Up @@ -93,6 +95,8 @@ def _recurse_entity(self, entity, merge_base=None, seen=None, nodename=None):
try:
class_entity = self._storage.get_class(klass)
except ClassNotFound, e:
if self._ignore_class_notfound:
continue
e.set_nodename(nodename)
raise e

Expand Down