Drop kolla-tags and kolla-limit
Removes the deprecated options ``--kolla-tags`` and ``--kolla-limit`` from all commands. Change-Id: Iefef0eb4e65f98c9380ab9cb16eb2ccac17fe470 Signed-off-by: Matt Crees <mattc@stackhpc.com>
This commit is contained in:
1 parent
919ccfbc7c
commit
0a13f0edf1
5 files changed
+10
-87
No files matched your search
@@ -51,17 +51,12 @@ class MyNewKollaCommand(KollaAnsibleMixin, KayobeAnsibleMixin, VaultMixin, Comma
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.app.LOG.debug("Running my new kolla command")
|
||||
self.handle_kolla_tags_limits_deprecation(parsed_args)
|
||||
playbooks = _build_playbook_list("my-new-playbook")
|
||||
self.run_kayobe_playbooks(parsed_args, playbooks)
|
||||
# Run kolla-ansible steps as needed, e.g.:
|
||||
# self.run_kolla_ansible_overcloud(parsed_args, "deploy")
|
||||
```
|
||||
|
||||
`handle_kolla_tags_limits_deprecation(parsed_args)` **must** be called first in
|
||||
every `KollaAnsibleMixin` command. It enforces warnings and mutual-exclusion
|
||||
checks for `--kolla-limit`, `--kolla-tags`, and `--kolla-skip-tags`.
|
||||
|
||||
Key helpers:
|
||||
- `_build_playbook_list("name1", "name2")` builds absolute paths to `ansible/<name>.yml`
|
||||
- `_get_playbook_path("name")` returns a single playbook path
|
||||
|
||||
@@ -459,4 +459,3 @@ scope of the upgrade::
|
||||
|
||||
Using tags is not tested in either Kayobe or Kolla-Ansible CI, and as such
|
||||
should only be used if you know what you're doing. Proceed with caution.
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
|
||||
import glob
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
@@ -31,8 +30,6 @@ from kayobe import vault
|
||||
# This is set to an arbitrary large number to simplify the sorting logic
|
||||
DEFAULT_SEQUENCE_NUMBER = sys.maxsize
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def _build_playbook_list(*playbooks):
|
||||
"""Return a list of names of playbook files given their basenames."""
|
||||
@@ -118,31 +115,6 @@ class KayobeAnsibleMixin(object):
|
||||
self.run_kayobe_playbooks(parsed_args, playbooks,
|
||||
ignore_limit=True, check=False)
|
||||
|
||||
def handle_kolla_tags_limits_deprecation(self, parsed_args):
|
||||
if (parsed_args.kolla_limit or parsed_args.kolla_tags or
|
||||
parsed_args.kolla_skip_tags):
|
||||
self.app.LOG.warning("The use of --kolla-tags, --kolla-limit, and "
|
||||
"--kolla-skip-tags is deprecated. Please "
|
||||
"switch to just using --tags, --limit, or "
|
||||
"--skip-tags, these are now passed into "
|
||||
"kolla-ansible too. Kolla tags/limit will be "
|
||||
"removed in the next release.")
|
||||
if parsed_args.limit and parsed_args.kolla_limit:
|
||||
self.app.LOG.error("You can no longer use both --limit and "
|
||||
"--kolla-limit at the same time. Please switch "
|
||||
"to just using --limit")
|
||||
sys.exit(1)
|
||||
if parsed_args.tags and parsed_args.kolla_tags:
|
||||
self.app.LOG.error("You can no longer use both --tags and "
|
||||
"--kolla-tags at the same time. Please switch "
|
||||
"to just using --tags")
|
||||
sys.exit(1)
|
||||
if parsed_args.skip_tags and parsed_args.kolla_skip_tags:
|
||||
self.app.LOG.error("You can no longer use both --skip-tags and "
|
||||
"--kolla-skip-tags at the same time. Please "
|
||||
"switch to just using --skip-tags")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
class KollaAnsibleMixin(object):
|
||||
"""Mixin class for commands running Kolla Ansible."""
|
||||
@@ -305,7 +277,6 @@ class ControlHostBootstrap(KayobeAnsibleMixin, KollaAnsibleMixin, VaultMixin,
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.app.LOG.debug("Bootstrapping Kayobe Ansible control host")
|
||||
self.handle_kolla_tags_limits_deprecation(parsed_args)
|
||||
ansible.install_galaxy_roles(parsed_args)
|
||||
ansible.install_galaxy_collections(parsed_args)
|
||||
playbooks = _build_playbook_list("bootstrap")
|
||||
@@ -580,8 +551,6 @@ class KollaAnsibleRun(KollaAnsibleMixin, KayobeAnsibleMixin, VaultMixin,
|
||||
def take_action(self, parsed_args):
|
||||
self.app.LOG.debug("Running Kolla Ansible command")
|
||||
|
||||
self.handle_kolla_tags_limits_deprecation(parsed_args)
|
||||
|
||||
# First prepare configuration.
|
||||
self.generate_kolla_ansible_config(parsed_args)
|
||||
|
||||
@@ -762,7 +731,6 @@ class SeedVMProvision(KollaAnsibleMixin, KayobeAnsibleMixin, VaultMixin,
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.app.LOG.debug("Provisioning seed VM")
|
||||
self.handle_kolla_tags_limits_deprecation(parsed_args)
|
||||
self.run_kayobe_playbook(parsed_args,
|
||||
_get_playbook_path("ip-allocation"),
|
||||
limit="seed")
|
||||
@@ -781,7 +749,6 @@ class SeedVMDeprovision(KollaAnsibleMixin, KayobeAnsibleMixin, VaultMixin,
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.app.LOG.debug("Deprovisioning seed VM")
|
||||
self.handle_kolla_tags_limits_deprecation(parsed_args)
|
||||
self.run_kayobe_playbook(parsed_args,
|
||||
_get_playbook_path("seed-vm-deprovision"))
|
||||
|
||||
@@ -953,7 +920,6 @@ class SeedServiceDestroy(KollaAnsibleMixin, KayobeAnsibleMixin, VaultMixin,
|
||||
"you understand this.")
|
||||
sys.exit(1)
|
||||
self.app.LOG.debug("Destroying seed services")
|
||||
self.handle_kolla_tags_limits_deprecation(parsed_args)
|
||||
self.generate_kolla_ansible_config(parsed_args, service_config=False,
|
||||
bifrost_config=False)
|
||||
extra_args = ["--yes-i-really-really-mean-it"]
|
||||
@@ -1436,8 +1402,6 @@ class OvercloudFactsGather(KollaAnsibleMixin, KayobeAnsibleMixin, VaultMixin,
|
||||
def take_action(self, parsed_args):
|
||||
self.app.LOG.debug("Gathering overcloud host facts")
|
||||
|
||||
self.handle_kolla_tags_limits_deprecation(parsed_args)
|
||||
|
||||
# Gather facts for Kayobe.
|
||||
playbooks = _build_playbook_list("overcloud-facts-gather")
|
||||
self.run_kayobe_playbooks(parsed_args, playbooks)
|
||||
@@ -1575,8 +1539,6 @@ class OvercloudDatabaseBackup(KollaAnsibleMixin, KayobeAnsibleMixin,
|
||||
def take_action(self, parsed_args):
|
||||
self.app.LOG.debug("Performing overcloud database backup")
|
||||
|
||||
self.handle_kolla_tags_limits_deprecation(parsed_args)
|
||||
|
||||
# First prepare configuration.
|
||||
self.generate_kolla_ansible_config(parsed_args, service_config=False)
|
||||
|
||||
@@ -1605,8 +1567,6 @@ class OvercloudDatabaseRecover(KollaAnsibleMixin, KayobeAnsibleMixin,
|
||||
self.app.LOG.debug("Performing overcloud database recovery")
|
||||
extra_vars = {}
|
||||
|
||||
self.handle_kolla_tags_limits_deprecation(parsed_args)
|
||||
|
||||
# First prepare configuration.
|
||||
self.generate_kolla_ansible_config(parsed_args, service_config=True)
|
||||
|
||||
@@ -1647,8 +1607,6 @@ class OvercloudServiceConfigurationGenerate(KayobeAnsibleMixin,
|
||||
def take_action(self, parsed_args):
|
||||
self.app.LOG.debug("Generating overcloud service configuration")
|
||||
|
||||
self.handle_kolla_tags_limits_deprecation(parsed_args)
|
||||
|
||||
# First prepare configuration.
|
||||
self.generate_kolla_ansible_config(parsed_args)
|
||||
|
||||
@@ -1684,7 +1642,6 @@ class OvercloudServiceConfigurationValidate(KayobeAnsibleMixin,
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.app.LOG.debug("Validating overcloud service configuration")
|
||||
self.handle_kolla_tags_limits_deprecation(parsed_args)
|
||||
extra_vars = {}
|
||||
if parsed_args.output_dir:
|
||||
extra_vars[
|
||||
@@ -1766,8 +1723,6 @@ class OvercloudServiceDeploy(KollaAnsibleMixin, KayobeAnsibleMixin, VaultMixin,
|
||||
def take_action(self, parsed_args):
|
||||
self.app.LOG.debug("Deploying overcloud services")
|
||||
|
||||
self.handle_kolla_tags_limits_deprecation(parsed_args)
|
||||
|
||||
# First prepare configuration.
|
||||
self.generate_kolla_ansible_config(parsed_args)
|
||||
|
||||
@@ -1828,8 +1783,6 @@ class OvercloudServiceDeployContainers(KollaAnsibleMixin, KayobeAnsibleMixin,
|
||||
def take_action(self, parsed_args):
|
||||
self.app.LOG.debug("Deploying overcloud services (containers only)")
|
||||
|
||||
self.handle_kolla_tags_limits_deprecation(parsed_args)
|
||||
|
||||
# First prepare configuration.
|
||||
self.generate_kolla_ansible_config(parsed_args)
|
||||
|
||||
@@ -1878,8 +1831,6 @@ class OvercloudServicePrechecks(KollaAnsibleMixin, KayobeAnsibleMixin,
|
||||
def take_action(self, parsed_args):
|
||||
self.app.LOG.debug("Running overcloud prechecks")
|
||||
|
||||
self.handle_kolla_tags_limits_deprecation(parsed_args)
|
||||
|
||||
# First prepare configuration.
|
||||
self.generate_kolla_ansible_config(parsed_args)
|
||||
|
||||
@@ -1928,8 +1879,6 @@ class OvercloudServiceReconfigure(KollaAnsibleMixin, KayobeAnsibleMixin,
|
||||
def take_action(self, parsed_args):
|
||||
self.app.LOG.debug("Reconfiguring overcloud services")
|
||||
|
||||
self.handle_kolla_tags_limits_deprecation(parsed_args)
|
||||
|
||||
# First prepare configuration.
|
||||
self.generate_kolla_ansible_config(parsed_args)
|
||||
|
||||
@@ -1992,8 +1941,6 @@ class OvercloudServiceStop(KollaAnsibleMixin, KayobeAnsibleMixin, VaultMixin,
|
||||
|
||||
self.app.LOG.debug("Stopping overcloud services")
|
||||
|
||||
self.handle_kolla_tags_limits_deprecation(parsed_args)
|
||||
|
||||
# First prepare configuration.
|
||||
self.generate_kolla_ansible_config(parsed_args)
|
||||
|
||||
@@ -2041,8 +1988,6 @@ class OvercloudServiceUpgrade(KollaAnsibleMixin, KayobeAnsibleMixin,
|
||||
def take_action(self, parsed_args):
|
||||
self.app.LOG.debug("Upgrading overcloud services")
|
||||
|
||||
self.handle_kolla_tags_limits_deprecation(parsed_args)
|
||||
|
||||
# First prepare configuration.
|
||||
self.generate_kolla_ansible_config(parsed_args, install=True)
|
||||
|
||||
@@ -2101,8 +2046,6 @@ class OvercloudServiceDestroy(KollaAnsibleMixin, KayobeAnsibleMixin,
|
||||
|
||||
self.app.LOG.debug("Destroying overcloud services")
|
||||
|
||||
self.handle_kolla_tags_limits_deprecation(parsed_args)
|
||||
|
||||
# First prepare configuration.
|
||||
self.generate_kolla_ansible_config(parsed_args)
|
||||
|
||||
@@ -2128,8 +2071,6 @@ class OvercloudContainerImagePull(KayobeAnsibleMixin, KollaAnsibleMixin,
|
||||
def take_action(self, parsed_args):
|
||||
self.app.LOG.debug("Pulling overcloud container images")
|
||||
|
||||
self.handle_kolla_tags_limits_deprecation(parsed_args)
|
||||
|
||||
# First prepare configuration.
|
||||
self.generate_kolla_ansible_config(parsed_args, service_config=False)
|
||||
|
||||
|
||||
+5
-22
@@ -54,21 +54,8 @@ def add_args(parser):
|
||||
"Kolla Ansible" %
|
||||
(CONFIG_PATH_ENV, DEFAULT_CONFIG_PATH),
|
||||
action='append')
|
||||
# TODO(mattcrees): Remove kl, kt, and kolla-skip-tags in 2026.2.
|
||||
parser.add_argument("-kl", "--kolla-limit", metavar="SUBSET",
|
||||
help="[DEPRECATED: Please use -l or --limit instead] "
|
||||
"further limit selected hosts to an additional "
|
||||
"pattern")
|
||||
parser.add_argument("-kp", "--kolla-playbook", metavar="PLAYBOOK",
|
||||
help="path to Ansible playbook file")
|
||||
parser.add_argument("--kolla-skip-tags", metavar="TAGS",
|
||||
help="[DEPRECATED: Please use -skip-tags instead] "
|
||||
"only run plays and tasks whose tags "
|
||||
"do not match these values in Kolla Ansible")
|
||||
parser.add_argument("-kt", "--kolla-tags", metavar="TAGS",
|
||||
help="[DEPRECATED: Please use -t or --tags instead] "
|
||||
"only run plays and tasks tagged with these "
|
||||
"values in Kolla Ansible")
|
||||
parser.add_argument("--kolla-venv", metavar="VENV", default=default_venv,
|
||||
help="path to virtualenv where Kolla Ansible is "
|
||||
"installed (default=$%s or $PWD/%s)" %
|
||||
@@ -166,17 +153,13 @@ def build_args(parsed_args, command, inventory_filename, extra_vars=None,
|
||||
# Quote and escape variables originating within the python CLI.
|
||||
extra_var_value = utils.quote_and_escape(extra_var_value)
|
||||
cmd += ["-e", "%s=%s" % (extra_var_name, extra_var_value)]
|
||||
if parsed_args.limit or parsed_args.kolla_limit or limit:
|
||||
if parsed_args.limit or limit:
|
||||
limit_arg = utils.intersect_limits(parsed_args.limit, limit)
|
||||
limit_arg = utils.intersect_limits(parsed_args.kolla_limit, limit_arg)
|
||||
cmd += ["--limit", utils.quote_and_escape(limit_arg)]
|
||||
if parsed_args.skip_tags or parsed_args.kolla_skip_tags:
|
||||
all_tags = [t for t in [parsed_args.skip_tags,
|
||||
parsed_args.kolla_skip_tags] if t]
|
||||
cmd += ["--skip-tags", ",".join(all_tags)]
|
||||
if parsed_args.tags or parsed_args.kolla_tags or tags:
|
||||
all_tags = [t for t in [parsed_args.tags, parsed_args.kolla_tags,
|
||||
tags] if t]
|
||||
if parsed_args.skip_tags:
|
||||
cmd += ["--skip-tags", parsed_args.skip_tags]
|
||||
if parsed_args.tags or tags:
|
||||
all_tags = [t for t in [parsed_args.tags, tags] if t]
|
||||
cmd += ["--tags", ",".join(all_tags)]
|
||||
if parsed_args.list_tasks:
|
||||
cmd += ["--list-tasks"]
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
upgrade:
|
||||
- |
|
||||
Removed the deprecated options ``--kolla-tags`` and ``kolla-limit`` from
|
||||
all commands.
|
||||
Reference in new issue
Block a user