本文整理汇总了Python中fuelclient.objects.environment.Environment.update_attributes方法的典型用法代码示例。如果您正苦于以下问题:Python Environment.update_attributes方法的具体用法?Python Environment.update_attributes怎么用?Python Environment.update_attributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fuelclient.objects.environment.Environment
的用法示例。
在下文中一共展示了Environment.update_attributes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: attributes
# 需要导入模块: from fuelclient.objects.environment import Environment [as 别名]
# 或者: from fuelclient.objects.environment.Environment import update_attributes [as 别名]
def attributes(self, params):
"""Modify attributes of the environment:
fuel env --env 1 --attributes --download
fuel env --env 1 --attributes --upload
"""
cluster = Environment(params.env)
dir_path = self.full_path_directory(
params.dir, 'cluster_{0}'.format(params.env))
full_path = '{0}/attributes'.format(dir_path)
if params.download:
attributes = cluster.get_attributes()
self.serializer.write_to_path(full_path, attributes)
print("Attributes of cluster {0} "
"downloaded into {1}.yaml.".format(cluster.id, full_path))
elif params.upload:
attributes = self.serializer.read_from_file(full_path)
cluster.update_attributes(attributes)
print("Attributes of cluster {0} "
"uploaded from {1}.yaml".format(cluster.id, full_path))