def logging_policy(self, lp_path): """Desc""" print("[*] Populating Logging Policies...") if lp_path: lp_list = glob.glob(lp_path + '*.yml') else: lp_dir = ATCconfig.get('logging_policies_dir') lp_list = glob.glob(lp_dir + '/*.yml') for lp_file in lp_list: try: lp = LoggingPolicy(lp_file) lp.render_template("confluence") confluence_data = { "title": lp.fields["title"], "spacekey": self.space, "parentid": str(ATCutils.confluence_get_page_id( self.apipath, self.auth, self.space, "Logging Policies")), "confluencecontent": lp.content, } res = ATCutils.push_to_confluence(confluence_data, self.apipath, self.auth) if res == 'Page updated': print("==> updated page: LP '" + lp.fields['title'] + "'") # print("Done: ", lp.fields['title']) except Exception as err: print(lp_file + " failed") print("Err message: %s" % err) print('-' * 60) traceback.print_exc(file=sys.stdout) print('-' * 60) print("[+] Logging Policies populated!")
def logging_policy(self, lp_path): """Desc""" if lp_path: lp_list = glob.glob(lp_path + '*.yml') else: lp_list = glob.glob('../logging_policies/*.yml') for lp_file in lp_list: try: lp = LoggingPolicy(lp_file) lp.render_template("markdown") lp.save_markdown_file(atc_dir=self.atc_dir) except Exception as e: print(lp_file + " failed\n\n%s\n\n" % e) print("Err message: %s" % e) print('-' * 60) traceback.print_exc(file=sys.stdout) print('-' * 60)
def logging_policy(self, lp_path): """Populate Logging Policies""" print("Populating Logging Policies..") if lp_path: lp_list = glob.glob(lp_path + '*.yml') else: lp_dir = ATCconfig.get('logging_policies_dir') lp_list = glob.glob(lp_dir + '/*.yml') for lp_file in lp_list: try: lp = LoggingPolicy(lp_file) lp.render_template("markdown") lp.save_markdown_file(atc_dir=self.atc_dir) except Exception as e: print(lp_file + " failed\n\n%s\n\n" % e) print("Err message: %s" % e) print('-' * 60) traceback.print_exc(file=sys.stdout) print('-' * 60) print("Logging Policies populated!")