Exemplo n.º 1
0
    def list(self, params):
        """Print all available releases:
                fuel release --list

           Print release with specific id=1:
                fuel release --rel 1
        """
        acceptable_keys = (
            "id",
            "name",
            "state",
            "operating_system",
            "version"
        )
        if params.release:
            release = Release(params.release)
            data = [release.get_fresh_data()]
        else:
            data = Release.get_all_data()
        self.serializer.print_to_output(
            data,
            format_table(
                data,
                acceptable_keys=acceptable_keys
            )
        )
Exemplo n.º 2
0
    def list(self, params):
        """Print all available releases:
                fuel release --list

           Print release with specific id=1:
                fuel release --rel 1
        """
        acceptable_keys = ("id", "name", "state", "operating_system",
                           "version")
        if params.release:
            release = Release(params.release)
            data = [release.get_fresh_data()]
        else:
            data = Release.get_all_data()
        self.serializer.print_to_output(
            data, format_table(data, acceptable_keys=acceptable_keys))
Exemplo n.º 3
0
    def sync_deployment_tasks(self, params):
        """Upload tasks for different releases based on directories.
        The string identifier for the release(s) to update is expected to be
        found in the path (see `fuel release`), like:

            /etc/puppet/<release>/
            /etc/puppet/liberty-9.0

        fuel rel --sync-deployment-tasks --dir /etc/puppet/liberty-9.0/
        fuel rel --sync-deployment-tasks --fp '*tasks.yaml'

        In case no directory was provided:

        fuel rel --sync-deployment-tasks

        The current directory will be used
        """
        all_rels = Release.get_all_data()
        real_path = os.path.realpath(params.dir)
        serialized_tasks = defaultdict(list)
        versions = set([r['version'] for r in all_rels])

        for file_name in utils.iterfiles(real_path, params.filepattern):
            for version in versions:
                if version in file_name:
                    serialized_tasks[version].extend(
                        self.serializer.read_from_full_path(file_name))

        for rel in all_rels:
            release = Release(rel['id'])
            data = serialized_tasks.get(rel['version'])
            if data:
                release.update_deployment_tasks(data)
                print("Deployment tasks synchronized for release"
                      " {0} of version {1}".format(rel['name'],
                                                   rel['version']))
            else:
                print("No tasks were synchronized for release {0} "
                      "of version {1}.(Hint: nothing matched "
                      "{2}/{1}/{3})".format(rel['name'],
                                            rel['version'],
                                            real_path,
                                            params.filepattern))
Exemplo n.º 4
0
    def sync_deployment_tasks(self, params):
        """Upload tasks for different releases based on directories.
        The string identifier for the release(s) to update is expected to be
        found in the path (see `fuel release`), like:

            /etc/puppet/<release>/
            /etc/puppet/liberty-9.0

        fuel rel --sync-deployment-tasks --dir /etc/puppet/liberty-9.0/
        fuel rel --sync-deployment-tasks --fp '*tasks.yaml'

        In case no directory was provided:

        fuel rel --sync-deployment-tasks

        The current directory will be used
        """
        all_rels = Release.get_all_data()
        real_path = os.path.realpath(params.dir)
        serialized_tasks = defaultdict(list)
        versions = set([r['version'] for r in all_rels])

        for file_name in utils.iterfiles(real_path, params.filepattern):
            for version in versions:
                if version in file_name:
                    serialized_tasks[version].extend(
                        self.serializer.read_from_full_path(file_name))

        for rel in all_rels:
            release = Release(rel['id'])
            data = serialized_tasks.get(rel['version'])
            if data:
                release.update_deployment_tasks(data)
                print("Deployment tasks synchronized for release"
                      " {0} of version {1}".format(rel['name'],
                                                   rel['version']))
            else:
                print("No tasks were synchronized for release {0} "
                      "of version {1}.(Hint: nothing matched "
                      "{2}/{1}/{3})".format(rel['name'], rel['version'],
                                            real_path, params.filepattern))
Exemplo n.º 5
0
    def sync_deployment_tasks(self, params):
        """Upload tasks for different releases based on directories.
        Unique identifier of the release should in the path, like:

            /etc/puppet/2014.2-6.0/

        fuel rel --sync-deployment-tasks --dir /etc/puppet/2014.2-6.0/
        fuel rel --sync-deployment-tasks --fp '*tasks.yaml'

        In case no directory will be provided:

        fuel rel --sync-deployment-tasks

        Current directory will be used
        """
        all_rels = Release.get_all_data()
        real_path = os.path.realpath(params.dir)
        serialized_tasks = defaultdict(list)
        versions = set([r['version'] for r in all_rels])

        for file_name in utils.iterfiles(real_path, params.filepattern):
            for version in versions:
                if version in file_name:
                    serialized_tasks[version].extend(
                        self.serializer.read_from_full_path(file_name))

        for rel in all_rels:
            release = Release(rel['id'])
            data = serialized_tasks.get(rel['version'])
            if data:
                release.update_deployment_tasks(data)
                print("Deployment tasks syncronized for release"
                      " {0} of version {1}".format(rel['name'],
                                                   rel['version']))
            else:
                print("No tasks found for release {0} "
                      "of version {1}".format(rel['name'], rel['version']))
Exemplo n.º 6
0
    def sync_deployment_tasks(self, params):
        """Upload tasks for different releases based on directories.
        Unique identifier of the release should in the path, like:

            /etc/puppet/2014.2-6.0/

        fuel rel --sync-deployment-tasks --dir /etc/puppet/2014.2-6.0/
        fuel rel --sync-deployment-tasks --fp '*tasks.yaml'

        In case no directory will be provided:

        fuel rel --sync-deployment-tasks

        Current directory will be used
        """
        all_rels = Release.get_all_data()
        real_path = os.path.realpath(params.dir)
        serialized_tasks = defaultdict(list)
        versions = set([r['version'] for r in all_rels])

        for file_name in utils.iterfiles(real_path, params.filepattern):
            for version in versions:
                if version in file_name:
                    serialized_tasks[version].extend(
                        self.serializer.read_from_full_path(file_name))

        for rel in all_rels:
            release = Release(rel['id'])
            data = serialized_tasks.get(rel['version'])
            if data:
                release.update_deployment_tasks(data)
                print("Deployment tasks synchronized for release"
                      " {0} of version {1}".format(rel['name'],
                                                   rel['version']))
            else:
                print("No tasks found for release {0} "
                      "of version {1}".format(rel['name'], rel['version']))
Exemplo n.º 7
0
delete all restrictions, which NSXv component checks.
"""

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:
Exemplo n.º 8
0
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: