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

Ansible-Core Minimum Version Bumped to 2.16 #55

Merged
merged 2 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ansible-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ jobs:
- name: Perform sanity testing with ansible-test
uses: ansible-community/ansible-test-gh-action@release/v1
with:
ansible-core-version: stable-2.15
ansible-core-version: stable-2.16
testing-type: sanity
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ collections:
- cohesity.dataprotect
```
# Requirements
- ansible version >= 8.0
- ansible version >= 9.0
- requests >= 2.31.0
- python version >= '3.6'
- cohesity_management_sdk >= 1.6.0
Expand Down
2 changes: 1 addition & 1 deletion docs/common/pre-requisites.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

The prerequisites for using the Cohesity Ansible Collection are:
* Cohesity DataPlatform running version 6.0 or higher (Some Module might have different requirement. Please see individual module for its requirement )
* [Ansible](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html) version 8.0 or higher
* [Ansible](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html) version 9.0 or higher
* The [Ansible Control Machine](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#control-machine-requirements) must be a system running one of the following UNIX operating systems: Linux (Red Hat, Debian, CentOS), macOS, or any of the BSDs. Windows is not supported for the Control Machine.
* [Python](https://www.python.org/downloads) version 2.6 or higher
* Some Module might also need [Cohesity Management SDK](https://developer.cohesity.com/apidocs-641.html#/python/getting-started). Please see individual module for its requirement
2 changes: 1 addition & 1 deletion galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace: cohesity
name: dataprotect

# The version of the collection. Must be compatible with semantic versioning
version: 1.3.0
version: 1.4.0

# The path to the Markdown (.md) readme file. This path is relative to the root of the collection
readme: README.md
Expand Down
2 changes: 1 addition & 1 deletion meta/runtime.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
requires_ansible: ">=2.15"
requires_ansible: ">=2.16"
3 changes: 3 additions & 0 deletions plugins/module_utils/cohesity_constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Copyright (c) 2024 Cohesity Inc

RELEASE_VERSION = "1.4.0"
9 changes: 6 additions & 3 deletions plugins/module_utils/cohesity_hints.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@
from ansible_collections.cohesity.dataprotect.plugins.module_utils.cohesity_utilities import (
raise__cohesity_exception__handler,
)
from ansible_collections.cohesity.dataprotect.plugins.module_utils.cohesity_constants import (
RELEASE_VERSION,
)
except Exception:
pass

Expand Down Expand Up @@ -690,7 +693,7 @@ def unregister_source(module, self):
headers = {
"Accept": "application/json",
"Authorization": "Bearer " + token,
"user-agent": "cohesity-ansible/v1.3.0",
"user-agent": "cohesity-ansible/v{}".format(RELEASE_VERSION),
}

response = open_url(
Expand Down Expand Up @@ -764,7 +767,7 @@ def check__protection_group__exists(module, self):
headers = {
"Accept": "application/json",
"Authorization": "Bearer " + self["token"],
"user-agent": "cohesity-ansible/v1.3.0",
"user-agent": "cohesity-ansible/v{}".format(RELEASE_VERSION),
}
response = open_url(
url=uri,
Expand Down Expand Up @@ -823,7 +826,7 @@ def get_resource_pool_id(module, self):
headers = {
"Accept": "application/json",
"Authorization": "Bearer " + token,
"user-agent": "cohesity-ansible/v1.3.0",
"user-agent": "cohesity-ansible/v{}".format(RELEASE_VERSION),
}
response = open_url(
url=uri,
Expand Down
13 changes: 8 additions & 5 deletions plugins/modules/cohesity_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@
from ansible_collections.cohesity.dataprotect.plugins.module_utils.cohesity_auth import (
get__cohesity_auth__token,
)
from ansible_collections.cohesity.dataprotect.plugins.module_utils.cohesity_constants import (
RELEASE_VERSION,
)
except Exception:
pass

Expand Down Expand Up @@ -307,7 +310,7 @@ def download_agent(module, path):
headers = {
"Accept": "application/octet-stream",
"Authorization": "Bearer " + token,
"user-agent": "cohesity-ansible/v1.3.0",
"user-agent": "cohesity-ansible/v{}".format(RELEASE_VERSION),
}
elif not module.params.get("download_uri"):
os_type = "Linux"
Expand Down Expand Up @@ -336,13 +339,13 @@ def download_agent(module, path):
headers = {
"Accept": "application/octet-stream",
"Authorization": "Bearer " + token,
"user-agent": "cohesity-ansible/v1.3.0",
"user-agent": "cohesity-ansible/v{}".format(RELEASE_VERSION),
}
else:
uri = module.params.get("download_uri")
headers = {
"Accept": "application/octet-stream",
"user-agent": "cohesity-ansible/v1.3.0",
"user-agent": "cohesity-ansible/v{}".format(RELEASE_VERSION),
}

agent = open_url(
Expand Down Expand Up @@ -614,7 +617,7 @@ def get_source_details(module, source_id):
headers = {
"Accept": "application/json",
"Authorization": "Bearer " + token,
"user-agent": "cohesity-ansible/v1.3.0",
"user-agent": "cohesity-ansible/v{}".format(RELEASE_VERSION),
}
response = open_url(
url=uri,
Expand Down Expand Up @@ -666,7 +669,7 @@ def update_agent(module):
headers = {
"Accept": "application/json",
"Authorization": "Bearer " + token,
"user-agent": "cohesity-ansible/v1.3.0",
"user-agent": "cohesity-ansible/v{}".format(RELEASE_VERSION),
}
payload = {"agentIds": [source_details["agent"]["id"]]}
open_url(
Expand Down
7 changes: 5 additions & 2 deletions plugins/modules/cohesity_cancel_migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@
get__restore_task_status__by_id,
get_cohesity_client,
)
from ansible_collections.cohesity.dataprotect.plugins.module_utils.cohesity_constants import (
RELEASE_VERSION,
)
except ImportError:
pass

Expand All @@ -123,7 +126,7 @@ def check__protection_restore__exists(module, self):
headers = {
"Accept": "application/json",
"Authorization": "Bearer " + token,
"user-agent": "cohesity-ansible/v1.3.0",
"user-agent": "cohesity-ansible/v{}".format(RELEASE_VERSION),
}
response = open_url(
url=uri,
Expand Down Expand Up @@ -170,7 +173,7 @@ def cancel_migration(module, task_id):
headers = {
"Accept": "application/json",
"Authorization": "Bearer " + token,
"user-agent": "cohesity-ansible/v1.3.0",
"user-agent": "cohesity-ansible/v{}".format(RELEASE_VERSION),
}
response = open_url(
url=uri,
Expand Down
5 changes: 4 additions & 1 deletion plugins/modules/cohesity_clone_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,9 @@
from ansible_collections.cohesity.dataprotect.plugins.module_utils.cohesity_hints import (
get_cohesity_client,
)
from ansible_collections.cohesity.dataprotect.plugins.module_utils.cohesity_constants import (
RELEASE_VERSION,
)
from cohesity_management_sdk.controllers.base_controller import BaseController
from cohesity_management_sdk.models.clone_task_request import CloneTaskRequest
from cohesity_management_sdk.models.vmware_clone_parameters import VmwareCloneParameters
Expand Down Expand Up @@ -511,7 +514,7 @@ def main():

global cohesity_client
base_controller = BaseController()
base_controller.global_headers["user-agent"] = "cohesity-ansible/v1.3.0"
base_controller.global_headers["user-agent"] = "cohesity-ansible/v{}".format(RELEASE_VERSION)
cohesity_client = get_cohesity_client(module)
clone_exists, clone_details = get_clone_task(module, False)

Expand Down
5 changes: 4 additions & 1 deletion plugins/modules/cohesity_finalize_migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@
get__restore_job__by_type,
get_cohesity_client,
)
from ansible_collections.cohesity.dataprotect.plugins.module_utils.cohesity_constants import (
RELEASE_VERSION,
)
except ImportError:
pass

Expand Down Expand Up @@ -159,7 +162,7 @@ def finalize_migration(module, self):
headers = {
"Accept": "application/json",
"Authorization": "Bearer " + token,
"user-agent": "cohesity-ansible/v1.3.0",
"user-agent": "cohesity-ansible/v{}".format(RELEASE_VERSION),
}
body = {
"restoreTaskId": self["task_id"],
Expand Down
21 changes: 12 additions & 9 deletions plugins/modules/cohesity_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,9 @@
get__protection_run__all__by_id,
get_cohesity_client,
)
from ansible_collections.cohesity.dataprotect.plugins.module_utils.cohesity_constants import (
RELEASE_VERSION,
)
except Exception:
pass

Expand Down Expand Up @@ -595,7 +598,7 @@ def get_vmware_ids(module, job_meta_data, job_details, vm_names):
headers = {
"Accept": "application/json",
"Authorization": "Bearer " + token,
"user-agent": "cohesity-ansible/v1.3.0",
"user-agent": "cohesity-ansible/v{}".format(RELEASE_VERSION),
}
response = open_url(
url=uri,
Expand Down Expand Up @@ -633,7 +636,7 @@ def get_vmware_vm_ids(module, job_meta_data, job_details, vm_names):
headers = {
"Accept": "application/json",
"Authorization": "Bearer " + token,
"user-agent": "cohesity-ansible/v1.3.0",
"user-agent": "cohesity-ansible/v{}".format(RELEASE_VERSION),
}
response = open_url(
url=uri,
Expand Down Expand Up @@ -678,7 +681,7 @@ def get_view_storage_domain_id(module, self):
headers = {
"Accept": "application/json",
"Authorization": "Bearer " + token,
"user-agent": "cohesity-ansible/v1.3.0",
"user-agent": "cohesity-ansible/v{}".format(RELEASE_VERSION),
}
response = open_url(
url=uri,
Expand Down Expand Up @@ -743,7 +746,7 @@ def register_job(module, self):
headers = {
"Accept": "application/json",
"Authorization": "Bearer " + token,
"user-agent": "cohesity-ansible/v1.3.0",
"user-agent": "cohesity-ansible/v{}".format(RELEASE_VERSION),
}
payload = self.copy()

Expand Down Expand Up @@ -848,7 +851,7 @@ def start_job(module, self):
headers = {
"Accept": "application/json",
"Authorization": "Bearer " + token,
"user-agent": "cohesity-ansible/v1.3.0",
"user-agent": "cohesity-ansible/v{}".format(RELEASE_VERSION),
}
source_ids = payload.get("sourceIds", [])
payload = dict()
Expand Down Expand Up @@ -907,7 +910,7 @@ def update_job(module, job_details, update_source_ids=None):
headers = {
"Accept": "application/json",
"Authorization": "Bearer " + token,
"user-agent": "cohesity-ansible/v1.3.0",
"user-agent": "cohesity-ansible/v{}".format(RELEASE_VERSION),
}
payload = job_details.copy()
del payload["token"]
Expand Down Expand Up @@ -969,7 +972,7 @@ def get_prot_job_details(self, module):
headers = {
"Accept": "application/json",
"Authorization": "Bearer " + token,
"user-agent": "cohesity-ansible/v1.3.0",
"user-agent": "cohesity-ansible/v{}".format(RELEASE_VERSION),
}
response = open_url(
url=uri,
Expand Down Expand Up @@ -1030,7 +1033,7 @@ def stop_job(module, self):
headers = {
"Accept": "application/json",
"Authorization": "Bearer " + token,
"user-agent": "cohesity-ansible/v1.3.0",
"user-agent": "cohesity-ansible/v{}".format(RELEASE_VERSION),
}
payload = self.copy()

Expand Down Expand Up @@ -1094,7 +1097,7 @@ def unregister_job(module, self):
headers = {
"Accept": "application/json",
"Authorization": "Bearer " + token,
"user-agent": "cohesity-ansible/v1.3.0",
"user-agent": "cohesity-ansible/v{}".format(RELEASE_VERSION),
}

payload = dict(deleteSnapshots=self["deleteSnapshots"])
Expand Down
25 changes: 14 additions & 11 deletions plugins/modules/cohesity_migrate_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,9 @@
get__restore_job__by_type,
get_cohesity_client,
)
from ansible_collections.cohesity.dataprotect.plugins.module_utils.cohesity_constants import (
RELEASE_VERSION,
)
except ImportError:
pass

Expand Down Expand Up @@ -286,7 +289,7 @@ def get_source_details(module):
headers = {
"Accept": "application/json",
"Authorization": "Bearer " + token,
"user-agent": "cohesity-ansible/v1.3.0",
"user-agent": "cohesity-ansible/v{}".format(RELEASE_VERSION),
}
response = open_url(
url=uri,
Expand Down Expand Up @@ -336,7 +339,7 @@ def get_vm_folder_id(module, source_id, resource_pool_id):
headers = {
"Accept": "application/json",
"Authorization": "Bearer " + token,
"user-agent": "cohesity-ansible/v1.3.0",
"user-agent": "cohesity-ansible/v{}".format(RELEASE_VERSION),
}
response = open_url(
url=uri,
Expand Down Expand Up @@ -386,7 +389,7 @@ def get_resource_pool_id(module, source_id):
headers = {
"Accept": "application/json",
"Authorization": "Bearer " + token,
"user-agent": "cohesity-ansible/v1.3.0",
"user-agent": "cohesity-ansible/v{}".format(RELEASE_VERSION),
}
response = open_url(
url=uri,
Expand Down Expand Up @@ -447,7 +450,7 @@ def get_datastore_id(module, source_id, resource_pool_id):
headers = {
"Accept": "application/json",
"Authorization": "Bearer " + token,
"user-agent": "cohesity-ansible/v1.3.0",
"user-agent": "cohesity-ansible/v{}".format(RELEASE_VERSION),
}
response = open_url(
url=uri,
Expand Down Expand Up @@ -496,7 +499,7 @@ def get_network_id(module, source_id, resource_pool_id):
headers = {
"Accept": "application/json",
"Authorization": "Bearer " + token,
"user-agent": "cohesity-ansible/v1.3.0",
"user-agent": "cohesity-ansible/v{}".format(RELEASE_VERSION),
}
response = open_url(
url=uri,
Expand Down Expand Up @@ -543,7 +546,7 @@ def get_backup_job_run_id(module, job_id):
headers = {
"Accept": "application/json",
"Authorization": "Bearer " + token,
"user-agent": "cohesity-ansible/v1.3.0",
"user-agent": "cohesity-ansible/v{}".format(RELEASE_VERSION),
}
response = open_url(
url=uri,
Expand Down Expand Up @@ -583,7 +586,7 @@ def get_backup_job_ids(module, job_names):
headers = {
"Accept": "application/json",
"Authorization": "Bearer " + token,
"user-agent": "cohesity-ansible/v1.3.0",
"user-agent": "cohesity-ansible/v{}".format(RELEASE_VERSION),
}
response = open_url(
url=uri,
Expand Down Expand Up @@ -627,7 +630,7 @@ def get_vmware_source_objects(module, source_id):
headers = {
"Accept": "application/json",
"Authorization": "Bearer " + token,
"user-agent": "cohesity-ansible/v1.3.0",
"user-agent": "cohesity-ansible/v{}".format(RELEASE_VERSION),
}

response = open_url(
Expand Down Expand Up @@ -689,7 +692,7 @@ def start_restore(module, uri, self):
headers = {
"Accept": "application/json",
"Authorization": "Bearer " + token,
"user-agent": "cohesity-ansible/v1.3.0",
"user-agent": "cohesity-ansible/v{}".format(RELEASE_VERSION),
}
payload = self.copy()

Expand Down Expand Up @@ -731,7 +734,7 @@ def create_migration_task(module, body):
headers = {
"Accept": "application/json",
"Authorization": "Bearer " + token,
"user-agent": "cohesity-ansible/v1.3.0",
"user-agent": "cohesity-ansible/v{}".format(RELEASE_VERSION),
}
# module.fail_json(msg=body)
response = open_url(
Expand Down Expand Up @@ -821,7 +824,7 @@ def get_protection_groups(module):
headers = {
"Accept": "application/json",
"Authorization": "Bearer " + token,
"user-agent": "cohesity-ansible/v1.3.0",
"user-agent": "cohesity-ansible/v{}".format(RELEASE_VERSION),
}
response = open_url(
url=uri,
Expand Down
Loading
Loading