本文整理汇总了Python中misc.Logger.logger.info函数的典型用法代码示例。如果您正苦于以下问题:Python info函数的具体用法?Python info怎么用?Python info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了info函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_method
def create_method(self, restid, resourceid, method, authorizationtype, apikeyreq=False, further_opts=None):
"""
This function creates a method object
:param method: the method that is requested
:type method: basestring
:param restid: the id of the rest api object
:type restid: basestring
:param resourceid: id of a single resource object
:type resourceid: basestring
:param authorizationtype:
:type authorizationtype: basestring
:param apikeyreq: should apikey be required
:type apikeyreq: bool
:param further_opts: This opt passes in json_data fur not mandatory options
:type further_opts: dict
:return: the created method object
"""
if self.dryrun:
logger.info("Dryrun requested no changes will be done")
return None
if isinstance(apikeyreq, bool) is False:
logger.debug("apikey is not boolean, converting")
apikeyreq = Misc.str2bool(apikeyreq)
opts = {'restApiId': restid, 'resourceId': resourceid, 'httpMethod': method,
'authorizationType': authorizationtype, 'apiKeyRequired': apikeyreq}
if 'requestParameters' in further_opts:
opts['requestParameters'] = further_opts['requestParameters']
if 'requestModels' in further_opts:
opts['requestModels'] = further_opts['requestModels']
logger.debug("The opts sent to create method %s" % opts)
resp = self.apigateway_client.put_method(**opts)
super(Apigateway, self).query_information(query=resp)
return resp
示例2: create_method_response
def create_method_response(self, restid, resourceid, method, statuscode, further_ops):
"""
This function creates a method response
:param method: the method that is requested
:type method: basestring
:param restid: the id of the rest api object
:type restid: basestring
:param resourceid: id of a single resource object
:type resourceid: basestring
:param statuscode: the status code
:type statuscode: basestring
:param further_opts: This opt passes in json_data fur not mandatory options
:type further_opts: dict
:return: the created method response object
"""
if self.dryrun:
logger.info("Dryrun requested no changes will be done")
return None
opts = {'restApiId': restid, 'resourceId': resourceid, 'httpMethod': method, 'statusCode': statuscode}
if 'responseParameters' in further_ops:
opts['responseParameters'] = further_ops['responseParameters']
if 'responseModels' in further_ops:
opts['responseModels'] = further_ops['responseModels']
logger.debug("The opts sent to create method response %s" % opts)
resp = self.apigateway_client.put_method_response(**opts)
super(Apigateway, self).query_information(query=resp)
return resp
示例3: create_integration
def create_integration(self, restid, resourceid, method, integration_type, further_opts=None):
"""
This function creates an integration object
:param method: the method that is requested
:type method: basestring
:param restid: the id of the rest api object
:type restid: basestring
:param resourceid: id of a single resource object
:type resourceid: basestring
:param integration_type: an enum of the integration type
:type integration_type: basestring
:param further_opts: This opt passes in json_data fur not mandatory options
:type further_opts: dict
:return: object of the created integration
"""
if self.dryrun:
logger.info("Dryrun requested no changes will be done")
return None
opts = {'restApiId': restid, 'resourceId': resourceid, 'httpMethod': method, 'type': integration_type,
'integrationHttpMethod': method}
# There is aws cli bug and integrationHttpMethod also needs to be added. may change later
# opts = {'restApiId': restid, 'resourceId': resourceid, 'httpMethod': method, 'type': integration_type}
for element in ['integrationHttpMethod', 'uri', 'credentials', 'requestParameters', 'requestTemplates',
'cacheNamespace', 'cacheNamespace']:
if element in further_opts:
opts[element] = further_opts[element]
logger.debug("The opts for integration object creation: %s" % opts)
resp = self.apigateway_client.put_integration(**opts)
super(Apigateway, self).query_information(query=resp)
return resp
示例4: report_elb
def report_elb(self):
'''
This function is a wrapper for parsing arguments and printing for elb attribute reports
Tested
:return:
'''
logger.info("Started report generation command")
a = awsrequests(session=self.account_information['session'])
parser = argparse.ArgumentParser(description='report generation about elbs', usage='''kerrigan.py elb report_elb [<args>]]
''' + self.global_options, formatter_class=argparse.ArgumentDefaultsHelpFormatter, prog="kerrigan")
parser.add_argument('--columns', action='store', default=a.service_supported_columns(service="elb"),
help="Which columns to display")
parser.add_argument('--filters', action='store', default=None,
help="The filters that should be used, example: key1:value1,key2:value2")
args = parser.parse_args(sys.argv[3:])
columns = Misc.parse_service_columns(columns=args.columns, service="elb")
if args.filters:
filters = Misc.format_boto3_filter(filters=args.filters)
else:
filters = None
result = a.information_elbs(columns=columns, filters=filters)
for res in result:
if self.account_information['logger_arguments']['table']:
res['AvailabilityZones'] = Misc.list_to_multiline_string(list=res['AvailabilityZones'])
res['SecurityGroups'] = Misc.list_to_multiline_string(list=res['SecurityGroups'])
res['Instances'] = Misc.list_to_multiline_string(list=res['Instances'])
else:
res['AvailabilityZones'] = Misc.join_list_to_string(list=res['AvailabilityZones'])
res['SecurityGroups'] = Misc.join_list_to_string(list=res['SecurityGroups'])
res['Instances'] = Misc.join_list_to_string(list=res['Instances'])
logger.output(data=result, csvvar=self.account_information['logger_arguments']['csv'],
tablevar=self.account_information['logger_arguments']['table'])
示例5: delete_deployment
def delete_deployment(self, restid, deploymentid):
if self.dryrun:
logger.info("Dryrun requested no changes will be done")
return None
ret = self.apigateway_client.delete_deployment(restApiId=restid, deploymentId=deploymentid)
super(Apigateway, self).query_information(query=ret)
return ret
示例6: create_integration_response
def create_integration_response(self, restid, resourceid, method, statuscode, further_opts=None):
"""
This function creates an integration response object
:param method: the method that is requested
:type method: basestring
:param restid: the id of the rest api object
:type restid: basestring
:param resourceid: id of a single resource object
:type resourceid: basestring
:param statuscode: thestatus code to attach integration response
:type statuscode: basestring
:param further_opts: This opt passes in json_data fur not mandatory options
:type further_opts: dict
:return:
"""
if self.dryrun:
logger.info("Dryrun requested no changes will be done")
return None
opts = {'restApiId': restid, 'resourceId': resourceid, 'httpMethod': method, 'statusCode': statuscode}
for element in ['selectionPattern', 'responseParameters', 'responseTemplates']:
if element in further_opts:
if further_opts[element] == "None":
opts[element] = None
else:
opts[element] = further_opts[element]
logger.debug("The opts sent to create integration response %s" % opts)
resp = self.apigateway_client.put_integration_response(**opts)
super(Apigateway, self).query_information(query=resp)
return resp
示例7: stack
def stack(self):
logger.info("Starting to gather information")
parser = argparse.ArgumentParser(description='ec2 tool for devops', usage='''kerrigan.py upgrade stack [<args>]]
''' + self.global_options)
parser.add_argument('--stack', action='store', help="Which stack to upgrade",required=True)
parser.add_argument('--env', action='store', help="Which env to do tasks in",required=True)
args = parser.parse_args(sys.argv[3:])
示例8: compare
def compare(self):
logger.info("Starting to gather information")
parser = argparse.ArgumentParser(description='ec2 tool for devops', usage='''kerrigan.py s3 compare [<args>]]
''' + self.global_options)
parser.add_argument('--env', action='store', help="Name of env")
args = parser.parse_args(sys.argv[3:])
c = awschecks()
c.compare_s3(env=args.env)
示例9: compare_certs
def compare_certs(self):
logger.info("Going to check env certs")
parser = argparse.ArgumentParser(description='ec2 tool for devops', usage='''kerrigan.py iam compare_certs [<args>]]
''' + self.global_options)
parser.add_argument('--env', action='store', help="Envs to check")
args = parser.parse_args(sys.argv[3:])
a = awschecks()
a.compare_certs(env=args.env)
示例10: query_parameter_group
def query_parameter_group(self):
logger.info("Gather parameter group values")
parser = argparse.ArgumentParser(description='ec2 tool for devops', usage='''kerrigan.py rds query_parameter_group [<args>]]
''' + self.global_options)
parser.add_argument('--name', action='store', help="Name of db-parameter group")
args = parser.parse_args(sys.argv[3:])
e = awsrds()
ret = e.get_parameter_group(name=args.name)
示例11: list_users
def list_users(self):
logger.info("Going to list users")
parser = argparse.ArgumentParser(description='ec2 tool for devops', usage='''kerrigan.py iam list_users [<args>]]
''' + self.global_options)
args = parser.parse_args(sys.argv[3:])
a = awsrequests()
res = a.list_iam_users()
logger.output(data=res, csvvar=self.cli['csv'], tablevar=self.cli['table'])
示例12: gw_watchdog
def gw_watchdog(self):
logger.info("Starting watchdog")
parser = argparse.ArgumentParser(description='ec2 tool for devops', usage='''kerrigan.py route53 watchdog [<args>]]
''' + self.global_options)
parser.add_argument('--env', action='store', help="Environment to gather information about")
args = parser.parse_args(sys.argv[3:])
a = awsservice()
a.gw_watchdog(env=args.env)
示例13: delete_server_cert
def delete_server_cert(self):
logger.info("Going to delete cert")
parser = argparse.ArgumentParser(description='ec2 tool for devops', usage='''kerrigan.py iam delete_server_cert [<args>]]
''' + self.global_options)
parser.add_argument('--cert_name', action='store', help="Name of certificate to delete")
args = parser.parse_args(sys.argv[3:])
a = awsrequests()
a.server_certificate_delete(cert_name=args.cert_name)
示例14: compare
def compare(self):
logger.info("Creating ELB")
parser = argparse.ArgumentParser(description='ec2 tool for devops', usage='''kerrigan.py elb create [<args>]]
''' + self.global_options)
parser.add_argument('--env', action='store', help="Which env to check")
args = parser.parse_args(sys.argv[3:])
c = awschecks()
c.compare_elb(env=args.env)
示例15: sync_instances
def sync_instances(self):
logger.info("Syncing Instances to ELB")
parser = argparse.ArgumentParser(description='ec2 tool for devops', usage='''kerrigan.py elb sync_instances [<args>]]
''' + self.global_options)
parser.add_argument('--env', action='store', help="Which env to check")
parser.add_argument('--dryrun', action='store_true',default=False, help="No changes should be done")
args = parser.parse_args(sys.argv[3:])
c = awschecks()
c.sync_instances_to_elbs(env=args.env,dryrun=args.dryrun)