diff --git a/plugins/module_utils/utc.py b/plugins/module_utils/utc.py deleted file mode 100644 index 012e39b..0000000 --- a/plugins/module_utils/utc.py +++ /dev/null @@ -1,24 +0,0 @@ -from __future__ import absolute_import, division, print_function - -__metaclass__ = type - -from datetime import timedelta, tzinfo - -ZERO = timedelta(0) -HOUR = timedelta(hours=1) - - -class UTC(tzinfo): - """Custom UTC for compatibility with Python 2.7""" - - def utcoffset(self, dt): - return ZERO - - def tzname(self, dt): - return "UTC" - - def dst(self, dt): - return ZERO - - -utc = UTC() diff --git a/plugins/modules/hcloud_server.py b/plugins/modules/hcloud_server.py index ada7299..7725a09 100644 --- a/plugins/modules/hcloud_server.py +++ b/plugins/modules/hcloud_server.py @@ -335,8 +335,7 @@ hcloud_server: from ansible.module_utils.basic import AnsibleModule from ansible.module_utils._text import to_native from ansible_collections.hetzner.hcloud.plugins.module_utils.hcloud import Hcloud -from ansible_collections.hetzner.hcloud.plugins.module_utils.utc import utc -from datetime import timedelta, datetime +from datetime import timedelta, datetime, timezone try: from hcloud.volumes.domain import Volume @@ -544,7 +543,7 @@ class AnsibleHcloudServer(Hcloud): if server_type.deprecation is None: return - if server_type.deprecation.unavailable_after < datetime.now(utc): + if server_type.deprecation.unavailable_after < datetime.now(timezone.utc): self.module.warn( 'Attention: The server plan %s is deprecated and can no longer be ordered. Existing servers of ' % server_type.name + 'that plan will continue to work as before and no action is required on your part. It is possible ' diff --git a/tests/config.yml b/tests/config.yml new file mode 100644 index 0000000..7822854 --- /dev/null +++ b/tests/config.yml @@ -0,0 +1,3 @@ +--- +modules: + python_requires: ">=3.7"