mirror of
https://github.com/ansible/awx.git
synced 2026-05-08 01:47:35 -02:30
ads epoch scan date specification feature
This commit is contained in:
@@ -104,6 +104,11 @@ class FactScanBuilder(object):
|
|||||||
self.version_objs = []
|
self.version_objs = []
|
||||||
self.timestamps = []
|
self.timestamps = []
|
||||||
|
|
||||||
|
self.epoch = now().replace(year=2015, microsecond=0)
|
||||||
|
|
||||||
|
def set_epoch(self, epoch):
|
||||||
|
self.epoch = epoch
|
||||||
|
|
||||||
def add_fact(self, module, facts):
|
def add_fact(self, module, facts):
|
||||||
self.facts_data[module] = facts
|
self.facts_data[module] = facts
|
||||||
|
|
||||||
@@ -124,7 +129,7 @@ class FactScanBuilder(object):
|
|||||||
for i in range(0, scan_count):
|
for i in range(0, scan_count):
|
||||||
scan = {}
|
scan = {}
|
||||||
scan_version = {}
|
scan_version = {}
|
||||||
timestamp = now().replace(year=2015 - i, microsecond=0)
|
timestamp = self.epoch.replace(year=self.epoch.year - i, microsecond=0)
|
||||||
for module in self.facts_data:
|
for module in self.facts_data:
|
||||||
fact_objs = []
|
fact_objs = []
|
||||||
version_objs = []
|
version_objs = []
|
||||||
@@ -181,6 +186,16 @@ class FactScanBuilder(object):
|
|||||||
|
|
||||||
return [self.host_objs[i].hostname for i in range(index_start, index_end)]
|
return [self.host_objs[i].hostname for i in range(index_start, index_end)]
|
||||||
|
|
||||||
|
def get_host(self, index):
|
||||||
|
return self.host_objs[index]
|
||||||
|
|
||||||
|
def get_hosts(self, index_start=None, index_end=None):
|
||||||
|
if index_start is None:
|
||||||
|
index_start = 0
|
||||||
|
if index_end is None:
|
||||||
|
index_end = len(self.host_objs)
|
||||||
|
|
||||||
|
return self.host_objs[index_start:index_end]
|
||||||
|
|
||||||
def get_scan_count(self):
|
def get_scan_count(self):
|
||||||
return len(self.fact_objs)
|
return len(self.fact_objs)
|
||||||
|
|||||||
Reference in New Issue
Block a user