diff --git a/doc/build/html/_modules/index.html b/doc/build/html/_modules/index.html index 414deaf..681442d 100644 --- a/doc/build/html/_modules/index.html +++ b/doc/build/html/_modules/index.html @@ -6,7 +6,7 @@ - Overview: module code — kollacli 1.0.0.dev366 documentation + Overview: module code — kollacli 1.0.0.dev368 documentation @@ -14,7 +14,7 @@ - + @@ -106,7 +106,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • @@ -158,7 +158,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • Module code »
  • diff --git a/doc/build/html/_modules/kollacli/api/client.html b/doc/build/html/_modules/kollacli/api/client.html index 4d43742..fdfd876 100644 --- a/doc/build/html/_modules/kollacli/api/client.html +++ b/doc/build/html/_modules/kollacli/api/client.html @@ -6,7 +6,7 @@ - kollacli.api.client — kollacli 1.0.0.dev366 documentation + kollacli.api.client — kollacli 1.0.0.dev368 documentation @@ -14,7 +14,7 @@ - + @@ -36,7 +36,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • Module code »
  • @@ -116,7 +116,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • Module code »
  • diff --git a/doc/build/html/_modules/kollacli/api/deploy.html b/doc/build/html/_modules/kollacli/api/deploy.html index 409d961..d33cdb1 100644 --- a/doc/build/html/_modules/kollacli/api/deploy.html +++ b/doc/build/html/_modules/kollacli/api/deploy.html @@ -6,7 +6,7 @@ - kollacli.api.deploy — kollacli 1.0.0.dev366 documentation + kollacli.api.deploy — kollacli 1.0.0.dev368 documentation @@ -14,7 +14,7 @@ - + @@ -36,7 +36,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • Module code »
  • @@ -115,7 +115,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • Module code »
  • diff --git a/doc/build/html/_modules/kollacli/api/exceptions.html b/doc/build/html/_modules/kollacli/api/exceptions.html index 30a91f2..3ca6e81 100644 --- a/doc/build/html/_modules/kollacli/api/exceptions.html +++ b/doc/build/html/_modules/kollacli/api/exceptions.html @@ -6,7 +6,7 @@ - kollacli.api.exceptions — kollacli 1.0.0.dev366 documentation + kollacli.api.exceptions — kollacli 1.0.0.dev368 documentation @@ -14,7 +14,7 @@ - + @@ -36,7 +36,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • Module code »
  • @@ -102,7 +102,7 @@ for hostname in hostnames: failed_hosts = ''.join([failed_hosts, comma, hostname]) comma = ',' - message = (u._('host(s) ssh check failed: {hosts}') + message = (u._('Host(s) ssh check failed: {hosts}') .format(hosts=failed_hosts)) super(HostsSshCheckError, self).__init__(message, *args) @@ -124,7 +124,7 @@
    [docs]class MissingArgument(ClientException): """Missing argument""" def __init__(self, argname, *args): - message = (u._('argument is missing: {name}') + message = (u._('Argument is missing: {name}') .format(name=argname)) super(MissingArgument, self).__init__(message, *args)
    @@ -160,7 +160,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • Module code »
  • diff --git a/doc/build/html/_modules/kollacli/api/group.html b/doc/build/html/_modules/kollacli/api/group.html index ac1a2c8..08352fd 100644 --- a/doc/build/html/_modules/kollacli/api/group.html +++ b/doc/build/html/_modules/kollacli/api/group.html @@ -6,7 +6,7 @@ - kollacli.api.group — kollacli 1.0.0.dev366 documentation + kollacli.api.group — kollacli 1.0.0.dev368 documentation @@ -14,7 +14,7 @@ - + @@ -36,7 +36,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • Module code »
  • @@ -60,6 +60,9 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. +from copy import copy +import kollacli.i18n as u + from kollacli.api.exceptions import MissingArgument from kollacli.common.inventory import Inventory from kollacli.common.utils import safe_decode @@ -67,15 +70,117 @@
    [docs]class GroupApi(object): +
    [docs] class Group(object): + def __init__(self, groupname, servicenames, hostnames): + self.name = groupname + self._servicenames = servicenames + self._hostnames = hostnames + +
    [docs] def get_name(self): + """Get name + + :return: group name + :rtype: string + """ + return self.name +
    +
    [docs] def get_services(self): + """Get names of services associated with this group. + + :return: service names + :rtype: list of strings + """ + return copy(self._servicenames) +
    +
    [docs] def add_service(self, servicename): + """Add service to group + + :param servicename: name of the service to add to the group + :type servicename: string + + """ + servicename = safe_decode(servicename) + inventory = Inventory.load() + inventory.validate_servicenames([servicename]) + + group_services = inventory.get_group_services() + self._servicenames = group_services[self.name] + if servicename not in self._servicenames: + # service not associated with group, add it + inventory.add_group_to_service(self.name, servicename) + Inventory.save(inventory) +
    +
    [docs] def remove_service(self, servicename): + """Remove service from group + + :param servicename: name of the service to remove from the group + :type servicename: string + + """ + servicename = safe_decode(servicename) + inventory = Inventory.load() + inventory.validate_servicenames([servicename]) + + group_services = inventory.get_group_services() + self._servicenames = group_services[self.name] + if servicename in self._servicenames: + # service is associated with group, remove it + inventory.remove_group_from_service(self.name, servicename) + Inventory.save(inventory) +
    +
    [docs] def get_hosts(self): + """Get names of hosts associated with this group. + + :return: host names + :rtype: list of strings + """ + return copy(self._hostnames) +
    +
    [docs] def add_host(self, hostname): + """Add host to group + + :param hostname: name of the host to add to the group + :type hostname: string + + """ + hostname = safe_decode(hostname) + inventory = Inventory.load() + inventory.validate_hostnames([hostname]) + + group = inventory.get_group(self.name) + self._hostnames = group.get_hostnames() + if hostname not in self._hostnames: + # host not associated with group, add it + inventory.add_host(hostname, self.name) + Inventory.save(inventory) +
    +
    [docs] def remove_host(self, hostname): + """Remove host from group + + :param hostname: name of the host to remove from the group + :type hostname: string + + """ + hostname = safe_decode(hostname) + inventory = Inventory.load() + inventory.validate_hostnames([hostname]) + + group = inventory.get_group(self.name) + self._hostnames = group.get_hostnames() + if hostname in self._hostnames: + # host is associated with group, remove it + inventory.remove_host(hostname, self.name) + Inventory.save(inventory) +
    [docs] def group_add(self, groupname): - """add a group to the inventory + """Add a group to the inventory :param groupname: name of the group to add to the inventory - :param groupname: string + :type groupname: string """ if not groupname: - raise MissingArgument('group name') + raise MissingArgument(u._('Group name')) groupname = safe_decode(groupname) inventory = Inventory.load() @@ -83,19 +188,56 @@ Inventory.save(inventory)
    [docs] def group_remove(self, groupname): - """remove a group from the inventory + """Remove a group from the inventory :param groupname: name of the group to remove from the inventory - :param groupname: string + :type groupname: string """ if not groupname: - raise MissingArgument('group name') + raise MissingArgument(u._('Group name')) inventory = Inventory.load() groupname = safe_decode(groupname) inventory.remove_group(groupname) - Inventory.save(inventory)
    + Inventory.save(inventory) + +
    [docs] def group_get_all(self): + """Get all groups in the inventory + + :return: groups + :rtype: list of Group objects + """ + return self._get_groups(None, get_all=True) +
    +
    [docs] def group_get(self, groupnames): + """Get selected groups in the inventory + + :param groupnames: names of groups to be read + :type groupnames: list of strings + :return: groups + :rtype: list of Group objects + """ + if groupnames is None: + raise MissingArgument(u._('Group names')) + groupnames = safe_decode(groupnames) + return self._get_groups(groupnames) +
    + def _get_groups(self, groupnames, get_all=False): + groups = [] + inventory = Inventory.load() + if groupnames: + inventory.validate_groupnames(groupnames) + + group_services = inventory.get_group_services() + inv_groups = inventory.get_groups() + for inv_group in inv_groups: + if get_all or inv_group.name in groupnames: + group = self.Group(inv_group.name, + group_services[inv_group.name], + inv_group.get_hostnames()) + groups.append(group) + return groups @@ -129,7 +271,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • Module code »
  • diff --git a/doc/build/html/_modules/kollacli/api/host.html b/doc/build/html/_modules/kollacli/api/host.html index ca15a10..f824f28 100644 --- a/doc/build/html/_modules/kollacli/api/host.html +++ b/doc/build/html/_modules/kollacli/api/host.html @@ -6,7 +6,7 @@ - kollacli.api.host — kollacli 1.0.0.dev366 documentation + kollacli.api.host — kollacli 1.0.0.dev368 documentation @@ -14,7 +14,7 @@ - + @@ -36,7 +36,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • Module code »
  • @@ -60,6 +60,8 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. +import kollacli.i18n as u + from kollacli.api.exceptions import MissingArgument from kollacli.common.inventory import Inventory from kollacli.common.utils import safe_decode @@ -95,7 +97,7 @@ :param hostnames: list of strings """ if not hostnames: - raise MissingArgument('host names') + raise MissingArgument(u._('Host names')) hostnames = safe_decode(hostnames) inventory = Inventory.load() @@ -115,7 +117,7 @@ inventory = Inventory.load() if not hostnames: - raise MissingArgument('host name') + raise MissingArgument(u._('Host names')) hostnames = safe_decode(hostnames) any_changed = False @@ -146,7 +148,12 @@ :return: hosts :rtype: Host """ + if hostnames is None: + raise MissingArgument(u._('Host names')) + hostnames = safe_decode(hostnames) inventory = Inventory.load() + inventory.validate_hostnames(hostnames) + hosts = [] host_groups = inventory.get_host_groups() for hostname in hostnames: @@ -222,7 +229,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • Module code »
  • diff --git a/doc/build/html/_modules/kollacli/api/job.html b/doc/build/html/_modules/kollacli/api/job.html index 7a5c7dd..f90e089 100644 --- a/doc/build/html/_modules/kollacli/api/job.html +++ b/doc/build/html/_modules/kollacli/api/job.html @@ -6,7 +6,7 @@ - kollacli.api.job — kollacli 1.0.0.dev366 documentation + kollacli.api.job — kollacli 1.0.0.dev368 documentation @@ -14,7 +14,7 @@ - + @@ -36,7 +36,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • Module code »
  • @@ -131,7 +131,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • Module code »
  • diff --git a/doc/build/html/_modules/kollacli/commands/deploy.html b/doc/build/html/_modules/kollacli/commands/deploy.html index badfcf9..3a54b1d 100644 --- a/doc/build/html/_modules/kollacli/commands/deploy.html +++ b/doc/build/html/_modules/kollacli/commands/deploy.html @@ -6,7 +6,7 @@ - kollacli.commands.deploy — kollacli 1.0.0.dev366 documentation + kollacli.commands.deploy — kollacli 1.0.0.dev368 documentation @@ -14,7 +14,7 @@ - + @@ -36,7 +36,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • Module code »
  • @@ -189,7 +189,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • Module code »
  • diff --git a/doc/build/html/_modules/kollacli/commands/exceptions.html b/doc/build/html/_modules/kollacli/commands/exceptions.html index ffa620e..096085b 100644 --- a/doc/build/html/_modules/kollacli/commands/exceptions.html +++ b/doc/build/html/_modules/kollacli/commands/exceptions.html @@ -6,7 +6,7 @@ - kollacli.commands.exceptions — kollacli 1.0.0.dev366 documentation + kollacli.commands.exceptions — kollacli 1.0.0.dev368 documentation @@ -14,7 +14,7 @@ - + @@ -36,7 +36,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • Module code »
  • @@ -104,7 +104,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • Module code »
  • diff --git a/doc/build/html/_modules/kollacli/commands/group.html b/doc/build/html/_modules/kollacli/commands/group.html index a8654ca..b117f35 100644 --- a/doc/build/html/_modules/kollacli/commands/group.html +++ b/doc/build/html/_modules/kollacli/commands/group.html @@ -6,7 +6,7 @@ - kollacli.commands.group — kollacli 1.0.0.dev366 documentation + kollacli.commands.group — kollacli 1.0.0.dev368 documentation @@ -14,7 +14,7 @@ - + @@ -36,7 +36,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • Module code »
  • @@ -67,8 +67,6 @@ from kollacli.api.client import ClientApi from kollacli.api.exceptions import ClientException from kollacli.commands.exceptions import CommandError -from kollacli.common.inventory import Inventory -from kollacli.common.utils import convert_to_unicode from cliff.command import Command from cliff.lister import Lister @@ -128,14 +126,13 @@
    [docs] def take_action(self, parsed_args): try: groupname = parsed_args.groupname.strip() - groupname = convert_to_unicode(groupname) hostname = parsed_args.hostname.strip() - hostname = convert_to_unicode(hostname) - inventory = Inventory.load() - inventory.add_host(hostname, groupname) - Inventory.save(inventory) - except CommandError as e: - raise e + + group = CLIENT.group_get([groupname])[0] + group.add_host(hostname) + + except ClientException as e: + raise CommandError(str(e)) except Exception as e: raise Exception(traceback.format_exc()) @@ -154,15 +151,13 @@
    [docs] def take_action(self, parsed_args): try: groupname = parsed_args.groupname.strip() - groupname = convert_to_unicode(groupname) hostname = parsed_args.hostname.strip() - hostname = convert_to_unicode(hostname) - inventory = Inventory.load() - inventory.remove_host(hostname, groupname) - Inventory.save(inventory) - except CommandError as e: - raise e + group = CLIENT.group_get([groupname])[0] + group.remove_host(hostname) + + except ClientException as e: + raise CommandError(str(e)) except Exception as e: raise Exception(traceback.format_exc()) @@ -172,18 +167,16 @@
    [docs] def take_action(self, parsed_args): try: - inventory = Inventory.load() - - data = [] - group_hosts = inventory.get_group_hosts() - if group_hosts: - for (groupname, hostnames) in group_hosts.items(): - data.append((groupname, hostnames)) - else: - data.append(('', '')) + data = [('', '')] + groups = CLIENT.group_get_all() + if groups: + data = [] + for group in groups: + data.append((group.get_name(), + sorted(group.get_hosts()))) return ((u._('Group'), u._('Hosts')), sorted(data)) - except CommandError as e: - raise e + except ClientException as e: + raise CommandError(str(e)) except Exception as e: raise Exception(traceback.format_exc()) @@ -201,15 +194,13 @@
    [docs] def take_action(self, parsed_args): try: groupname = parsed_args.groupname.strip() - groupname = convert_to_unicode(groupname) servicename = parsed_args.servicename.strip() - servicename = convert_to_unicode(servicename) - inventory = Inventory.load() - inventory.add_group_to_service(groupname, servicename) - Inventory.save(inventory) - except CommandError as e: - raise e + group = CLIENT.group_get([groupname])[0] + group.add_service(servicename) + + except ClientException as e: + raise CommandError(str(e)) except Exception as e: raise Exception(traceback.format_exc()) @@ -228,15 +219,13 @@
    [docs] def take_action(self, parsed_args): try: groupname = parsed_args.groupname.strip() - groupname = convert_to_unicode(groupname) servicename = parsed_args.servicename.strip() - servicename = convert_to_unicode(servicename) - inventory = Inventory.load() - inventory.remove_group_from_service(groupname, servicename) - Inventory.save(inventory) - except CommandError as e: - raise e + group = CLIENT.group_get([groupname])[0] + group.remove_service(servicename) + + except ClientException as e: + raise CommandError(str(e)) except Exception as e: raise Exception(traceback.format_exc()) @@ -246,18 +235,16 @@
    [docs] def take_action(self, parsed_args): try: - inventory = Inventory.load() - - data = [] - group_services = inventory.get_group_services() - if group_services: - for (groupname, servicenames) in group_services.items(): - data.append((groupname, sorted(servicenames))) - else: - data.append(('', '')) + data = [('', '')] + groups = CLIENT.group_get_all() + if groups: + data = [] + for group in groups: + data.append((group.get_name(), + sorted(group.get_services()))) return ((u._('Group'), u._('Services')), sorted(data)) - except CommandError as e: - raise e + except ClientException as e: + raise CommandError(str(e)) except Exception as e: raise Exception(traceback.format_exc())
    @@ -293,7 +280,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • Module code »
  • diff --git a/doc/build/html/_modules/kollacli/commands/host.html b/doc/build/html/_modules/kollacli/commands/host.html index 5cda0ed..62ab346 100644 --- a/doc/build/html/_modules/kollacli/commands/host.html +++ b/doc/build/html/_modules/kollacli/commands/host.html @@ -6,7 +6,7 @@ - kollacli.commands.host — kollacli 1.0.0.dev366 documentation + kollacli.commands.host — kollacli 1.0.0.dev368 documentation @@ -14,7 +14,7 @@ - + @@ -36,7 +36,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • Module code »
  • @@ -368,7 +368,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • Module code »
  • diff --git a/doc/build/html/_modules/kollacli/commands/password.html b/doc/build/html/_modules/kollacli/commands/password.html index 40a6e73..ff070d8 100644 --- a/doc/build/html/_modules/kollacli/commands/password.html +++ b/doc/build/html/_modules/kollacli/commands/password.html @@ -6,7 +6,7 @@ - kollacli.commands.password — kollacli 1.0.0.dev366 documentation + kollacli.commands.password — kollacli 1.0.0.dev368 documentation @@ -14,7 +14,7 @@ - + @@ -36,7 +36,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • Module code »
  • @@ -168,7 +168,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • Module code »
  • diff --git a/doc/build/html/_modules/kollacli/commands/property.html b/doc/build/html/_modules/kollacli/commands/property.html index be52852..0f66b69 100644 --- a/doc/build/html/_modules/kollacli/commands/property.html +++ b/doc/build/html/_modules/kollacli/commands/property.html @@ -6,7 +6,7 @@ - kollacli.commands.property — kollacli 1.0.0.dev366 documentation + kollacli.commands.property — kollacli 1.0.0.dev368 documentation @@ -14,7 +14,7 @@ - + @@ -36,7 +36,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • Module code »
  • @@ -379,7 +379,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • Module code »
  • diff --git a/doc/build/html/_modules/kollacli/commands/service.html b/doc/build/html/_modules/kollacli/commands/service.html index fead2a5..ee6dfce 100644 --- a/doc/build/html/_modules/kollacli/commands/service.html +++ b/doc/build/html/_modules/kollacli/commands/service.html @@ -6,7 +6,7 @@ - kollacli.commands.service — kollacli 1.0.0.dev366 documentation + kollacli.commands.service — kollacli 1.0.0.dev368 documentation @@ -14,7 +14,7 @@ - + @@ -36,7 +36,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • Module code »
  • @@ -67,8 +67,6 @@ from kollacli.api.client import ClientApi from kollacli.api.exceptions import ClientException from kollacli.commands.exceptions import CommandError -from kollacli.common.inventory import Inventory -from kollacli.common.utils import convert_to_unicode from cliff.command import Command from cliff.lister import Lister @@ -94,17 +92,13 @@
    [docs] def take_action(self, parsed_args): try: groupname = parsed_args.groupname.strip() - groupname = convert_to_unicode(groupname) servicename = parsed_args.servicename.strip() - servicename = convert_to_unicode(servicename) - inventory = Inventory.load() + group = CLIENT.group_get([groupname])[0] + group.add_service(servicename) - inventory.add_group_to_service(groupname, servicename) - - Inventory.save(inventory) - except CommandError as e: - raise e + except ClientException as e: + raise CommandError(str(e)) except Exception as e: raise Exception(traceback.format_exc()) @@ -123,17 +117,13 @@
    [docs] def take_action(self, parsed_args): try: groupname = parsed_args.groupname.strip() - groupname = convert_to_unicode(groupname) servicename = parsed_args.servicename.strip() - servicename = convert_to_unicode(servicename) - inventory = Inventory.load() + group = CLIENT.group_get([groupname])[0] + group.remove_service(servicename) - inventory.remove_group_from_service(groupname, servicename) - - Inventory.save(inventory) - except CommandError as e: - raise e + except ClientException as e: + raise CommandError(str(e)) except Exception as e: raise Exception(traceback.format_exc()) @@ -219,7 +209,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • Module code »
  • diff --git a/doc/build/html/_modules/kollacli/commands/support.html b/doc/build/html/_modules/kollacli/commands/support.html index 95793d3..ad7dbe6 100644 --- a/doc/build/html/_modules/kollacli/commands/support.html +++ b/doc/build/html/_modules/kollacli/commands/support.html @@ -6,7 +6,7 @@ - kollacli.commands.support — kollacli 1.0.0.dev366 documentation + kollacli.commands.support — kollacli 1.0.0.dev368 documentation @@ -14,7 +14,7 @@ - + @@ -36,7 +36,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • Module code »
  • @@ -107,7 +107,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • Module code »
  • diff --git a/doc/build/html/_modules/kollacli/commands/upgrade.html b/doc/build/html/_modules/kollacli/commands/upgrade.html index de055b6..5623ba4 100644 --- a/doc/build/html/_modules/kollacli/commands/upgrade.html +++ b/doc/build/html/_modules/kollacli/commands/upgrade.html @@ -6,7 +6,7 @@ - kollacli.commands.upgrade — kollacli 1.0.0.dev366 documentation + kollacli.commands.upgrade — kollacli 1.0.0.dev368 documentation @@ -14,7 +14,7 @@ - + @@ -36,7 +36,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • Module code »
  • @@ -132,7 +132,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • Module code »
  • diff --git a/doc/build/html/_modules/kollacli/common/ansible/actions.html b/doc/build/html/_modules/kollacli/common/ansible/actions.html index a771710..9682cee 100644 --- a/doc/build/html/_modules/kollacli/common/ansible/actions.html +++ b/doc/build/html/_modules/kollacli/common/ansible/actions.html @@ -6,7 +6,7 @@ - kollacli.common.ansible.actions — kollacli 1.0.0.dev366 documentation + kollacli.common.ansible.actions — kollacli 1.0.0.dev368 documentation @@ -14,7 +14,7 @@ - + @@ -36,7 +36,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • Module code »
  • @@ -263,7 +263,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • Module code »
  • diff --git a/doc/build/html/_modules/kollacli/common/ansible/job.html b/doc/build/html/_modules/kollacli/common/ansible/job.html index 96d13c8..3da128e 100644 --- a/doc/build/html/_modules/kollacli/common/ansible/job.html +++ b/doc/build/html/_modules/kollacli/common/ansible/job.html @@ -6,7 +6,7 @@ - kollacli.common.ansible.job — kollacli 1.0.0.dev366 documentation + kollacli.common.ansible.job — kollacli 1.0.0.dev368 documentation @@ -14,7 +14,7 @@ - + @@ -36,7 +36,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • Module code »
  • @@ -60,7 +60,6 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. - import fcntl import json import logging @@ -69,6 +68,8 @@ import tempfile import time +import kollacli.i18n as u + from kollacli.common.inventory import remove_temp_inventory from kollacli.common.utils import get_admin_uids from kollacli.common.utils import safe_decode @@ -225,7 +226,8 @@ elif action == ACTION_TASK_START: return self._format_task_start(packet) else: - raise Exception('Invalid action [%s] from callback' % action) + raise Exception(u._('Invalid action [{action}] from callback') + .format(action=action)) def _format_include_file(self, packet): return 'included: %s' % packet['filename'] @@ -360,7 +362,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • Module code »
  • diff --git a/doc/build/html/_modules/kollacli/common/ansible/playbook.html b/doc/build/html/_modules/kollacli/common/ansible/playbook.html index 6291163..5f24370 100644 --- a/doc/build/html/_modules/kollacli/common/ansible/playbook.html +++ b/doc/build/html/_modules/kollacli/common/ansible/playbook.html @@ -6,7 +6,7 @@ - kollacli.common.ansible.playbook — kollacli 1.0.0.dev366 documentation + kollacli.common.ansible.playbook — kollacli 1.0.0.dev368 documentation @@ -14,7 +14,7 @@ - + @@ -36,7 +36,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • Module code »
  • @@ -230,7 +230,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • Module code »
  • diff --git a/doc/build/html/_modules/kollacli/common/inventory.html b/doc/build/html/_modules/kollacli/common/inventory.html index 598bbea..f004502 100644 --- a/doc/build/html/_modules/kollacli/common/inventory.html +++ b/doc/build/html/_modules/kollacli/common/inventory.html @@ -6,7 +6,7 @@ - kollacli.common.inventory — kollacli 1.0.0.dev366 documentation + kollacli.common.inventory — kollacli 1.0.0.dev368 documentation @@ -14,7 +14,7 @@ - + @@ -36,7 +36,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • Module code »
  • @@ -934,13 +934,34 @@
    [docs] def validate_hostnames(self, hostnames): if not hostnames: - raise MissingArgument(u._('host name(s)')) + raise MissingArgument(u._('Host name(s)')) invalid_hosts = [] for hostname in hostnames: if hostname not in self._hosts: invalid_hosts.append(hostname) if invalid_hosts: - raise NotInInventory(u._('Host'), invalid_hosts)
    + raise NotInInventory(u._('Host'), invalid_hosts) + +
    [docs] def validate_groupnames(self, groupnames): + if not groupnames: + raise MissingArgument(u._('Group name(s)')) + invalid_groups = [] + for groupname in groupnames: + if groupname not in self._groups: + invalid_groups.append(groupname) + if invalid_groups: + raise NotInInventory(u._('Group'), invalid_groups) +
    +
    [docs] def validate_servicenames(self, servicenames): + if not servicenames: + raise MissingArgument(u._('Service name(s)')) + invalid_services = [] + for servicename in servicenames: + if (servicename not in self._services and + servicename not in self._sub_services): + invalid_services.append(servicename) + if invalid_services: + raise NotInInventory(u._('Service'), invalid_services)
    @@ -974,7 +995,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • Module code »
  • diff --git a/doc/build/html/_modules/kollacli/common/passwords.html b/doc/build/html/_modules/kollacli/common/passwords.html index b44ab4e..8d53c1f 100644 --- a/doc/build/html/_modules/kollacli/common/passwords.html +++ b/doc/build/html/_modules/kollacli/common/passwords.html @@ -6,7 +6,7 @@ - kollacli.common.passwords — kollacli 1.0.0.dev366 documentation + kollacli.common.passwords — kollacli 1.0.0.dev368 documentation @@ -14,7 +14,7 @@ - + @@ -36,7 +36,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • Module code »
  • @@ -152,7 +152,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • Module code »
  • diff --git a/doc/build/html/_modules/kollacli/common/properties.html b/doc/build/html/_modules/kollacli/common/properties.html index 22c75e9..97d58c4 100644 --- a/doc/build/html/_modules/kollacli/common/properties.html +++ b/doc/build/html/_modules/kollacli/common/properties.html @@ -6,7 +6,7 @@ - kollacli.common.properties — kollacli 1.0.0.dev366 documentation + kollacli.common.properties — kollacli 1.0.0.dev368 documentation @@ -14,7 +14,7 @@ - + @@ -36,7 +36,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • Module code »
  • @@ -439,7 +439,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • Module code »
  • diff --git a/doc/build/html/_modules/kollacli/common/sshutils.html b/doc/build/html/_modules/kollacli/common/sshutils.html index 9f2dde5..db977de 100644 --- a/doc/build/html/_modules/kollacli/common/sshutils.html +++ b/doc/build/html/_modules/kollacli/common/sshutils.html @@ -6,7 +6,7 @@ - kollacli.common.sshutils — kollacli 1.0.0.dev366 documentation + kollacli.common.sshutils — kollacli 1.0.0.dev368 documentation @@ -14,7 +14,7 @@ - + @@ -36,7 +36,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • Module code »
  • @@ -176,7 +176,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • Module code »
  • diff --git a/doc/build/html/_modules/kollacli/common/support.html b/doc/build/html/_modules/kollacli/common/support.html index d0bb73f..6625a58 100644 --- a/doc/build/html/_modules/kollacli/common/support.html +++ b/doc/build/html/_modules/kollacli/common/support.html @@ -6,7 +6,7 @@ - kollacli.common.support — kollacli 1.0.0.dev366 documentation + kollacli.common.support — kollacli 1.0.0.dev368 documentation @@ -14,7 +14,7 @@ - + @@ -36,7 +36,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • Module code »
  • @@ -205,7 +205,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • Module code »
  • diff --git a/doc/build/html/_modules/kollacli/common/utils.html b/doc/build/html/_modules/kollacli/common/utils.html index 9509dd2..294303e 100644 --- a/doc/build/html/_modules/kollacli/common/utils.html +++ b/doc/build/html/_modules/kollacli/common/utils.html @@ -6,7 +6,7 @@ - kollacli.common.utils — kollacli 1.0.0.dev366 documentation + kollacli.common.utils — kollacli 1.0.0.dev368 documentation @@ -14,7 +14,7 @@ - + @@ -36,7 +36,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • Module code »
  • @@ -384,7 +384,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • Module code »
  • diff --git a/doc/build/html/_modules/kollacli/shell.html b/doc/build/html/_modules/kollacli/shell.html index 84b9503..f11f800 100644 --- a/doc/build/html/_modules/kollacli/shell.html +++ b/doc/build/html/_modules/kollacli/shell.html @@ -6,7 +6,7 @@ - kollacli.shell — kollacli 1.0.0.dev366 documentation + kollacli.shell — kollacli 1.0.0.dev368 documentation @@ -14,7 +14,7 @@ - + @@ -36,7 +36,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • Module code »
  • @@ -172,7 +172,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • Module code »
  • diff --git a/doc/build/html/genindex.html b/doc/build/html/genindex.html index ae491f7..61a6f8e 100644 --- a/doc/build/html/genindex.html +++ b/doc/build/html/genindex.html @@ -7,7 +7,7 @@ - Index — kollacli 1.0.0.dev366 documentation + Index — kollacli 1.0.0.dev368 documentation @@ -15,7 +15,7 @@ - + @@ -95,11 +95,15 @@ -
    add_host() (kollacli.common.inventory.HostGroup method) +
    add_host() (kollacli.api.group.GroupApi.Group method)
    +
    (kollacli.common.inventory.HostGroup method) +
    + +
    (kollacli.common.inventory.Inventory method)
    @@ -109,6 +113,10 @@ +
    add_service() (kollacli.api.group.GroupApi.Group method) +
    + +
    add_sub_servicename() (kollacli.common.inventory.Service method)
    @@ -116,12 +124,12 @@
    AnsibleJob (class in kollacli.common.ansible.job)
    +
    +
    AnsiblePlaybook (class in kollacli.common.ansible.playbook)
    -
    -
    AnsibleProperties (class in kollacli.common.properties)
    @@ -449,9 +457,15 @@
    -
    get_hosts() (kollacli.common.inventory.Inventory method) +
    get_hosts() (kollacli.api.group.GroupApi.Group method)
    +
    + +
    (kollacli.common.inventory.Inventory method) +
    + +
    get_kolla_etc() (in module kollacli.common.utils)
    @@ -472,22 +486,26 @@
    get_kollacli_etc() (in module kollacli.common.utils)
    - -
    get_kollacli_home() (in module kollacli.common.utils)
    -
    get_name() (kollacli.api.host.HostApi.Host method) +
    get_name() (kollacli.api.group.GroupApi.Group method)
    +
    (kollacli.api.host.HostApi.Host method) +
    + +
    (kollacli.api.service.ServiceApi.Service method)
    +
    +
    get_parent_servicename() (kollacli.common.inventory.SubService method)
    @@ -607,9 +625,15 @@ -
    get_services() (kollacli.common.inventory.Inventory method) +
    get_services() (kollacli.api.group.GroupApi.Group method)
    +
    + +
    (kollacli.common.inventory.Inventory method) +
    + +
    get_setup_user() (in module kollacli.common.utils)
    @@ -659,6 +683,14 @@ +
    group_get() (kollacli.api.group.GroupApi method) +
    + + +
    group_get_all() (kollacli.api.group.GroupApi method) +
    + +
    group_remove() (kollacli.api.group.GroupApi method)
    @@ -679,6 +711,10 @@ +
    GroupApi.Group (class in kollacli.api.group) +
    + +
    GroupListhosts (class in kollacli.commands.group)
    @@ -1111,11 +1147,15 @@
    -
    remove_host() (kollacli.common.inventory.HostGroup method) +
    remove_host() (kollacli.api.group.GroupApi.Group method)
    +
    (kollacli.common.inventory.HostGroup method) +
    + +
    (kollacli.common.inventory.Inventory method)
    @@ -1127,6 +1167,10 @@ +
    remove_service() (kollacli.api.group.GroupApi.Group method) +
    + +
    remove_temp_inventory() (in module kollacli.common.inventory)
    @@ -1451,12 +1495,20 @@
    +
    validate_groupnames() (kollacli.common.inventory.Inventory method) +
    + +
    validate_hostnames() (kollacli.common.inventory.Inventory method)
    +
    validate_servicenames() (kollacli.common.inventory.Inventory method) +
    + +
    verbose_level (kollacli.common.ansible.playbook.AnsiblePlaybook attribute)
    @@ -1515,7 +1567,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • +
    +
    +validate_groupnames(groupnames)[source]
    +
    +
    validate_hostnames(hostnames)[source]
    +
    +
    +validate_servicenames(servicenames)[source]
    +
    +
    @@ -856,7 +866,7 @@ unicode.

  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • @@ -263,7 +263,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »
  • @@ -94,7 +94,7 @@
  • modules |
  • -
  • kollacli 1.0.0.dev366 documentation »
  • +
  • kollacli 1.0.0.dev368 documentation »