Skip to content

Commit

Permalink
Fix OS resolving for RHEL systems
Browse files Browse the repository at this point in the history
  • Loading branch information
Suszyński Krzysztof committed Aug 9, 2017
1 parent 36c2c02 commit 12f1e02
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
3 changes: 3 additions & 0 deletions puppeter/domain/model/osfacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class OsFamily(Enum):
AIX = 6
Solaris = 7
MacOS = 8
Arch = 9

def is_posix(self):
return self not in (OsFamily.Unknown, OsFamily.Windows)
Expand All @@ -27,6 +28,8 @@ class OperatingSystem(Enum):
Ubuntu = 7
OpenSuse = 8
Fedora = 9
SLES = 10
ArchLinux = 11


class OperatingSystemRelease(str):
Expand Down
18 changes: 11 additions & 7 deletions puppeter/persistence/service/os.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,19 @@

def calculate_operatingsystem():
if platform.system() == 'Linux':
dist = distro.linux_distribution(full_distribution_name=False)[0]
dist = distro.id()
return {
'fedora': OperatingSystem.Fedora,
'centos': OperatingSystem.CentOS,
'oracle linux server': OperatingSystem.OracleLinux,
'red hat enterprise linux server': OperatingSystem.RedHat,
'scientific linux': OperatingSystem.Scientific,
'oracle': OperatingSystem.OracleLinux,
'rhel': OperatingSystem.RedHat,
'scientific': OperatingSystem.Scientific,
'debian': OperatingSystem.Debian,
'ubuntu': OperatingSystem.Ubuntu,
'opensuse': OperatingSystem.OpenSuse
}.get(dist.lower().strip(), OperatingSystem.Unknown)
'sles': OperatingSystem.SLES,
'opensuse': OperatingSystem.OpenSuse,
'arch': OperatingSystem.ArchLinux
}.get(dist, OperatingSystem.Unknown)
return OperatingSystem.Unknown


Expand All @@ -34,7 +36,9 @@ def calculate_osfamily():
OperatingSystem.Scientific: OsFamily.RedHat,
OperatingSystem.Debian: OsFamily.Debian,
OperatingSystem.Ubuntu: OsFamily.Debian,
OperatingSystem.OpenSuse: OsFamily.Suse
OperatingSystem.OpenSuse: OsFamily.Suse,
OperatingSystem.SLES: OsFamily.Suse,
OperatingSystem.ArchLinux: OsFamily.Arch
}.get(Facter.get(OperatingSystem), OsFamily.Unknown)


Expand Down

0 comments on commit 12f1e02

Please sign in to comment.