Skip to content

Commit 15f833a

Browse files
authored
Avoid six (again) (#179)
* Avoid six. * Add ignores.
1 parent 762551b commit 15f833a

File tree

9 files changed

+16
-1
lines changed

9 files changed

+16
-1
lines changed

changelogs/fragments/179-six.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
bugfixes:
2+
- Avoid using ``ansible.module_utils.six`` in more places to avoid deprecation warnings with
3+
ansible-core 2.20 (https://github.com/ansible-collections/community.hrobot/pull/179).

plugins/module_utils/robot.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,14 @@
1010
import sys
1111

1212
from ansible.module_utils.common.text.converters import to_native
13-
from ansible.module_utils.six.moves.urllib.error import HTTPError
1413
from ansible.module_utils.urls import fetch_url, open_url
1514

15+
try:
16+
from urllib.error import HTTPError
17+
except ImportError:
18+
# Python 2.x fallback:
19+
from urllib2 import HTTPError
20+
1621
import json
1722
import time
1823

tests/sanity/ignore-2.14.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
plugins/inventory/robot.py yamllint:unparsable-with-libyaml
2+
plugins/module_utils/robot.py pylint:ansible-bad-import-from
23
tests/ee/roles/smoke/library/smoke_ipaddress.py shebang

tests/sanity/ignore-2.15.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
plugins/inventory/robot.py yamllint:unparsable-with-libyaml
2+
plugins/module_utils/robot.py pylint:ansible-bad-import-from
23
plugins/modules/storagebox_snapshot_plan.py pylint:unbalanced-dict-unpacking # only seems to be a problem with pylint included in ansible-core 2.15
34
tests/ee/roles/smoke/library/smoke_ipaddress.py shebang

tests/sanity/ignore-2.16.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
plugins/inventory/robot.py yamllint:unparsable-with-libyaml
2+
plugins/module_utils/robot.py pylint:ansible-bad-import-from
23
tests/ee/roles/smoke/library/smoke_ipaddress.py shebang

tests/sanity/ignore-2.17.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
plugins/module_utils/robot.py pylint:ansible-bad-import-from
12
tests/ee/roles/smoke/library/smoke_ipaddress.py shebang

tests/sanity/ignore-2.18.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
plugins/module_utils/robot.py pylint:ansible-bad-import-from
12
tests/ee/roles/smoke/library/smoke_ipaddress.py shebang

tests/sanity/ignore-2.19.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
plugins/module_utils/robot.py pylint:ansible-bad-import-from
12
tests/ee/roles/smoke/library/smoke_ipaddress.py shebang

tests/sanity/ignore-2.20.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
plugins/module_utils/robot.py pylint:ansible-bad-import-from # we should not use six, but we also shouldn't use the import from the Python std lib... please decide!
12
tests/ee/roles/smoke/library/smoke_ipaddress.py shebang

0 commit comments

Comments
 (0)