mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
* Use platform.system for Darwin comparisons
In Python3, `platform.platform()` returns `macOS-10.15.6-x86_64-i386-64bit` instead of `Darwin-10.15.6-x86_64-i386-64bit`.
`platform.system()` returns `Darwin` On py2 and py3.
* Add changlog fragment
* Update changelogs/fragments/945-darwin-timezone-py3.yaml
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 954fb0a311
)
Co-authored-by: Matt Martz <matt@sivel.net>
This commit is contained in:
parent
feabad39f4
commit
99a161bd06
2 changed files with 3 additions and 1 deletions
2
changelogs/fragments/945-darwin-timezone-py3.yaml
Normal file
2
changelogs/fragments/945-darwin-timezone-py3.yaml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
bugfixes:
|
||||||
|
- timezone - support Python3 on macos/darwin (https://github.com/ansible-collections/community.general/pull/945).
|
|
@ -122,7 +122,7 @@ class Timezone(object):
|
||||||
module.fail_json(msg='Adjusting timezone is not supported in Global Zone')
|
module.fail_json(msg='Adjusting timezone is not supported in Global Zone')
|
||||||
|
|
||||||
return super(Timezone, SmartOSTimezone).__new__(SmartOSTimezone)
|
return super(Timezone, SmartOSTimezone).__new__(SmartOSTimezone)
|
||||||
elif re.match('^Darwin', platform.platform()):
|
elif platform.system() == 'Darwin':
|
||||||
return super(Timezone, DarwinTimezone).__new__(DarwinTimezone)
|
return super(Timezone, DarwinTimezone).__new__(DarwinTimezone)
|
||||||
elif re.match('^(Free|Net|Open)BSD', platform.platform()):
|
elif re.match('^(Free|Net|Open)BSD', platform.platform()):
|
||||||
return super(Timezone, BSDTimezone).__new__(BSDTimezone)
|
return super(Timezone, BSDTimezone).__new__(BSDTimezone)
|
||||||
|
|
Loading…
Reference in a new issue