Skip to content

Commit

Permalink
remove debug printouts
Browse files Browse the repository at this point in the history
  • Loading branch information
terwilligergreen committed Oct 19, 2016
1 parent 5365169 commit 07ed30b
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 20 deletions.
27 changes: 21 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,15 +224,30 @@ Below is an example of using ComplianceLib to load and query compliance posture
>>> import compliancelib
>>> sp = compliancelib.SystemCompliance()
>>> sp.load_system_from_opencontrol_repo('https://github.com/opencontrol/freedonia-compliance')
[LOG compliancelib]; INFO; 2016-10-16 11:52:52,968; opencontrolfiles; repo_url in resolve_ocfile_url: https://github.com/opencontrol/freedonia-compliance
[LOG compliancelib]; INFO; 2016-10-16 11:52:52,968; opencontrolfiles; repo_ref in list_components_urls: https://github.com/opencontrol/freedonia-compliance
[LOG compliancelib]; INFO; 2016-10-16 11:52:52,968; opencontrolfiles; repo_url in resolve_ocfile_url: https://github.com/opencontrol/freedonia-compliance
[LOG compliancelib]; INFO; 2016-10-16 11:52:52,969; opencontrolfiles; ocfileurl: https://raw.githubusercontent.com/opencontrol/freedonia-compliance/master/opencontrol.yaml
[LOG compliancelib]; INFO; 2016-10-19 06:05:57,807; opencontrolfiles; ocfileurl: https://raw.githubusercontent.com/opencontrol/freedonia-compliance/master/opencontrol.yaml
[LOG compliancelib]; INFO; 2016-10-19 06:05:58,503; opencontrolfiles; ocfileurl: https://raw.githubusercontent.com/opencontrol/freedonia-compliance/master/opencontrol.yaml
[LOG compliancelib]; INFO; 2016-10-19 06:05:58,503; opencontrolfiles; ocfileurl: https://raw.githubusercontent.com/opencontrol/freedonia-compliance/master/opencontrol.yaml
[LOG compliancelib]; INFO; 2016-10-19 06:05:58,503; opencontrolfiles; ocfileurl: https://raw.githubusercontent.com/opencontrol/freedonia-compliance/master/opencontrol.yaml
[LOG compliancelib]; INFO; 2016-10-19 06:05:58,503; opencontrolfiles; ocfileurl: https://raw.githubusercontent.com/opencontrol/freedonia-compliance/master/opencontrol.yaml
[LOG compliancelib]; INFO; 2016-10-19 06:05:58,503; opencontrolfiles; ocfileurl: https://raw.githubusercontent.com/opencontrol/freedonia-compliance/master/opencontrol.yaml
[LOG compliancelib]; INFO; 2016-10-19 06:05:58,503; opencontrolfiles; ocfileurl: https://raw.githubusercontent.com/opencontrol/freedonia-frist/master/opencontrol.yaml
[LOG compliancelib]; INFO; 2016-10-19 06:05:58,641; opencontrolfiles; ocfileurl: https://raw.githubusercontent.com/opencontrol/freedonia-frist/master/opencontrol.yaml
[LOG compliancelib]; INFO; 2016-10-19 06:05:58,842; opencontrolfiles; ocfileurl: https://raw.githubusercontent.com/opencontrol/freedonia-aws-compliance/master/opencontrol.yaml
True

>>> sp.system['name'] = "My Awesome Website"
>>> sp.system['name'] = "My Awesome System"
>>> sp.system['name']
'My Awesome Website'
'My Awesome System'

>>> sp.components()
['Audit Policy', 'AWS Core', 'AWS Implementation']
>>> sp.standards()
['FRIST-800-53']
>>> sp.certifications()
['FredRAMP-low']
>>> sp.systems()
['freedonia-aws']


