mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Revert "Added cross-platform uptime fact" since causing failures on Ubuntu.
This reverts commit 14a9966984
.
Conflicts:
lib/ansible/module_utils/facts.py
This commit is contained in:
parent
049f4a9882
commit
e01d5f9d84
1 changed files with 0 additions and 25 deletions
|
@ -120,7 +120,6 @@ class Facts(object):
|
||||||
self.facts = {}
|
self.facts = {}
|
||||||
self.get_platform_facts()
|
self.get_platform_facts()
|
||||||
self.get_distribution_facts()
|
self.get_distribution_facts()
|
||||||
self.get_uptime()
|
|
||||||
self.get_cmdline()
|
self.get_cmdline()
|
||||||
self.get_public_ssh_host_keys()
|
self.get_public_ssh_host_keys()
|
||||||
self.get_selinux_facts()
|
self.get_selinux_facts()
|
||||||
|
@ -134,20 +133,6 @@ class Facts(object):
|
||||||
def populate(self):
|
def populate(self):
|
||||||
return self.facts
|
return self.facts
|
||||||
|
|
||||||
def get_uptime(self):
|
|
||||||
uptime_path = module.get_bin_path('uptime')
|
|
||||||
if uptime_path:
|
|
||||||
rc, out, err = module.run_command(uptime_path)
|
|
||||||
if rc == 0:
|
|
||||||
raw = out.replace(',','')
|
|
||||||
days = int(raw.split()[2])
|
|
||||||
if 'min' in raw:
|
|
||||||
hours = 0
|
|
||||||
minutes = int(raw.split()[4])
|
|
||||||
else:
|
|
||||||
hours, minutes = map(int, raw.split()[4].split(':'))
|
|
||||||
self.facts['uptime'] = days*24*60*60 + hours*60*60 + minutes*60
|
|
||||||
|
|
||||||
# Platform
|
# Platform
|
||||||
# platform.system() can be Linux, Darwin, Java, or Windows
|
# platform.system() can be Linux, Darwin, Java, or Windows
|
||||||
def get_platform_facts(self):
|
def get_platform_facts(self):
|
||||||
|
@ -558,11 +543,6 @@ class LinuxHardware(Hardware):
|
||||||
pass
|
pass
|
||||||
return self.facts
|
return self.facts
|
||||||
|
|
||||||
def get_uptime(self):
|
|
||||||
data = get_file_content('/proc/uptime')
|
|
||||||
if data:
|
|
||||||
self.facts['uptime'] = float(data.split()[0])
|
|
||||||
|
|
||||||
def get_memory_facts(self):
|
def get_memory_facts(self):
|
||||||
if not os.access("/proc/meminfo", os.R_OK):
|
if not os.access("/proc/meminfo", os.R_OK):
|
||||||
return
|
return
|
||||||
|
@ -829,11 +809,6 @@ class SunOSHardware(Hardware):
|
||||||
self.get_memory_facts()
|
self.get_memory_facts()
|
||||||
return self.facts
|
return self.facts
|
||||||
|
|
||||||
def get_uptime(self):
|
|
||||||
rc, out, err = module.run_command("/usr/bin/kstat -p unix:0:system_misc:snaptime")
|
|
||||||
if out:
|
|
||||||
self.facts['uptime'] = float(out.split()[1])
|
|
||||||
|
|
||||||
def get_cpu_facts(self):
|
def get_cpu_facts(self):
|
||||||
physid = 0
|
physid = 0
|
||||||
sockets = {}
|
sockets = {}
|
||||||
|
|
Loading…
Add table
Reference in a new issue