Skip to content

Commit

Permalink
Merge pull request ansible#9555 from bcoca/low_cost_facts
Browse files Browse the repository at this point in the history
allow fact objects to be instantiated w/o triggering all fact collection
  • Loading branch information
bcoca committed Feb 12, 2015
2 parents fd987f5 + 504995b commit 1b4f1e1
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions lib/ansible/module_utils/facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,20 +120,23 @@ class Facts(object):
{ 'path' : '/usr/bin/pkg', 'name' : 'pkg' },
]

def __init__(self):
def __init__(self, load_on_init=True):

self.facts = {}
self.get_platform_facts()
self.get_distribution_facts()
self.get_cmdline()
self.get_public_ssh_host_keys()
self.get_selinux_facts()
self.get_fips_facts()
self.get_pkg_mgr_facts()
self.get_lsb_facts()
self.get_date_time_facts()
self.get_user_facts()
self.get_local_facts()
self.get_env_facts()

if load_on_init:
self.get_platform_facts()
self.get_distribution_facts()
self.get_cmdline()
self.get_public_ssh_host_keys()
self.get_selinux_facts()
self.get_fips_facts()
self.get_pkg_mgr_facts()
self.get_lsb_facts()
self.get_date_time_facts()
self.get_user_facts()
self.get_local_facts()
self.get_env_facts()

def populate(self):
return self.facts
Expand Down

0 comments on commit 1b4f1e1

Please sign in to comment.