Merge pull request #2241 from tonk/devel

Added dat and time facts to setup
pull/2242/head
Michael DeHaan 12 years ago
commit 60da7591c2

@ -26,6 +26,7 @@ import platform
import re import re
import socket import socket
import struct import struct
import datetime
DOCUMENTATION = ''' DOCUMENTATION = '''
--- ---
@ -117,6 +118,7 @@ class Facts(object):
self.get_selinux_facts() self.get_selinux_facts()
self.get_pkg_mgr_facts() self.get_pkg_mgr_facts()
self.get_lsb_facts() self.get_lsb_facts()
self.get_date_time_facts()
def populate(self): def populate(self):
return self.facts return self.facts
@ -289,6 +291,22 @@ class Facts(object):
except OSError, e: except OSError, e:
self.facts['selinux']['type'] = 'unknown' self.facts['selinux']['type'] = 'unknown'
def get_date_time_facts(self):
self.facts['date_time'] = {}
now = datetime.datetime.now()
self.facts['date_time']['year'] = now.strftime('%Y')
self.facts['date_time']['month'] = now.strftime('%m')
self.facts['date_time']['day'] = now.strftime('%d')
self.facts['date_time']['hour'] = now.strftime('%H')
self.facts['date_time']['minute'] = now.strftime('%M')
self.facts['date_time']['second'] = now.strftime('%S')
self.facts['date_time']['epoch'] = now.strftime('%s')
self.facts['date_time']['date'] = now.strftime('%Y-%m-%d')
self.facts['date_time']['time'] = now.strftime('%H:%M:%S')
class Hardware(Facts): class Hardware(Facts):
""" """
This is a generic Hardware subclass of Facts. This should be further This is a generic Hardware subclass of Facts. This should be further

Loading…
Cancel
Save