Skip to content

Wrong tasks statuses #59

@lukurde

Description

@lukurde

🐛 Bug Report

cohesity.dataprotect.cohesity_source module:

  • reports task as changed for state: present
  • reporst task as not changed for refresh: true

I think it should be the other way around.

To Reproduce

The task:

    - name: "Cohesity Protection Source: Set Source to state of present"
      cohesity.dataprotect.cohesity_source:
        cluster: "{{ cohesity_server }}"
        username: "{{ cohesity_username }}"
        password: "{{ cohesity_password }}"
        validate_certs: "{{ cohesity_validate_certs }}"
        state: present
        endpoint: "{{ inventory_hostname }}"
        environment: "Physical"
        #force_register: true
        #refresh: true
      register: reg_cohesity
      delegate_to: localhost

    - name: debug
      debug:
        msg: "{{ reg_cohesity }}"

Result (repeated runs, not the first time):

TASK [Cohesity Protection Source: Set Source to state of present] ***************************************************
changed: [hostname.example.com -> localhost]     <-- HERE

TASK [debug] ********************************************************************************************************
ok: [hostname.example.com] => {
    "msg": {
        "changed": true,
        "failed": false,
        "msg": "Attempting to manage Protection Source",
        "source_vars": {
            "endpoint": "hostname.example.com",
            "environment": "Physical",
            "forceRegister": false,
            "hostType": "Linux",
            "physicalType": "Host",
            "token": "ab...cd"
        },
        "state": "present"        <-- HERE
    }
}

With refresh: true uncommented:

TASK [Cohesity Protection Source: Set Source to state of present] ***************************************************
ok: [hostname.example.com -> localhost]

TASK [debug] ********************************************************************************************************
ok: [hostname.example.com] => {
    "msg": {
        "changed": false,         <-- HERE
        "endpoint": "hostname.example.com",
        "failed": false,
        "id": 37477,
        "msg": "Successfully refreshed the Protection Source 'hostname.example.com'."
    }
}

Expected behavior

  1. state: present should not change anything if the state is already correct
  2. refresh: true should report task as changed because it executes something on the target

Actual Behavior

The opposite happens, see the code above.

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions