本文整理汇总了Python中chef.api.ChefAPI.from_config_file方法的典型用法代码示例。如果您正苦于以下问题:Python ChefAPI.from_config_file方法的具体用法?Python ChefAPI.from_config_file怎么用?Python ChefAPI.from_config_file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类chef.api.ChefAPI
的用法示例。
在下文中一共展示了ChefAPI.from_config_file方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_api
# 需要导入模块: from chef.api import ChefAPI [as 别名]
# 或者: from chef.api.ChefAPI import from_config_file [as 别名]
def get_api(self, mess):
"""Check to see if the user has selected a knife.rb
If there is only one, it will be selected automatically
:param mess: Errbot message object
"""
configs = self.get_config_files()
if len(configs) == 1:
# there is only one config, so auto-select it
self.set_config(mess, list(configs)[0])
if self.USER_CONF.get(mess.frm.person):
self.send(
mess.frm,
"/me Chef knife.rb: {}".format(self.USER_CONF[mess.frm.person]["knife_file"]),
message_type=mess.type,
)
else:
raise Exception(
'You have not selected a knife.rb. Run "chef '
'config list" to see a list of available '
'configs and then use "chef config set '
'<name>" to select one'
)
return ChefAPI.from_config_file(self.USER_CONF[mess.frm.person]["knife_file"])
示例2: load
# 需要导入模块: from chef.api import ChefAPI [as 别名]
# 或者: from chef.api.ChefAPI import from_config_file [as 别名]
def load(self, path):
path = os.path.join(os.path.dirname(__file__), 'configs', path)
return ChefAPI.from_config_file(path)