From 675bdef190a67a286726a4a00013dbfd5d18d7cc Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Wed, 24 Aug 2022 19:59:56 +0200 Subject: [PATCH] Adjust booleans in source control modules. (#5158) --- .../bitbucket/bitbucket_pipeline_variable.py | 2 +- plugins/modules/source_control/bzr.py | 12 +++++----- plugins/modules/source_control/git_config.py | 16 ++++++------- .../github/github_deploy_key.py | 12 +++++----- .../source_control/github/github_key.py | 6 ++--- .../source_control/github/github_release.py | 6 ++--- .../source_control/github/github_repo.py | 4 ++-- .../gitlab/gitlab_deploy_key.py | 4 ++-- .../source_control/gitlab/gitlab_hook.py | 24 +++++++++---------- .../source_control/gitlab/gitlab_project.py | 8 +++---- .../gitlab/gitlab_project_variable.py | 4 ++-- .../source_control/gitlab/gitlab_runner.py | 8 +++---- .../source_control/gitlab/gitlab_user.py | 6 ++--- plugins/modules/source_control/hg.py | 24 +++++++++---------- 14 files changed, 68 insertions(+), 68 deletions(-) diff --git a/plugins/modules/source_control/bitbucket/bitbucket_pipeline_variable.py b/plugins/modules/source_control/bitbucket/bitbucket_pipeline_variable.py index 196aff25d3..4c465482d0 100644 --- a/plugins/modules/source_control/bitbucket/bitbucket_pipeline_variable.py +++ b/plugins/modules/source_control/bitbucket/bitbucket_pipeline_variable.py @@ -44,7 +44,7 @@ options: description: - Whether to encrypt the variable value. type: bool - default: no + default: false state: description: - Indicates desired state of the variable. diff --git a/plugins/modules/source_control/bzr.py b/plugins/modules/source_control/bzr.py index 832e1c4afc..7832183806 100644 --- a/plugins/modules/source_control/bzr.py +++ b/plugins/modules/source_control/bzr.py @@ -22,12 +22,12 @@ options: description: - SSH or HTTP protocol address of the parent branch. aliases: [ parent ] - required: yes + required: true type: str dest: description: - Absolute path of where the branch should be cloned to. - required: yes + required: true type: path version: description: @@ -37,11 +37,11 @@ options: type: str force: description: - - If C(yes), any modified files in the working + - If C(true), any modified files in the working tree will be discarded. Before 1.9 the default - value was C(yes). + value was C(true). type: bool - default: 'no' + default: false executable: description: - Path to bzr executable to use. If not supplied, @@ -112,7 +112,7 @@ class Bzr(object): tree since that commit. ''' if not force and self.has_local_mods(): - self.module.fail_json(msg="Local modifications exist in branch (force=no).") + self.module.fail_json(msg="Local modifications exist in branch (force=false).") return self._command(["revert"], check_rc=True, cwd=self.dest) def fetch(self): diff --git a/plugins/modules/source_control/git_config.py b/plugins/modules/source_control/git_config.py index 2045341ed1..464e39040c 100644 --- a/plugins/modules/source_control/git_config.py +++ b/plugins/modules/source_control/git_config.py @@ -30,7 +30,7 @@ options: description: - List all settings (optionally limited to a given I(scope)). type: bool - default: 'no' + default: false name: description: - The name of the setting. If no value is supplied, the value will @@ -52,7 +52,7 @@ options: - This is required when setting config values. - If this is set to C(local), you must also specify the C(repo) parameter. - If this is set to C(file), you must also specify the C(file) parameter. - - It defaults to system only when not using I(list_all)=C(yes). + - It defaults to system only when not using I(list_all)=C(true). choices: [ "file", "local", "global", "system" ] type: str state: @@ -123,35 +123,35 @@ EXAMPLES = ''' name: alias.ci scope: global -- name: Scope system is also assumed when reading values, unless list_all=yes +- name: Scope system is also assumed when reading values, unless list_all=true community.general.git_config: name: alias.diffc - name: Read all values from git config community.general.git_config: - list_all: yes + list_all: true scope: global - name: When list_all is yes and no scope is specified, you get configuration from all scopes community.general.git_config: - list_all: yes + list_all: true - name: Specify a repository to include local settings community.general.git_config: - list_all: yes + list_all: true repo: /path/to/repo.git ''' RETURN = ''' --- config_value: - description: When list_all=no and value is not set, a string containing the value of the setting in name + description: When I(list_all=false) and value is not set, a string containing the value of the setting in name returned: success type: str sample: "vim" config_values: - description: When list_all=yes, a dict containing key/value pairs of multiple configuration settings + description: When I(list_all=true), a dict containing key/value pairs of multiple configuration settings returned: success type: dict sample: diff --git a/plugins/modules/source_control/github/github_deploy_key.py b/plugins/modules/source_control/github/github_deploy_key.py index cbf6c286a3..97e7a1ac7f 100644 --- a/plugins/modules/source_control/github/github_deploy_key.py +++ b/plugins/modules/source_control/github/github_deploy_key.py @@ -53,7 +53,7 @@ options: description: - If C(true), the deploy key will only be able to read repository contents. Otherwise, the deploy key will be able to read and write. type: bool - default: 'yes' + default: true state: description: - The state of the deploy key. @@ -64,7 +64,7 @@ options: description: - If C(true), forcefully adds the deploy key by deleting any existing deploy key with the same public key or title. type: bool - default: 'no' + default: false username: description: - The username to authenticate with. Should not be set when using personal access token @@ -92,7 +92,7 @@ EXAMPLES = ''' repo: "example" name: "new-deploy-key" key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAwXxn7kIMNWzcDfou..." - read_only: yes + read_only: true username: "johndoe" password: "supersecretpassword" @@ -102,7 +102,7 @@ EXAMPLES = ''' repository: "example" name: "new-deploy-key" key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAwXxn7kIMNWzcDfou..." - force: yes + force: true username: "johndoe" password: "supersecretpassword" state: absent @@ -113,7 +113,7 @@ EXAMPLES = ''' repository: "example" name: "new-deploy-key" key: "{{ lookup('file', '~/.ssh/github.pub') }}" - force: yes + force: true token: "ABAQDAwXxn7kIMNWzcDfo..." - name: Re-add a deploy key to a GitHub repository but with a different name @@ -142,7 +142,7 @@ EXAMPLES = ''' repo: "example" name: "new-deploy-key" key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAwXxn7kIMNWzcDfou..." - read_only: yes + read_only: true username: "janedoe" password: "supersecretpassword" ''' diff --git a/plugins/modules/source_control/github/github_key.py b/plugins/modules/source_control/github/github_key.py index da8372d890..10dd3f9c00 100644 --- a/plugins/modules/source_control/github/github_key.py +++ b/plugins/modules/source_control/github/github_key.py @@ -37,11 +37,11 @@ options: type: str force: description: - - The default is C(yes), which will replace the existing remote key - if it's different than C(pubkey). If C(no), the key will only be + - The default is C(true), which will replace the existing remote key + if it's different than C(pubkey). If C(false), the key will only be set if no key with the given C(name) exists. type: bool - default: 'yes' + default: true author: Robert Estelle (@erydo) ''' diff --git a/plugins/modules/source_control/github/github_release.py b/plugins/modules/source_control/github/github_release.py index d0cd5c4ff9..84ce4ce4ec 100644 --- a/plugins/modules/source_control/github/github_release.py +++ b/plugins/modules/source_control/github/github_release.py @@ -59,13 +59,13 @@ options: draft: description: - Sets if the release is a draft or not. (boolean) - type: 'bool' - default: 'no' + type: bool + default: false prerelease: description: - Sets if the release is a prerelease or not. (boolean) type: bool - default: 'no' + default: false author: - "Adrian Moisey (@adrianmoisey)" diff --git a/plugins/modules/source_control/github/github_repo.py b/plugins/modules/source_control/github/github_repo.py index 609d377ddd..0549a5ad46 100644 --- a/plugins/modules/source_control/github/github_repo.py +++ b/plugins/modules/source_control/github/github_repo.py @@ -101,9 +101,9 @@ EXAMPLES = ''' organization: MyOrganization name: myrepo description: "Just for fun" - private: yes + private: true state: present - force_defaults: no + force_defaults: false register: result - name: Delete the repository diff --git a/plugins/modules/source_control/gitlab/gitlab_deploy_key.py b/plugins/modules/source_control/gitlab/gitlab_deploy_key.py index 01ed49ffa4..e1449a83ee 100644 --- a/plugins/modules/source_control/gitlab/gitlab_deploy_key.py +++ b/plugins/modules/source_control/gitlab/gitlab_deploy_key.py @@ -46,7 +46,7 @@ options: description: - Whether this key can push to the project. type: bool - default: no + default: false state: description: - When C(present) the deploy key added to the project if it doesn't exist. @@ -73,7 +73,7 @@ EXAMPLES = ''' project: "my_group/my_project" title: "Jenkins CI" state: present - can_push: yes + can_push: true - name: "Remove the previous deploy key from the project" community.general.gitlab_deploy_key: diff --git a/plugins/modules/source_control/gitlab/gitlab_hook.py b/plugins/modules/source_control/gitlab/gitlab_hook.py index fad63ddc5c..f0824a96c7 100644 --- a/plugins/modules/source_control/gitlab/gitlab_hook.py +++ b/plugins/modules/source_control/gitlab/gitlab_hook.py @@ -49,7 +49,7 @@ options: description: - Trigger hook on push events. type: bool - default: yes + default: true push_events_branch_filter: description: - Branch name of wildcard to trigger hook on push events @@ -59,42 +59,42 @@ options: description: - Trigger hook on issues events. type: bool - default: no + default: false merge_requests_events: description: - Trigger hook on merge requests events. type: bool - default: no + default: false tag_push_events: description: - Trigger hook on tag push events. type: bool - default: no + default: false note_events: description: - Trigger hook on note events or when someone adds a comment. type: bool - default: no + default: false job_events: description: - Trigger hook on job events. type: bool - default: no + default: false pipeline_events: description: - Trigger hook on pipeline events. type: bool - default: no + default: false wiki_page_events: description: - Trigger hook on wiki events. type: bool - default: no + default: false hook_validate_certs: description: - Whether GitLab will do SSL verification when triggering the hook. type: bool - default: no + default: false aliases: [ enable_ssl_verification ] token: description: @@ -113,9 +113,9 @@ EXAMPLES = ''' project: "my_group/my_project" hook_url: "https://my-ci-server.example.com/gitlab-hook" state: present - push_events: yes - tag_push_events: yes - hook_validate_certs: no + push_events: true + tag_push_events: true + hook_validate_certs: false token: "my-super-secret-token-that-my-ci-server-will-check" - name: "Delete the previous hook" diff --git a/plugins/modules/source_control/gitlab/gitlab_project.py b/plugins/modules/source_control/gitlab/gitlab_project.py index 84594cbeb3..63a94bd444 100644 --- a/plugins/modules/source_control/gitlab/gitlab_project.py +++ b/plugins/modules/source_control/gitlab/gitlab_project.py @@ -58,23 +58,23 @@ options: - Whether you want to create issues or not. - Possible values are true and false. type: bool - default: yes + default: true merge_requests_enabled: description: - If merge requests can be made or not. - Possible values are true and false. type: bool - default: yes + default: true wiki_enabled: description: - If an wiki for this project should be available or not. type: bool - default: yes + default: true snippets_enabled: description: - If creating snippets should be available or not. type: bool - default: yes + default: true visibility: description: - C(private) Project access must be granted explicitly for each user. diff --git a/plugins/modules/source_control/gitlab/gitlab_project_variable.py b/plugins/modules/source_control/gitlab/gitlab_project_variable.py index bfba9a5e37..3e71bfa347 100644 --- a/plugins/modules/source_control/gitlab/gitlab_project_variable.py +++ b/plugins/modules/source_control/gitlab/gitlab_project_variable.py @@ -117,8 +117,8 @@ EXAMPLES = ''' value: abc123 - name: SECRET_ACCESS_KEY value: dassgrfaeui8989 - masked: yes - protected: yes + masked: true + protected: true environment_scope: production - name: Set or update some CI/CD variables diff --git a/plugins/modules/source_control/gitlab/gitlab_runner.py b/plugins/modules/source_control/gitlab/gitlab_runner.py index b6af300a9d..f79bbc2628 100644 --- a/plugins/modules/source_control/gitlab/gitlab_runner.py +++ b/plugins/modules/source_control/gitlab/gitlab_runner.py @@ -66,14 +66,14 @@ options: description: - Searches only runners available to the user when searching for existing, when false admin token required. - Mutually exclusive with I(project) since community.general 4.5.0. - default: no + default: false type: bool version_added: 2.0.0 active: description: - Define if the runners is immediately active after creation. required: False - default: yes + default: true type: bool locked: description: @@ -100,7 +100,7 @@ options: description: - Run untagged jobs or not. required: False - default: yes + default: true type: bool tag_list: description: The tags that apply to the runner. @@ -135,7 +135,7 @@ EXAMPLES = ''' api_url: https://gitlab.example.com/ api_token: "{{ access_token }}" description: Docker Machine t1 - owned: yes + owned: true state: absent - name: Register runner for a specific project diff --git a/plugins/modules/source_control/gitlab/gitlab_user.py b/plugins/modules/source_control/gitlab/gitlab_user.py index 6a322ebd0e..14be4bd177 100644 --- a/plugins/modules/source_control/gitlab/gitlab_user.py +++ b/plugins/modules/source_control/gitlab/gitlab_user.py @@ -102,17 +102,17 @@ options: description: - Require confirmation. type: bool - default: yes + default: true isadmin: description: - Grant admin privileges to the user. type: bool - default: no + default: false external: description: - Define external parameter for this user. type: bool - default: no + default: false identities: description: - List of identities to be added/updated for this user. diff --git a/plugins/modules/source_control/hg.py b/plugins/modules/source_control/hg.py index 398320515e..777feaa059 100644 --- a/plugins/modules/source_control/hg.py +++ b/plugins/modules/source_control/hg.py @@ -20,7 +20,7 @@ options: repo: description: - The repository address. - required: yes + required: true aliases: [ name ] type: str dest: @@ -37,24 +37,24 @@ options: force: description: - Discards uncommitted changes. Runs C(hg update -C). Prior to - 1.9, the default was C(yes). + 1.9, the default was C(true). type: bool - default: 'no' + default: false purge: description: - Deletes untracked files. Runs C(hg purge). type: bool - default: 'no' + default: false update: description: - - If C(no), do not retrieve new revisions from the origin repository + - If C(false), do not retrieve new revisions from the origin repository type: bool - default: 'yes' + default: true clone: description: - - If C(no), do not clone the repository if it does not exist locally. + - If C(false), do not clone the repository if it does not exist locally. type: bool - default: 'yes' + default: true executable: description: - Path to hg executable to use. If not supplied, @@ -77,14 +77,14 @@ EXAMPLES = ''' repo: https://bitbucket.org/user/repo1 dest: /home/user/repo1 revision: stable - purge: yes + purge: true - name: Get information about the repository whether or not it has already been cloned locally. community.general.hg: repo: git://bitbucket.org/user/repo dest: /srv/checkout - clone: no - update: no + clone: false + update: false ''' import os @@ -245,7 +245,7 @@ def main(): cleaned = False if not dest and (clone or update): - module.fail_json(msg="the destination directory must be specified unless clone=no and update=no") + module.fail_json(msg="the destination directory must be specified unless clone=false and update=false") hg = Hg(module, dest, repo, revision, hg_path)