1
0
Fork 0
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 (#945) (#972)

* 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:
patchback[bot] 2020-09-28 08:48:50 +02:00 committed by GitHub
parent feabad39f4
commit 99a161bd06
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- timezone - support Python3 on macos/darwin (https://github.com/ansible-collections/community.general/pull/945).

View file

@ -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)