diff options
author | Wesley Hearn <whearn@redhat.com> | 2015-05-20 16:45:31 -0400 |
---|---|---|
committer | Wesley Hearn <whearn@redhat.com> | 2015-05-20 16:45:31 -0400 |
commit | 4da7b790d5eb8e870bd81208f7074bba81a0989b (patch) | |
tree | e9082b593384b26fae4ad4611330b386f57a4709 /filter_plugins/oo_filters.py | |
parent | 294f2254b818c466ecf7ab71426a08b6dc99f89c (diff) | |
download | openshift-4da7b790d5eb8e870bd81208f7074bba81a0989b.tar.gz openshift-4da7b790d5eb8e870bd81208f7074bba81a0989b.tar.bz2 openshift-4da7b790d5eb8e870bd81208f7074bba81a0989b.tar.xz openshift-4da7b790d5eb8e870bd81208f7074bba81a0989b.zip |
Made a generic set_attr and set_attrs function to reduce dup code
Diffstat (limited to 'filter_plugins/oo_filters.py')
-rw-r--r-- | filter_plugins/oo_filters.py | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/filter_plugins/oo_filters.py b/filter_plugins/oo_filters.py index 8feb53f43..e02114d9e 100644 --- a/filter_plugins/oo_filters.py +++ b/filter_plugins/oo_filters.py @@ -176,38 +176,6 @@ def oo_ec2_volume_definition(data, host_type, docker_ephemeral=False): return [root_vol, docker_vol] return [root_vol] -def oo_set_node_label(arg, key, value, attr_key=None, attr_value=None): - ''' This cycles through openshift node definitions - (from "osc get nodes -o json"), and adds a label. - - If attr_key and attr_value are set, this will only set the label on - nodes where the attribute matches the specified value. - - Ex: - - shell: osc get nodes -o json - register: output - - - set_fact: - node_facts: "{{ output.stdout - | from_json - | oo_set_node_label('region', 'infra', - 'metadata.name', '172.16.17.43') }}" - ''' - - for item in arg['items']: - if attr_key and attr_value: - actual_attr_value = get_attr(item, attr_key) - - if str(attr_value) != str(actual_attr_value): - continue # We only want to set the values on hosts with defined attributes - - if 'labels' not in item['metadata']: - item['metadata']['labels'] = {} - - item['metadata']['labels'][key] = value - - return arg - # disabling pylint checks for too-few-public-methods and no-self-use since we # need to expose a FilterModule object that has a filters method that returns # a mapping of filter names to methods. |