Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong tasks statuses #59

Open
lukurde opened this issue Dec 19, 2024 · 0 comments
Open

Wrong tasks statuses #59

lukurde opened this issue Dec 19, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@lukurde
Copy link

lukurde commented Dec 19, 2024

🐛 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.

@kavinagrawalcohesity kavinagrawalcohesity added the bug Something isn't working label Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants