本文整理汇总了Python中lamvery.config.Config.get_profile方法的典型用法代码示例。如果您正苦于以下问题:Python Config.get_profile方法的具体用法?Python Config.get_profile怎么用?Python Config.get_profile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lamvery.config.Config
的用法示例。
在下文中一共展示了Config.get_profile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from lamvery.config import Config [as 别名]
# 或者: from lamvery.config.Config import get_profile [as 别名]
class BaseAction:
__metaclass__ = ABCMeta
_logger = None
def __init__(self, args):
self._config = Config(args.conf_file)
self._dry_run = False
logger_name = 'lamvery'
if hasattr(args, 'dry_run'):
self._dry_run = args.dry_run
if self._dry_run:
logger_name = '(Dry run) lamvery'
self._logger = get_logger(logger_name)
@abstractmethod
def action(self):
raise NotImplementedError
def _get_client(self, cls):
return cls(
region=self._config.get_region(),
profile=self._config.get_profile(),
dry_run=self._dry_run)
def get_lambda_client(self):
return self._get_client(LambdaClient)
def get_kms_client(self):
return self._get_client(KmsClient)
def get_events_client(self):
return self._get_client(EventsClient)
def get_logs_client(self):
return self._get_client(LogsClient)
def _get_diff(self, remote, local, keys):
diff = {}
for k in keys:
r = remote.get(k[0])
l = local.get(k[1])
if r == l:
diff[k[1]] = None
else:
diff[k[1]] = (r, l,)
return diff
def _print_diff(self, prefix, remote, local, keys):
diff = self._get_diff(remote, local, keys)
for k, v in diff.items():
if v is not None:
self._logger.warn(
'{p} {k}: {r} -> {l}'.format(p=prefix, k=k, r=v[0], l=v[1]))
示例2: test_get_profile
# 需要导入模块: from lamvery.config import Config [as 别名]
# 或者: from lamvery.config.Config import get_profile [as 别名]
def test_get_profile(self):
config = Config(self.conf_file)
eq_(config.get_profile(), 'default')