>>> sp.control('AU-1').title
'AUDIT AND ACCOUNTABILITY POLICY AND PROCEDURES'
Expand Down
26 changes: 20 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -210,15 +210,29 @@ Below is an example of using ComplianceLib to load and query compliance posture
>>> import compliancelib
>>> sp = compliancelib.SystemCompliance()
>>> sp.load_system_from_opencontrol_repo('https://github.com/opencontrol/freedonia-compliance')
[LOG compliancelib]; INFO; 2016-10-16 11:52:52,968; opencontrolfiles; repo_url in resolve_ocfile_url: https://github.com/opencontrol/freedonia-compliance
[LOG compliancelib]; INFO; 2016-10-16 11:52:52,968; opencontrolfiles; repo_ref in list_components_urls: https://github.com/opencontrol/freedonia-compliance
[LOG compliancelib]; INFO; 2016-10-16 11:52:52,968; opencontrolfiles; repo_url in resolve_ocfile_url: https://github.com/opencontrol/freedonia-compliance
[LOG compliancelib]; INFO; 2016-10-16 11:52:52,969; opencontrolfiles; ocfileurl: https://raw.githubusercontent.com/opencontrol/freedonia-compliance/master/opencontrol.yaml
[LOG compliancelib]; INFO; 2016-10-19 06:05:57,807; opencontrolfiles; ocfileurl: https://raw.githubusercontent.com/opencontrol/freedonia-compliance/master/opencontrol.yaml
[LOG compliancelib]; INFO; 2016-10-19 06:05:58,503; opencontrolfiles; ocfileurl: https://raw.githubusercontent.com/opencontrol/freedonia-compliance/master/opencontrol.yaml
[LOG compliancelib]; INFO; 2016-10-19 06:05:58,503; opencontrolfiles; ocfileurl: https://raw.githubusercontent.com/opencontrol/freedonia-compliance/master/opencontrol.yaml
[LOG compliancelib]; INFO; 2016-10-19 06:05:58,503; opencontrolfiles; ocfileurl: https://raw.githubusercontent.com/opencontrol/freedonia-compliance/master/opencontrol.yaml
[LOG compliancelib]; INFO; 2016-10-19 06:05:58,503; opencontrolfiles; ocfileurl: https://raw.githubusercontent.com/opencontrol/freedonia-compliance/master/opencontrol.yaml
[LOG compliancelib]; INFO; 2016-10-19 06:05:58,503; opencontrolfiles; ocfileurl: https://raw.githubusercontent.com/opencontrol/freedonia-compliance/master/opencontrol.yaml
[LOG compliancelib]; INFO; 2016-10-19 06:05:58,503; opencontrolfiles; ocfileurl: https://raw.githubusercontent.com/opencontrol/freedonia-frist/master/opencontrol.yaml
[LOG compliancelib]; INFO; 2016-10-19 06:05:58,641; opencontrolfiles; ocfileurl: https://raw.githubusercontent.com/opencontrol/freedonia-frist/master/opencontrol.yaml
[LOG compliancelib]; INFO; 2016-10-19 06:05:58,842; opencontrolfiles; ocfileurl: https://raw.githubusercontent.com/opencontrol/freedonia-aws-compliance/master/opencontrol.yaml
True

>>> sp.system['name'] = "My Awesome Website"
>>> sp.system['name'] = "My Awesome System"
>>> sp.system['name']
'My Awesome Website'
'My Awesome System'

>>> sp.components()
['Audit Policy', 'AWS Core', 'AWS Implementation']
>>> sp.standards()
['FRIST-800-53']
>>> sp.certifications()
['FredRAMP-low']
>>> sp.systems()
['freedonia-aws']

>>> sp.control('AU-1').title
'AUDIT AND ACCOUNTABILITY POLICY AND PROCEDURES'
Expand Down
9 changes: 1 addition & 8 deletions compliancelib/systemcompliance.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ def control_ssp_text(self, cid):
def load_system_from_opencontrol_repo(self, repo_url, revision='master', verbose=''):
"load system details and control implementation from a repo"
# TODO Reset all values before loading new system
#TODO handle not finding opencontrol.yaml file in repo
# TODO handle not finding opencontrol.yaml file in repo
ocf = OpenControlFiles()

for item_type in self.supported_dictionaries:
Expand All @@ -328,28 +328,21 @@ def load_system_from_opencontrol_repo(self, repo_url, revision='master', verbose

# load dependencies
for item_type in self.supported_dictionaries:
print("**** looking for item_type: ", item_type)
# get standards in dependencies
for dependency_item in ocf.list_dependency_items_in_repo(ocf.resolve_ocfile_url(repo_url, revision), item_type):
print("******** dependency_item ******\n", dependency_item)
dependency_ocf = OpenControlFiles()
dependency_repo_url = dependency_item['url']
print("******** dependency_repo_url ******\n", dependency_repo_url)
dependency_revision = dependency_item['revision']
# print("******** resolved dependency *******\n", dependency_ocf.resolve_ocfile_url(dependency_repo_url.strip("/"), dependency_revision))
if (item_type == 'systems'):
url = dependency_ocf.resolve_ocfile_url(dependency_repo_url.strip("/"), dependency_revision)
print("*** Reading system dependencies '%s' %s" % (item_type, url))
self.add_system_dict_from_url(item_type, url)
# read remote item_type components
for url in dependency_ocf.list_items_urls_in_repo(dependency_ocf.resolve_ocfile_url(dependency_repo_url.strip("/"), dependency_revision), "components"):
print("*** Reading dependencies '%s' %s" % ("components", url))
# TODO test if we will end duplicating and overwriting existing key
self.add_system_dict_from_url("components", url)
else:
# read remote item_type indicated
for url in dependency_ocf.list_items_urls_in_repo(dependency_ocf.resolve_ocfile_url(dependency_repo_url.strip("/"), dependency_revision), item_type):
print("*** Reading dependencies '%s' %s" % (item_type, url))
# TODO test if we will end duplicating and overwriting existing key
self.add_system_dict_from_url(item_type, url)

Expand Down

0 comments on commit 07ed30b

Please sign in to comment.