From 0b26297177ce42a3b4c77d663f1c89fc750cc975 Mon Sep 17 00:00:00 2001 From: Dag Wieers Date: Thu, 15 Mar 2018 22:15:24 +0100 Subject: [PATCH] Clean up module documentation (#36909) * Clean up module documentation This PR includes: - Removal of `default: None` (and variations) - Removal of `required: false` - Fixing booleans and `type: bool` where required * Fix remaining (new) validation issues --- .../ansible_tower/tower_credential.py | 41 ++-------------- .../ansible_tower/tower_group.py | 29 ++--------- .../ansible_tower/tower_host.py | 9 ++-- .../ansible_tower/tower_inventory.py | 5 -- .../ansible_tower/tower_job_launch.py | 10 +--- .../ansible_tower/tower_job_list.py | 6 +-- .../ansible_tower/tower_job_template.py | 49 +++++-------------- .../ansible_tower/tower_job_wait.py | 1 - .../ansible_tower/tower_label.py | 3 -- .../ansible_tower/tower_organization.py | 3 -- .../ansible_tower/tower_project.py | 29 +++-------- .../ansible_tower/tower_role.py | 17 ------- .../ansible_tower/tower_team.py | 5 +- .../ansible_tower/tower_user.py | 15 ++---- 14 files changed, 38 insertions(+), 184 deletions(-) diff --git a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_credential.py b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_credential.py index 37fd10ce97..37380d1330 100644 --- a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_credential.py +++ b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_credential.py @@ -33,23 +33,15 @@ options: user: description: - User that should own this credential. - required: False - default: null team: description: - Team that should own this credential. - required: False - default: null project: description: - Project that should for this credential. - required: False - default: null organization: description: - Organization that should own the credential. - required: False - default: null kind: description: - Type of credential being added. @@ -58,86 +50,59 @@ options: host: description: - Host for this credential. - required: False - default: null username: description: - Username for this credential. access_key for AWS. - required: False - default: null password: description: - Password for this credential. Use ASK for prompting. secret_key for AWS. api_key for RAX. - required: False - default: null ssh_key_data: description: - Path to SSH private key. - required: False - default: null ssh_key_unlock: description: - Unlock password for ssh_key. Use ASK for prompting. authorize: description: - Should use authorize for net type. - required: False - default: False + type: bool + default: 'no' authorize_password: description: - Password for net credentials that require authorize. - required: False - default: null client: description: - Client or application ID for azure_rm type. - required: False - default: null secret: description: - Secret token for azure_rm type. - required: False - default: null subscription: description: - Subscription ID for azure_rm type. - required: False - default: null tenant: description: - Tenant ID for azure_rm type. - required: False - default: null domain: description: - Domain for openstack type. - required: False - default: null become_method: description: - Become method to Use for privledge escalation. - required: False choices: ["None", "sudo", "su", "pbrun", "pfexec", "pmrun"] - default: "None" become_username: description: - Become username. Use ASK for prompting. - required: False - default: null become_password: description: - Become password. Use ASK for prompting. - required: False - default: null vault_password: description: - Valut password. Use ASK for prompting. state: description: - Desired state of the resource. - required: False - default: "present" choices: ["present", "absent"] + default: "present" extends_documentation_fragment: tower ''' diff --git a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_group.py b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_group.py index d2183017ab..0afdeeace1 100644 --- a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_group.py +++ b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_group.py @@ -30,8 +30,6 @@ options: description: description: - The description to use for the group. - required: False - default: null inventory: description: - Inventory the group should be made a member of. @@ -39,63 +37,44 @@ options: variables: description: - Variables to use for the group, use C(@) for a file. - required: False - default: null credential: description: - Credential to use for the group. - required: False - default: null source: description: - The source to use for this group. - required: False - default: null, choices: ["manual", "file", "ec2", "rax", "vmware", "gce", "azure", "azure_rm", "openstack", "satellite6" , "cloudforms", "custom"] source_regions: description: - Regions for cloud provider. - required: False - default: null source_vars: description: - Override variables from source with variables from this field. - required: False - default: null instance_filters: description: - Comma-separated list of filter expressions for matching hosts. - required: False - default: null group_by: description: - Limit groups automatically created from inventory source. - required: False - default: null source_script: description: - Inventory script to be used when group type is C(custom). - required: False - default: null overwrite: description: - Delete child groups and hosts not found in source. - required: False - default: False + type: bool + default: 'no' overwrite_vars: description: - Override vars in child groups and hosts with those from external source. - required: False - default: null update_on_launch: description: - Refresh inventory data from its source each time a job is run. - required: False - default: False + type: bool + default: 'no' state: description: - Desired state of the resource. - required: False default: "present" choices: ["present", "absent"] extends_documentation_fragment: tower diff --git a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_host.py b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_host.py index 1c625ef3ca..8f028c8755 100644 --- a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_host.py +++ b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_host.py @@ -30,8 +30,6 @@ options: description: description: - The description to use for the host. - required: False - default: null inventory: description: - Inventory the host should be made a member of. @@ -39,17 +37,16 @@ options: enabled: description: - If the host should be enabled. - required: False - default: True + type: bool + default: 'yes' variables: description: - Variables to use for the host. Use C(@) for a file. state: description: - Desired state of the resource. - required: False - default: "present" choices: ["present", "absent"] + default: "present" extends_documentation_fragment: tower ''' diff --git a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_inventory.py b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_inventory.py index fb8bafc3f9..c05d93e665 100644 --- a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_inventory.py +++ b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_inventory.py @@ -30,8 +30,6 @@ options: description: description: - The description to use for the inventory. - required: False - default: null organization: description: - Organization the inventory belongs to. @@ -39,12 +37,9 @@ options: variables: description: - Inventory variables. Use C(@) to get from file. - required: False - default: null state: description: - Desired state of the resource. - required: False default: "present" choices: ["present", "absent"] extends_documentation_fragment: tower diff --git a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_job_launch.py b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_job_launch.py index af6804bd28..350a7adf8c 100644 --- a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_job_launch.py +++ b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_job_launch.py @@ -30,36 +30,30 @@ options: job_explanation: description: - Job explanation field. - default: null job_type: description: - Job_type to use for the job, only used if prompt for job_type is set. choices: ["run", "check", "scan"] - default: null inventory: description: - Inventory to use for the job, only used if prompt for inventory is set. - default: null credential: description: - Credential to use for job, only used if prompt for credential is set. - default: null extra_vars: description: - Extra_vars to use for the job_template. Prepend C(@) if a file. - default: null limit: description: - Limit to use for the I(job_template). - default: null tags: description: - Specific tags to use for from playbook. - default: null use_job_endpoint: description: - Disable launching jobs from job template. - default: False + type: bool + default: 'no' extends_documentation_fragment: tower ''' diff --git a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_job_list.py b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_job_list.py index 93737ad189..8f0f373c14 100644 --- a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_job_list.py +++ b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_job_list.py @@ -26,20 +26,18 @@ options: status: description: - Only list jobs with this status. - default: null choices: ['pending', 'waiting', 'running', 'error', 'failed', 'canceled', 'successful'] page: description: - Page number of the results to fetch. - default: null all_pages: description: - Fetch all the pages and return a single result. - default: False + type: bool + default: 'no' query: description: - Query used to further filter the list of jobs. C({"foo":"bar"}) will be passed at C(?foo=bar) - default: null extends_documentation_fragment: tower ''' diff --git a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_job_template.py b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_job_template.py index e8e2a07a4e..703db940d9 100644 --- a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_job_template.py +++ b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_job_template.py @@ -30,8 +30,6 @@ options: description: description: - Description to use for the job template. - required: False - default: null job_type: description: - The job_type to use for the job template. @@ -40,8 +38,6 @@ options: inventory: description: - Inventory to use for the job template. - required: False - default: null project: description: - Project to use for the job template. @@ -53,88 +49,67 @@ options: machine_credential: description: - Machine_credential to use for the job template. - required: False - default: null cloud_credential: description: - Cloud_credential to use for the job template. - required: False - default: null network_credential: description: - The network_credential to use for the job template. - required: False - default: null forks: description: - The number of parallel or simultaneous processes to use while executing the playbook. - required: False - default: null limit: description: - A host pattern to further constrain the list of hosts managed or affected by the playbook - required: False - default: null verbosity: description: - Control the output level Ansible produces as the playbook runs. - required: False choices: ["verbose", "debug"] - default: null job_tags: description: - The job_tags to use for the job template. - required: False - default: null skip_tags: description: - The skip_tags to use for the job template. - required: False - default: null host_config_key: description: - Allow provisioning callbacks using this host config key. - required: False - default: null extra_vars_path: description: - Path to the C(extra_vars) YAML file. - required: False - default: null ask_extra_vars: description: - Prompt user for C(extra_vars) on launch. - required: False - default: False + type: bool + default: 'no' ask_tags: description: - Prompt user for job tags on launch. - required: False - default: False + type: bool + default: 'no' ask_job_type: description: - Prompt user for job type on launch. - required: False - default: False + type: bool + default: 'no' ask_inventory: description: - Propmt user for inventory on launch. - required: False - default: False + type: bool + default: 'no' ask_credential: description: - Prompt user for credential on launch. - required: False - default: False + type: bool + default: 'no' become_enabled: description: - Activate privilege escalation. - required: False - default: False + type: bool + default: 'no' state: description: - Desired state of the resource. - required: False default: "present" choices: ["present", "absent"] extends_documentation_fragment: tower diff --git a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_job_wait.py b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_job_wait.py index 1747e26b0a..4a455ccb6f 100644 --- a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_job_wait.py +++ b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_job_wait.py @@ -38,7 +38,6 @@ options: timeout: description: - Maximum time in seconds to wait for a job to finish. - default: null extends_documentation_fragment: tower ''' diff --git a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_label.py b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_label.py index 95f63d1f3c..618b209cf1 100644 --- a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_label.py +++ b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_label.py @@ -27,16 +27,13 @@ options: description: - Name to use for the label. required: True - default: null organization: description: - Organization the label should be applied to. required: True - default: null state: description: - Desired state of the resource. - required: False default: "present" choices: ["present", "absent"] extends_documentation_fragment: tower diff --git a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_organization.py b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_organization.py index fa6daa7833..cf944cf969 100644 --- a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_organization.py +++ b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_organization.py @@ -30,12 +30,9 @@ options: description: description: - The description to use for the organization. - required: False - default: null state: description: - Desired state of the resource. - required: False default: "present" choices: ["present", "absent"] extends_documentation_fragment: tower diff --git a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_project.py b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_project.py index f6726a187b..73f252bfa9 100644 --- a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_project.py +++ b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_project.py @@ -27,62 +27,47 @@ options: description: - Name to use for the project. required: True - default: null description: description: - Description to use for the project. - required: False - default: null scm_type: description: - Type of SCM resource. - required: False - default: "manual" choices: ["manual", "git", "hg", "svn"] + default: "manual" scm_url: description: - URL of SCM resource. - required: False - default: null local_path: description: - The server playbook directory for manual projects. - required: False - default: null scm_branch: description: - The branch to use for the SCM resource. - required: False - default: null scm_credential: description: - Name of the credential to use with this SCM resource. - required: False - default: null scm_clean: description: - Remove local modifications before updating. - required: False - default: False + type: bool + default: 'no' scm_delete_on_update: description: - Remove the repository completely before updating. - required: False - default: False + type: bool + default: 'no' scm_update_on_launch: description: - Before an update to the local repository before launching a job with this project. - required: False - default: False + type: bool + default: 'no' organization: description: - Primary key of organization for project. - required: False - default: null state: description: - Desired state of the resource. - required: False default: "present" choices: ["present", "absent"] extends_documentation_fragment: tower diff --git a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_role.py b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_role.py index 9210a9fa9f..46940ab1ec 100644 --- a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_role.py +++ b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_role.py @@ -26,13 +26,9 @@ options: user: description: - User that receives the permissions specified by the role. - required: False - default: null team: description: - Team that receives the permissions specified by the role. - required: False - default: null role: description: - The role type to grant/revoke. @@ -41,37 +37,24 @@ options: target_team: description: - Team that the role acts on. - required: False - default: null inventory: description: - Inventory the role acts on. - required: False - default: null job_template: description: - The job template the role acts on. - required: False - default: null credential: description: - Credential the role acts on. - required: False - default: null organization: description: - Organization the role acts on. - required: False - default: null project: description: - Project the role acts on. - required: False - default: null state: description: - Desired state of the resource. - required: False default: "present" choices: ["present", "absent"] extends_documentation_fragment: tower diff --git a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_team.py b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_team.py index 390771f02b..cd0469f773 100644 --- a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_team.py +++ b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_team.py @@ -27,18 +27,15 @@ options: description: - Name to use for the team. required: True - default: null organization: description: - Organization the team should be made a member of. required: True - default: null state: description: - Desired state of the resource. - required: False - default: "present" choices: ["present", "absent"] + default: "present" extends_documentation_fragment: tower ''' diff --git a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_user.py b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_user.py index 9fb8c639d1..7c66f5a7a5 100644 --- a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_user.py +++ b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_user.py @@ -30,13 +30,9 @@ options: first_name: description: - First name of the user. - required: False - default: null last_name: description: - Last name of the user. - required: False - default: null email: description: - Email address of the user. @@ -44,22 +40,19 @@ options: password: description: - Password of the user. - required: False - default: null superuser: description: - User is a system wide administator. - required: False - default: False + type: bool + default: 'no' auditor: description: - User is a system wide auditor. - required: False - default: False + type: bool + default: 'no' state: description: - Desired state of the resource. - required: False default: "present" choices: ["present", "absent"] extends_documentation_fragment: tower