예제 #1
0
 def update(self, params):
     """Update a role from file description
         fuel role --rel 1 --update --file some.yaml
     """
     role = self.file_serializer.read_from_file(params.file)
     role = Role.update(params.release, role['name'], role)
     self.file_serializer.print_to_output(
         role, "Role successfully updated from {0}.".format(params.file))
예제 #2
0
 def update(self, params):
     """Update a role from file description
         fuel role --rel 1 --update --file some.yaml
     """
     role = self.file_serializer.read_from_file(params.file)
     role = Role.update(params.release, role['name'], role)
     self.file_serializer.print_to_output(
         role,
         "Role successfully updated from {0}.".format(params.file))
예제 #3
0
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)
except Exception:
    raise
예제 #4
0
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)
except Exception:
    raise