From 446fbe138de0b85c5fdc4a36239c181aeff41347 Mon Sep 17 00:00:00 2001 From: Roman Barbun Date: Mon, 4 Nov 2024 16:42:28 +1100 Subject: [PATCH] Renamed token plugin to fetch_token. --- api/playbooks/deploy_branch.yml | 2 +- api/playbooks/environment.yml | 2 +- api/playbooks/project.yml | 2 +- api/playbooks/project_metadata.yml | 2 +- api/playbooks/query.yml | 2 +- api/plugins/action/{token.py => fetch_token.py} | 0 api/plugins/modules/{token.py => fetch_token.py} | 4 ++-- api/roles/README.md | 6 +++--- api/roles/token/tasks/main.yml | 2 +- api/tests/playbooks/environment_vars.yml | 2 +- api/tests/playbooks/lookup_vars.yml | 2 +- api/tests/playbooks/project_vars.yml | 2 +- api/tests/playbooks/task_definitions.yml | 2 +- 13 files changed, 15 insertions(+), 15 deletions(-) rename api/plugins/action/{token.py => fetch_token.py} (100%) rename api/plugins/modules/{token.py => fetch_token.py} (93%) diff --git a/api/playbooks/deploy_branch.yml b/api/playbooks/deploy_branch.yml index ea3eadb..f6b939f 100644 --- a/api/playbooks/deploy_branch.yml +++ b/api/playbooks/deploy_branch.yml @@ -7,7 +7,7 @@ - lagoon.api.common tasks: - include_role: - name: lagoon.api.token + name: lagoon.api.fetch_token - name: Trigger staggered deployment. lagoon.api.deploy: diff --git a/api/playbooks/environment.yml b/api/playbooks/environment.yml index 9cfd75a..9bbc0df 100644 --- a/api/playbooks/environment.yml +++ b/api/playbooks/environment.yml @@ -7,7 +7,7 @@ - lagoon.api.common tasks: - include_role: - name: lagoon.api.token + name: lagoon.api.fetch_token - name: Retrieve all environments. set_fact: diff --git a/api/playbooks/project.yml b/api/playbooks/project.yml index 5bc740d..5f8b0c6 100644 --- a/api/playbooks/project.yml +++ b/api/playbooks/project.yml @@ -7,7 +7,7 @@ - lagoon.api.common tasks: - include_role: - name: lagoon.api.token + name: lagoon.api.fetch_token - name: Retrieve all projects. set_fact: diff --git a/api/playbooks/project_metadata.yml b/api/playbooks/project_metadata.yml index 695ea70..c421b78 100644 --- a/api/playbooks/project_metadata.yml +++ b/api/playbooks/project_metadata.yml @@ -7,7 +7,7 @@ - lagoon.api.common tasks: - include_role: - name: lagoon.api.token + name: lagoon.api.fetch_token - name: Retrieve project metadata. debug: msg="{{ lookup('lagoon.api.metadata', project=project_name) }}" diff --git a/api/playbooks/query.yml b/api/playbooks/query.yml index bdd7504..b36993b 100644 --- a/api/playbooks/query.yml +++ b/api/playbooks/query.yml @@ -7,7 +7,7 @@ - lagoon.api.common tasks: - include_role: - name: lagoon.api.token + name: lagoon.api.fetch_token - name: Query specific fields for all projects. lagoon.api.query: diff --git a/api/plugins/action/token.py b/api/plugins/action/fetch_token.py similarity index 100% rename from api/plugins/action/token.py rename to api/plugins/action/fetch_token.py diff --git a/api/plugins/modules/token.py b/api/plugins/modules/fetch_token.py similarity index 93% rename from api/plugins/modules/token.py rename to api/plugins/modules/fetch_token.py index cd8fc48..923d33a 100644 --- a/api/plugins/modules/token.py +++ b/api/plugins/modules/fetch_token.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- DOCUMENTATION = r''' -module: token +module: fetch_token description: Fetches a Lagoon token using ssh short_description: Fetches a Lagoon token using ssh options: @@ -15,7 +15,7 @@ EXAMPLES = r''' - name: Fetch a Lagoon token. - lagoon.api.token: + lagoon.api.fetch_token: ssh_options: "-q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" register: token vars: diff --git a/api/roles/README.md b/api/roles/README.md index 9ba80aa..77c2b3e 100644 --- a/api/roles/README.md +++ b/api/roles/README.md @@ -12,7 +12,7 @@ The following play can be used to fetch a token: - lagoon.api.common tasks: - include_role: - name: lagoon.api.token + name: lagoon.api.fetch_token ``` The token will now be available in the `lagoon_api_token` localhost variable. Default Lagoon variables are also exported from the `lagoon.api.common` role. @@ -46,7 +46,7 @@ To reuse the token in another play, the following can be done: - lagoon.api.common tasks: - include_role: - name: lagoon.api.token + name: lagoon.api.fetch_token - name: Retrieve all projects. set_fact: @@ -64,7 +64,7 @@ To reuse the token in another play, the following can be done: - lagoon.api.common tasks: - include_role: - name: lagoon.api.token + name: lagoon.api.fetch_token - name: Retrieve project by name. set_fact: diff --git a/api/roles/token/tasks/main.yml b/api/roles/token/tasks/main.yml index d3844ad..2d67ce4 100644 --- a/api/roles/token/tasks/main.yml +++ b/api/roles/token/tasks/main.yml @@ -1,7 +1,7 @@ ### Fetch a Lagoon token. - name: Fetch token. - lagoon.api.token: + lagoon.api.fetch_token: ssh_options: "-q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" register: fetched_token when: lagoon_api_token is not defined diff --git a/api/tests/playbooks/environment_vars.yml b/api/tests/playbooks/environment_vars.yml index 0c43753..da3576a 100644 --- a/api/tests/playbooks/environment_vars.yml +++ b/api/tests/playbooks/environment_vars.yml @@ -7,7 +7,7 @@ - lagoon.api.common tasks: - include_role: - name: lagoon.api.token + name: lagoon.api.fetch_token - name: Fetch environment vars. lagoon.api.variables: diff --git a/api/tests/playbooks/lookup_vars.yml b/api/tests/playbooks/lookup_vars.yml index be8c8f2..562ee10 100644 --- a/api/tests/playbooks/lookup_vars.yml +++ b/api/tests/playbooks/lookup_vars.yml @@ -7,7 +7,7 @@ - lagoon.api.common tasks: - include_role: - name: lagoon.api.token + name: lagoon.api.fetch_token - name: lookup a project's variables debug: msg="{{ item }}" diff --git a/api/tests/playbooks/project_vars.yml b/api/tests/playbooks/project_vars.yml index 72ea8d2..8a62736 100644 --- a/api/tests/playbooks/project_vars.yml +++ b/api/tests/playbooks/project_vars.yml @@ -7,7 +7,7 @@ - lagoon.api.common tasks: - include_role: - name: lagoon.api.token + name: lagoon.api.fetch_token - name: Fetch project vars. lagoon.api.variables: diff --git a/api/tests/playbooks/task_definitions.yml b/api/tests/playbooks/task_definitions.yml index 38960ec..f8c5cb2 100644 --- a/api/tests/playbooks/task_definitions.yml +++ b/api/tests/playbooks/task_definitions.yml @@ -8,7 +8,7 @@ tasks: - name: Create a token. ansible.builtin.include_role: - name: lagoon.api.token + name: lagoon.api.fetch_token - name: Ensure task definitions exist lagoon.api.task_definition: