Repository: openshift/openshift-ansible

Issue:
Task "Label nodes" fails: sequence item 1: expected string or Unicode, bool found
The tasks "Label nodes" fails with

```
TASK [openshift_manage_node : Label nodes] *************************************
task path: /usr/share/openshift-ansible/roles/openshift_manage_node/tasks/main.yml:35
fatal: [master1.example.com]: FAILED! => {
    "failed": true, 
    "msg": "Unexpected templating type error occurred on ({{ openshift.common.client_binary }} label --overwrite node {{ hostvars[item].openshift.node.nodename }} {{ hostvars[item].openshift.node.labels | oo_combine_dict  }} --config={{ openshift_manage_node_kubeconfig }} -n default): sequence item 1: expected string or Unicode, bool found"
}
```

My inventory looks like this:

```
[OSEv3:children]
masters
etcd
nodes

[OSEv3:vars]
ansible_become=True
ansible_ssh_user=ansible
containerized=True
deployment_type=origin

[masters]
master1.example.com openshift_hostname='master1.example.com' openshift_ip='192.168.1.117' openshift_node_labels="{'region':'infra'}" openshift_schedulable=False
master2.example.com openshift_hostname='master2.example.com' openshift_ip='192.168.1.118' openshift_node_labels="{'region':'infra'}" openshift_schedulable=False
master3.example.com openshift_hostname='master3.example.com' openshift_ip='192.168.1.119' openshift_node_labels="{'region':'infra'}" openshift_schedulable=False

[etcd]
master1.example.com
master2.example.com
master3.example.com

[nodes]
node1.example.com openshift_hostname='node1.example.com' openshift_ip='192.168.1.120' openshift_node_labels="{'region':'zrh','registry':'allowed'}"
node2.example.com openshift_hostname='node2.example.com' openshift_ip='192.168.1.121' openshift_node_labels="{'region':'zrh','registry':'allowed'}"
node3.example.com openshift_hostname='node3.example.com' openshift_ip='192.168.1.122' openshift_node_labels="{'region':'zrh','registry':'allowed'}"
lb1.example.com openshift_public_hostname='lb1.example.com' openshift_hostname='lb1-int.example.com' openshift_ip='192.168.1.115' openshift_public_ip='5.102.147.40' openshift_node_labels="{'region':'zrh','router':'allowed'}"
lb2.example.com openshift_public_hostname='lb2.example.com' openshift_hostname='lb2-int.example.com' openshift_ip='192.168.1.116' openshift_public_ip='5.102.145.238' openshift_node_labels="{'region':'zrh','router':'allowed'}"
master1.example.com openshift_hostname='master1.example.com' openshift_ip='192.168.1.117' openshift_node_labels="{'region':'infra'}" openshift_schedulable=False
master2.example.com openshift_hostname='master2.example.com' openshift_ip='192.168.1.118' openshift_node_labels="{'region':'infra'}" openshift_schedulable=False
master3.example.com openshift_hostname='master3.example.com' openshift_ip='192.168.1.119' openshift_node_labels="{'region':'infra'}" openshift_schedulable=False
```
##### Version

openshift-ansible-3.3.35-1
ansible 2.2.0.0
##### Steps To Reproduce
1. Run playbook with `ansible-playbook playbooks/byo/config.yml -vvvv`
2. Above error message appears
##### Additional Information
- `ansible-playbook playbooks/byo/config.yml -vvvv`
- CentOS 7



Discussion:
It looks like the function `oo_combine_dict` detonates when the value of a label is a boolean `true`: https://github.com/openshift/openshift-ansible/blob/master/filter_plugins/oo_filters.py#L239
It somehow is connected to https://github.com/openshift/openshift-ansible/blob/master/roles/openshift_hosted_logging/tasks/deploy_logging.yaml#L141 which defines the default value of the label logging-infra-fluentd to `true`. Or it could be https://github.com/openshift/openshift-ansible/blob/master/roles/openshift_hosted_logging/vars/main.yaml#L22, I'm not really sure...

@tobru Are you deploying logging? If the logging labels are the issue I would expect `openshift_hosted_logging_deploy=true` in the inventory


Resolving patch:
diff --git a/filter_plugins/oo_filters.py b/filter_plugins/oo_filters.py
--- a/filter_plugins/oo_filters.py
+++ b/filter_plugins/oo_filters.py
@@ -236,7 +236,7 @@ def oo_combine_dict(data, in_joiner='=', out_joiner=' '):
         if not isinstance(data, dict):
             raise errors.AnsibleFilterError("|failed expects first param is a dict")
 
-        return out_joiner.join([in_joiner.join([k, v]) for k, v in data.items()])
+        return out_joiner.join([in_joiner.join([k, str(v)]) for k, v in data.items()])
 
     @staticmethod
     def oo_ami_selector(data, image_name):


Test patch: