Skip to content

Commit

Permalink
Fixed collection failure issuees for some ansible version
Browse files Browse the repository at this point in the history
  • Loading branch information
kavinagrawalcohesity committed Dec 5, 2024
1 parent 4ea8671 commit c7a0d6b
Show file tree
Hide file tree
Showing 18 changed files with 89 additions and 20 deletions.
7 changes: 5 additions & 2 deletions plugins/module_utils/cohesity_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@


import json
from ansible.module_utils.urls import open_url, urllib_error

from ansible.module_utils.urls import open_url
try:
from urllib import error as urllib_error
except ImportError:
import urllib2 as urllib_error

class ParameterViolation(Exception):
pass
Expand Down
6 changes: 5 additions & 1 deletion plugins/module_utils/cohesity_hints.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@
except ImportError:
from urllib.parse import quote

from ansible.module_utils.urls import open_url, urllib_error
from ansible.module_utils.urls import open_url
try:
from urllib import error as urllib_error
except ImportError:
import urllib2 as urllib_error
from ansible.module_utils.six.moves import urllib_parse

try:
Expand Down
6 changes: 5 additions & 1 deletion plugins/modules/cohesity_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,11 @@

from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils._text import to_bytes
from ansible.module_utils.urls import open_url, urllib_error
from ansible.module_utils.urls import open_url
try:
from urllib import error as urllib_error
except ImportError:
import urllib2 as urllib_error
from tempfile import mkdtemp

try:
Expand Down
6 changes: 5 additions & 1 deletion plugins/modules/cohesity_cancel_migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,11 @@
import json

from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.urls import open_url, urllib_error
from ansible.module_utils.urls import open_url
try:
from urllib import error as urllib_error
except ImportError:
import urllib2 as urllib_error

try:
# => When unit testing, we need to look in the correct location however, when run via ansible,
Expand Down
6 changes: 5 additions & 1 deletion plugins/modules/cohesity_finalize_migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,11 @@
import json

from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.urls import open_url, urllib_error
from ansible.module_utils.urls import open_url
try:
from urllib import error as urllib_error
except ImportError:
import urllib2 as urllib_error

try:
# => When unit testing, we need to look in the correct location however, when run via ansible,
Expand Down
6 changes: 5 additions & 1 deletion plugins/modules/cohesity_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,11 @@
import time
from collections import defaultdict
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.urls import open_url, urllib_error
from ansible.module_utils.urls import open_url
try:
from urllib import error as urllib_error
except ImportError:
import urllib2 as urllib_error

try:
# => When unit testing, we need to look in the correct location however, when run via ansible,
Expand Down
6 changes: 5 additions & 1 deletion plugins/modules/cohesity_migrate_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,11 @@

from datetime import datetime
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.urls import open_url, urllib_error
from ansible.module_utils.urls import open_url
try:
from urllib import error as urllib_error
except ImportError:
import urllib2 as urllib_error

try:
# => When unit testing, we need to look in the correct location however, when run via ansible,
Expand Down
6 changes: 5 additions & 1 deletion plugins/modules/cohesity_migration_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,11 @@

from collections import defaultdict
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.urls import open_url, urllib_error
from ansible.module_utils.urls import open_url
try:
from urllib import error as urllib_error
except ImportError:
import urllib2 as urllib_error

try:
# => When unit testing, we need to look in the correct location however, when run via ansible,
Expand Down
5 changes: 4 additions & 1 deletion plugins/modules/cohesity_oracle_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,14 @@
import copy
import time
from ansible.module_utils.basic import AnsibleModule
try:
from urllib import error as urllib_error
except ImportError:
import urllib2 as urllib_error

try:
# => When unit testing, we need to look in the correct location however, when run via ansible,
# => the expectation is that the modules will live under ansible.
from ansible.module_utils.urls import urllib_error
from ansible_collections.cohesity.dataprotect.plugins.module_utils.cohesity_hints import (
get_cohesity_client,
)
Expand Down
6 changes: 5 additions & 1 deletion plugins/modules/cohesity_oracle_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,11 @@
import json
import time
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.urls import open_url, urllib_error
from ansible.module_utils.urls import open_url
try:
from urllib import error as urllib_error
except ImportError:
import urllib2 as urllib_error

try:
# => When unit testing, we need to look in the correct location however, when run via ansible,
Expand Down
6 changes: 5 additions & 1 deletion plugins/modules/cohesity_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,11 @@

# Ansible Imports.
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.urls import open_url, urllib_error
from ansible.module_utils.urls import open_url
try:
from urllib import error as urllib_error
except ImportError:
import urllib2 as urllib_error

from ansible_collections.cohesity.dataprotect.plugins.module_utils.cohesity_auth import (
get__cohesity_auth__token,
Expand Down
6 changes: 5 additions & 1 deletion plugins/modules/cohesity_restore_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,11 @@
import time
from datetime import datetime
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.urls import open_url, urllib_error
from ansible.module_utils.urls import open_url
try:
from urllib import error as urllib_error
except ImportError:
import urllib2 as urllib_error

try:
# => When unit testing, we need to look in the correct location however, when run via ansible,
Expand Down
6 changes: 5 additions & 1 deletion plugins/modules/cohesity_restore_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,11 @@
except ImportError:
from urllib.parse import quote
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.urls import open_url, urllib_error
from ansible.module_utils.urls import open_url
try:
from urllib import error as urllib_error
except ImportError:
import urllib2 as urllib_error

try:
# => When unit testing, we need to look in the correct location however, when run via ansible,
Expand Down
6 changes: 5 additions & 1 deletion plugins/modules/cohesity_restore_vmware_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,11 @@
import time
from datetime import datetime
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.urls import open_url, urllib_error
from ansible.module_utils.urls import open_url
try:
from urllib import error as urllib_error
except ImportError:
import urllib2 as urllib_error

try:
# => When unit testing, we need to look in the correct location however, when run via ansible,
Expand Down
6 changes: 5 additions & 1 deletion plugins/modules/cohesity_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,11 @@
import json
import time
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.urls import open_url, urllib_error
from ansible.module_utils.urls import open_url
try:
from urllib import error as urllib_error
except ImportError:
import urllib2 as urllib_error

try:
# => When unit testing, we need to look in the correct location however, when run via ansible,
Expand Down
6 changes: 5 additions & 1 deletion plugins/modules/cohesity_sync_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,11 @@
import json

from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.urls import open_url, urllib_error
from ansible.module_utils.urls import open_url
try:
from urllib import error as urllib_error
except ImportError:
import urllib2 as urllib_error

try:
# => When unit testing, we need to look in the correct location however, when run via ansible,
Expand Down
7 changes: 5 additions & 2 deletions plugins/modules/cohesity_uda_protection_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,12 +236,15 @@


from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.urls import open_url, urllib_error
from ansible.module_utils.urls import open_url
try:
from urllib import error as urllib_error
except ImportError:
import urllib2 as urllib_error

try:
# => When unit testing, we need to look in the correct location however, when run via ansible,
# => the expectation is that the modules will live under ansible.
from ansible.module_utils.urls import urllib_error
from ansible_collections.cohesity.dataprotect.plugins.module_utils.cohesity_auth import (
get__cohesity_auth__token,
)
Expand Down
6 changes: 5 additions & 1 deletion plugins/modules/cohesity_uda_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,11 @@

import json
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.urls import open_url, urllib_error
from ansible.module_utils.urls import open_url
try:
from urllib import error as urllib_error
except ImportError:
import urllib2 as urllib_error

try:
# => When unit testing, we need to look in the correct location however, when run via ansible,
Expand Down

0 comments on commit c7a0d6b

Please sign in to comment.