本文整理汇总了Python中cm.services.ServiceRole.to_string_array方法的典型用法代码示例。如果您正苦于以下问题:Python ServiceRole.to_string_array方法的具体用法?Python ServiceRole.to_string_array怎么用?Python ServiceRole.to_string_array使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cm.services.ServiceRole
的用法示例。
在下文中一共展示了ServiceRole.to_string_array方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _update_user_data
# 需要导入模块: from cm.services import ServiceRole [as 别名]
# 或者: from cm.services.ServiceRole import to_string_array [as 别名]
def _update_user_data(self):
if 'filesystems' in self.app.ud:
old_fs_list = self.app.ud.get('filesystems') or []
new_fs_list = []
# clear 'services' and replace with the new format
for fs in old_fs_list:
svc_roles = ServiceRole.from_string_array(fs['roles'])
if ServiceRole.GALAXY_TOOLS in svc_roles and ServiceRole.GALAXY_DATA in svc_roles:
# This condition should only occur in new configs, but check
# added so that things work properly even if run against a new config
# Only works for default configs though...
new_fs_list.append(fs)
elif ServiceRole.GALAXY_TOOLS in svc_roles:
pass # skip adding the galaxy tools file system, no longer needed.
else:
if ServiceRole.GALAXY_DATA in ServiceRole.from_string_array(fs['roles']):
fs['roles'] = ServiceRole.to_string_array([ServiceRole.GALAXY_TOOLS,
ServiceRole.GALAXY_DATA])
new_fs_list.append(fs)
else:
new_fs_list.append(fs)
self.app.ud['filesystems'] = new_fs_list
self.app.ud['deployment_version'] = 2
self.app.ud.pop('galaxy_home', None) # TODO: Galaxy home is always reset
# to default. Discuss implications
return True