# Path: amonagent/modules/distro.py
# def get_distro():
#     distro = {}
#     try:
#        f = Facts()
#     except:
#         f = False
# 
# 
#     if f:
#         facts_filter = [
#             'distribution_version', 
#             'distribution',
#         ]
#         replaced_names = {
#             'distribution_version': 'version',
#             'distribution' : 'name'
#         }
#         if type(f.facts) is dict:
# 
#             for key, fact in f.facts.items():
#                 if key in facts_filter:
#                     reported_key = replaced_names[key]
#                     distro[reported_key] = fact
#             
# 
#     return distro
# 
# Path: amonagent/utils.py
# def unix_utc_now():
# 	d = datetime.utcnow()
# 	_unix = calendar.timegm(d.utctimetuple())
# 
# 	return _unix


import re
import subprocess
from amonagent.modules.distro import get_distro
from amonagent.utils import unix_utc_now



class SystemPackages(object):

	def __init__(self):
		distro = get_distro()

		# apt or yum
		self.distro_type = distro.get('type')
		self.next_run = unix_utc_now()



	def apt_updates(self):
		# Update repository info only once per 24 hours

# Path: amonagent/modules/distro.py
# def get_distro():
#     distro = {}
#     try:
#        f = Facts()
#     except:
#         f = False
# 
# 
#     if f:
#         facts_filter = [
#             'distribution_version', 
#             'distribution',
#         ]
#         replaced_names = {
#             'distribution_version': 'version',
#             'distribution' : 'name'
#         }
#         if type(f.facts) is dict:
# 
#             for key, fact in f.facts.items():
#                 if key in facts_filter:
#                     reported_key = replaced_names[key]
#                     distro[reported_key] = fact
#             
# 
#     return distro
# 
# Path: amonagent/utils.py
# def unix_utc_now():
# 	d = datetime.utcnow()
# 	_unix = calendar.timegm(d.utctimetuple())
# 
# 	return _unix


# Path: amonagent/modules/packages.py
import re
import subprocess
from amonagent.modules.distro import get_distro
from amonagent.utils import unix_utc_now




class SystemPackages(object):

	def __init__(self):
		distro = get_distro()

		# apt or yum
		self.distro_type = distro.get('type')
		self.next_run = unix_utc_now()



	def apt_updates(self):
		# Update repository info only once per 24 hours

		now  = unix_utc_now()