diff --git a/changelogs/fragments/945-darwin-timezone-py3.yaml b/changelogs/fragments/945-darwin-timezone-py3.yaml new file mode 100644 index 0000000000..98725b9454 --- /dev/null +++ b/changelogs/fragments/945-darwin-timezone-py3.yaml @@ -0,0 +1,2 @@ +bugfixes: +- timezone - support Python3 on macos/darwin (https://github.com/ansible-collections/community.general/pull/945). diff --git a/plugins/modules/system/timezone.py b/plugins/modules/system/timezone.py index 054cfc4763..d10dd9bb8b 100644 --- a/plugins/modules/system/timezone.py +++ b/plugins/modules/system/timezone.py @@ -122,7 +122,7 @@ class Timezone(object): module.fail_json(msg='Adjusting timezone is not supported in Global Zone') return super(Timezone, SmartOSTimezone).__new__(SmartOSTimezone) - elif re.match('^Darwin', platform.platform()): + elif platform.system() == 'Darwin': return super(Timezone, DarwinTimezone).__new__(DarwinTimezone) elif re.match('^(Free|Net|Open)BSD', platform.platform()): return super(Timezone, BSDTimezone).__new__(BSDTimezone)