def list(self, params): """Print all available roles fuel role --rel 1 """ roles = Role.get_all(params.release) acceptable_keys = ("name", ) self.serializer.print_to_output( roles, format_table(roles, acceptable_keys=acceptable_keys))
def list(self, params): """Print all available roles fuel role --rel 1 """ roles = Role.get_all(params.release) acceptable_keys = ("name", ) self.serializer.print_to_output( roles, format_table( roles, acceptable_keys=acceptable_keys ) )
import sys from fuelclient.objects.release import Release from fuelclient.objects.role import Role incompatible_roles = ["compute", "ironic", "cinder", "cinder-block-device"] restrictions = {u"condition": u"'network:neutron:core:nsx' in cluster:components", u"action": u"hide"} role_available_state = "available" nsx_component_name = u"network:neutron:core:nsx" clean = True if (len(sys.argv) > 1) else False try: for release in Release.get_all_data(): if release["state"] == role_available_state: for role in Role.get_all(release["id"]): if role["name"] in incompatible_roles: meta = role["meta"] if "restrictions" in meta.keys(): for restriction in meta["restrictions"]: if nsx_component_name in restriction["condition"]: if len(meta["restrictions"]) == 1 and clean: del meta["restrictions"] else: meta["restrictions"].remove(restriction) if not clean: meta["restrictions"].append(restrictions) else: if not clean: meta["restrictions"] = [restrictions] Role.update(release["id"], role["name"], role)
from fuelclient.objects.release import Release from fuelclient.objects.role import Role incompatible_roles = ["compute", "ironic", "cinder", "cinder-block-device"] restrictions = { u"condition": u"'network:neutron:core:nsx' in cluster:components", u"action": u"hide" } role_available_state = "available" nsx_component_name = u"network:neutron:core:nsx" clean = True if (len(sys.argv) > 1) else False try: for release in Release.get_all_data(): if release["state"] == role_available_state: for role in Role.get_all(release["id"]): if role["name"] in incompatible_roles: meta = role["meta"] if "restrictions" in meta.keys(): for restriction in meta["restrictions"]: if nsx_component_name in restriction["condition"]: if len(meta["restrictions"]) == 1 and clean: del meta["restrictions"] else: meta["restrictions"].remove(restriction) if not clean: meta["restrictions"].append(restrictions) else: if not clean: meta["restrictions"] = [restrictions] Role.update(release["id"], role["name"], role)