Merge pull request #10 from cloudnull/Issue8

fixes issue #8
This commit is contained in:
Jason Cannavale 2014-08-28 11:13:29 -05:00
commit 22dd0baba7

View File

@ -255,17 +255,16 @@ def _append_to_host_groups(inventory, container_type, assignment, host_type,
# Copy the options dictionary for manipulation # Copy the options dictionary for manipulation
options = _vars.copy() options = _vars.copy()
for _k, _v in options.items(): limit = None
limit = None # If a limit is set use the limit string as a filter
# If a limit is set use the limit string as a filter # for the container name and see if it matches.
# for the container name and see if it matches. if 'limit_container_types' in options:
if 'limit_container_types' in _v: limit = options.pop(
limit = _v.pop( 'limit_container_types', None
'limit_container_types', None )
)
if limit is None or limit in container: if limit is None or limit in container:
hdata[_keys] = {_k: _v} hdata[_keys] = options
def _add_container_hosts(assignment, config, container_name, container_type, def _add_container_hosts(assignment, config, container_name, container_type,
@ -296,7 +295,7 @@ def _add_container_hosts(assignment, config, container_name, container_type,
affinity = host_options.get('affinity', {}) affinity = host_options.get('affinity', {})
container_affinity = affinity.get(container_name, 1) container_affinity = affinity.get(container_name, 1)
# Ensures that container names are not longer than 64 # Ensures that container names are not longer than 64
name_length = len(host_type) name_length = len(host_type)
if name_length > 25: if name_length > 25:
name_diff = name_length - 25 name_diff = name_length - 25
@ -715,7 +714,6 @@ def main():
% (env_version, version) % (env_version, version)
) )
# Load existing inventory file if found # Load existing inventory file if found
dynamic_inventory_file = os.path.join(local_path, 'rpc_inventory.json') dynamic_inventory_file = os.path.join(local_path, 'rpc_inventory.json')
if os.path.isfile(dynamic_inventory_file): if os.path.isfile(dynamic_inventory_file):