def parseFromFile(args): """ Parse a local policy file to execute @type args: list of objects @param args: list of input arguments """ test = args.test debug = args.verbose policypath = args.path config = ConfigLoader(args.config) setLoggingSystem(config, debug) # get the policy schema path schemapath = config.SectionMap('Schemas')['policies'] logger.info('Getting the policy schema via file %s', policypath) # get the user account mapping mapFilename = config.SectionMap('AccountMapping')['file'] usermap = loadUserMap(mapFilename) # load the policy schema pParser = PolicyParser(None, test, 'PolicyManager', debug) xmlSchemaDoc = pParser.parseXmlSchema(None, [schemapath]) # load the policy doc and validate it pParser.parseFromFile(policypath, xmlSchemaDoc) # execute the policy as a B2SAFE workflow runPolicy(pParser.policy, usermap, test, 'PolicyManager', debug)
def parseFromFile(args): """ Parse a local policy file to execute """ test = args.test debug = args.verbose policypath = args.path schemapath = args.schemapath config = ConfigLoader(args.config) setLoggingSystem(config, debug) logger.info('Getting the policies via file %s', policypath) mapFilename = config.SectionMap('AccountMapping')['file'] usermap = loadUserMap(mapFilename) pParser = PolicyParser(None, test, 'PolicyManager', debug) xmlSchemaDoc = pParser.parseXmlSchema(None, schemapath) pParser.parseFromFile(policypath, xmlSchemaDoc) runPolicy(pParser.policy, usermap, test, 'PolicyManager', debug)