#Hi laurent8106 I noticed that update

1 messages · Page 1 of 1 (latest)

fossil iron
#

Disabling this option is running fine

mild spindle
#

I'm curious to see what you have in mirror.update It looks like an input issue to me.

fossil iron
#

Actually I have given as below,

update : "{{ mirror.update | default(omit) }}"

And no variable to it. below are my inputs

"mirror": {
    "cluster": "10.216.4.57",
    "create_destination": true,
    "destination_cluster": "10.216.4.82",
    "destination_cluster_name": "cluster2",
    "destination_path": "svm1_dr:",
    "source_cluster_name": "cluster1",
    "source_path": "svm1:"
},
#

I'm trying to set it optional

mild spindle
#

The issue is with the mirror variable

#

It does not have an update member. And I'm afraid Ansible considers mirror is a dictionary and have some builtin methods. So update may be one of them.

fossil iron
#

oh okay! interesting... let me try to change that

mild spindle
fossil iron
#

I tried changing the param into multiple names.
Currently I'm using as below.

update : "{{ snpmir.update | default(omit) }}"

but it still fails

            "path": "svm1:"
        },
        "state": "absent",
        "transferring_time_out": 300,
        "update": "<built-in method update of dict object at 0x7fb25949f300>",
        "use_rest": "auto",
        "username": "admin",
        "validate_certs": false,
        "validate_source_path": true
    }
},
"msg": "argument update is of type <class 'str'> and we were unable to convert to bool: The value '<built-in method update of dict object at 0x7fb25949f300>' is not a valid boolean.  Valid booleans include: 0, 1, 'n', 'true', 't', '0', 'f', 'on', 'false', 'off', '1', 'no', 'y', 'yes'",
"snpmir": {
    "cluster": "10.216.4.57",
    "create_destination": true,
    "destination_cluster": "10.216.4.82",
    "destination_cluster_name": "cluster2",
    "destination_path": "svm1_dr:",
    "source_cluster_name": "cluster1",
    "source_path": "svm1:",
    "state": "absent"
}

}

mild spindle
#

you can't use snpmir.update if snpmir is a dict. You need to use snpmir['update'] or mirror['update']

fossil iron
#

Ansible supports .operation for dictionaries. All variables are defined that way. Only update is breaking

fossil iron
#

@mild spindle where you able check this?

mild spindle
#

See above. You cannot use . notation with reserved keywords

fossil iron
#

My bad! I missed that part. Thanks Laurent!

fossil iron
#

@mild spindle , I update the module to remove dot notation and using it as below.

update                      : "{{ snpmirror['update']                                | default(omit) }}"

But it still fails with same error.

        "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
        "peer_options": {
            "hostname": "10.216.4.57"
        },
        "relationship_info_only": false,
        "relationship_state": "active",
        "source_endpoint": {
            "cluster": "cluster1",
            "path": "svm1:"
        },
        "state": "present",
        "transferring_time_out": 300,
        "update": "<built-in method update of dict object at 0x7fe5495ca540>",
        "use_rest": "auto",
        "username": "admin",
        "validate_certs": false,
        "validate_source_path": true
    }
},
"msg": "argument update is of type <class 'str'> and we were unable to convert to bool: The value '<built-in method update of dict object at 0x7fe5495ca540>' is not a valid boolean.  Valid booleans include: 0, 'on', '1', 1, 'f', 'off', 't', 'n', 'yes', '0', 'false', 'no', 'true', 'y'",
"snpmirror": {
    "cluster": "10.216.4.57",
    "create_destination": true,
    "destination_cluster": "10.216.4.82",
    "destination_cluster_name": "cluster2",
    "destination_path": "svm1_dr:",
    "source_cluster_name": "cluster1",
    "source_path": "svm1:"
}

}

fossil iron
#

With detailed troubleshooting what I see is none of ansible logic conditions are working with variable. Like default(omit), default(false) or update : "{{ false if snpmirror['update'] is not defined else snpmirror['update'] }}".

Only if we set yes/no or true/false directly its working.

I think ansible is overriding "update" variable no matter what way we declared it.

After changing the variable name itself I got it working.

update : "{{ snpmirror['snapmirror_update'] | default(omit) }}"