Skip to content

Commit

Permalink
Merge pull request openshift#2220 from jkhelil/fix_key_error_when_ssh…
Browse files Browse the repository at this point in the history
…_failing

fixing openshift key error in case of node failure during run (ssh is…
  • Loading branch information
sdodson authored Aug 16, 2016
2 parents bdf12ce + 75df571 commit f2f81ea
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion filter_plugins/oo_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ def get_attr(data, attribute=None):
the value.
If the key isn't present, None is returned.
Ex: data = {'a': {'b': {'c': 5}}}
attribute = "a.b.c"
returns 5
Expand All @@ -57,6 +56,7 @@ def get_attr(data, attribute=None):

return ptr


@staticmethod
def oo_flatten(data):
""" This filter plugin will flatten a list of lists
Expand Down Expand Up @@ -146,6 +146,7 @@ def oo_collect(data, attribute=None, filters=None):
retval = [FilterModule.get_attr(d, attribute) for d in data]

retval = [val for val in retval if val != None]

return retval

@staticmethod
Expand Down
2 changes: 1 addition & 1 deletion playbooks/common/openshift-node/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
ansible_ssh_user: "{{ g_ssh_user | default(omit) }}"
ansible_become: "{{ g_sudo | default(omit) }}"
with_items: "{{ groups.oo_nodes_to_config | default([]) }}"
when: hostvars[item].openshift.common.is_containerized | bool and (item in groups.oo_nodes_to_config and item in groups.oo_masters_to_config)
when: hostvars[item].openshift.common is defined and hostvars[item].openshift.common.is_containerized | bool and (item in groups.oo_nodes_to_config and item in groups.oo_masters_to_config)

- name: Configure node instances
hosts: oo_containerized_master_nodes
Expand Down
3 changes: 2 additions & 1 deletion roles/openshift_manage_node/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
{{ openshift.common.admin_binary }} manage-node {{ item.openshift.common.hostname | lower }} --schedulable={{ 'true' if item.openshift.node.schedulable | bool else 'false' }}
with_items:
- "{{ openshift_node_vars }}"
when: item.openshift.common.hostname is defined

- name: Label nodes
command: >
{{ openshift.common.client_binary }} label --overwrite node {{ item.openshift.common.hostname | lower }} {{ item.openshift.node.labels | oo_combine_dict }}
with_items:
- "{{ openshift_node_vars }}"
when: "'labels' in item.openshift.node and item.openshift.node.labels != {}"
when: item.openshift.common.hostname is defined and 'labels' in item.openshift.node and item.openshift.node.labels != {}

0 comments on commit f2f81ea

Please sign in to comment.