From 3435de7d5f303fa143dc4e95424a4a9897b7c713 Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Wed, 18 May 2022 18:28:59 +0100 Subject: [PATCH] Update schemas (#2160) --- src/ansiblelint/schemas/meta.json | 9 +- src/ansiblelint/schemas/playbook.json | 18 - src/ansiblelint/schemas/tasks.json | 522 -------------------------- test/eco/debops.result | 2 +- test/eco/zuul-jobs.result | 9 +- 5 files changed, 11 insertions(+), 549 deletions(-) diff --git a/src/ansiblelint/schemas/meta.json b/src/ansiblelint/schemas/meta.json index 74a06f50d1..8dbee3bde4 100644 --- a/src/ansiblelint/schemas/meta.json +++ b/src/ansiblelint/schemas/meta.json @@ -213,6 +213,10 @@ ], "markdownDescription": "See https://docs.ansible.com/ansible/latest/user_guide/playbooks_reuse_roles.html#role-dependencies and https://github.com/ansible/ansible/blob/devel/lib/ansible/playbook/role/metadata.py#L79", "properties": { + "become": { + "title": "Become", + "type": "boolean" + }, "name": { "title": "Name", "type": "string" @@ -244,6 +248,10 @@ "version": { "title": "Version", "type": "string" + }, + "when": { + "title": "When", + "type": "string" } }, "title": "Dependency entry", @@ -1211,7 +1219,6 @@ "$ref": "#/$defs/GalaxyInfoModel" } }, - "required": ["galaxy_info"], "type": "object" } ], diff --git a/src/ansiblelint/schemas/playbook.json b/src/ansiblelint/schemas/playbook.json index ee6fab496a..7f736a82f3 100644 --- a/src/ansiblelint/schemas/playbook.json +++ b/src/ansiblelint/schemas/playbook.json @@ -658,24 +658,6 @@ "title": "play-role", "type": "object" }, - "playbook": { - "examples": [ - "playbooks/*.yml", - "playbooks/*.yaml" - ], - "items": { - "oneOf": [ - { - "$ref": "#/$defs/ansible.builtin.import_playbook" - }, - { - "$ref": "#/$defs/play" - } - ] - }, - "title": "Ansible Playbook", - "type": "array" - }, "task": { "additionalProperties": true, "not": { diff --git a/src/ansiblelint/schemas/tasks.json b/src/ansiblelint/schemas/tasks.json index bf357b075b..7d8ebee606 100644 --- a/src/ansiblelint/schemas/tasks.json +++ b/src/ansiblelint/schemas/tasks.json @@ -1,47 +1,6 @@ { "$comment": "Generated from ansible.json, do not edit.", "$defs": { - "ansible.builtin.import_playbook": { - "additionalProperties": false, - "oneOf": [ - { - "not": { - "required": [ - "import_playbook" - ] - }, - "required": [ - "ansible.builtin.import_playbook" - ] - }, - { - "not": { - "required": [ - "ansible.builtin.import_playbook" - ] - }, - "required": [ - "import_playbook" - ] - } - ], - "patternProperties": { - "^(ansible\\.builtin\\.)?import_playbook$": { - "markdownDescription": "* Includes a file with a list of plays to be executed.\n * Files with a list of plays can only be included at the top level.\n * You cannot use this action inside a play.\n\nSee [import_playbook](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/import_playbook_module.html)", - "title": "Import Playbook", - "type": "string" - }, - "name": { - "title": "Name", - "type": "string" - }, - "vars": { - "title": "Vars", - "type": "object" - } - }, - "type": "object" - }, "become_method": { "markdownDescription": "See [become](https://docs.ansible.com/ansible/latest/user_guide/become.html)", "oneOf": [ @@ -276,406 +235,6 @@ "markdownDescription": "Use for protecting sensitive data. See [no_log](https://docs.ansible.com/ansible/latest/reference_appendices/logging.html)", "title": "no_log" }, - "play": { - "additionalProperties": false, - "allOf": [ - { - "not": { - "required": [ - "ansible.builtin.import_playbook" - ] - } - }, - { - "not": { - "required": [ - "import_playbook" - ] - } - } - ], - "properties": { - "any_errors_fatal": { - "title": "Any Errors Fatal", - "type": "boolean" - }, - "become": { - "$ref": "#/$defs/templated-boolean", - "title": "Become" - }, - "become_exe": { - "title": "Become Exe", - "type": "string" - }, - "become_flags": { - "title": "Become Flags", - "type": "string" - }, - "become_method": { - "$ref": "#/$defs/become_method" - }, - "become_user": { - "title": "Become User", - "type": "string" - }, - "check_mode": { - "$ref": "#/$defs/complex_conditional", - "title": "Check Mode" - }, - "collections": { - "items": { - "type": "string" - }, - "title": "Collections", - "type": "array" - }, - "connection": { - "title": "Connection", - "type": "string" - }, - "debugger": { - "title": "Debugger", - "type": "string" - }, - "diff": { - "title": "Diff", - "type": "boolean" - }, - "environment": { - "$ref": "#/$defs/environment" - }, - "fact_path": { - "title": "Fact Path", - "type": "string" - }, - "force_handlers": { - "title": "Force Handlers", - "type": "boolean" - }, - "gather_facts": { - "title": "Gather Facts", - "type": "boolean" - }, - "gather_subset": { - "title": "Gather Subset", - "type": "boolean" - }, - "gather_timeout": { - "title": "Gather Timeout", - "type": "integer" - }, - "handlers": { - "$ref": "#/$defs/tasks" - }, - "hosts": { - "anyOf": [ - { - "type": "string" - }, - { - "items": { - "type": "string" - }, - "type": "array" - } - ], - "title": "Hosts" - }, - "ignore_errors": { - "$ref": "#/$defs/ignore_errors" - }, - "ignore_unreachable": { - "title": "Ignore Unreachable", - "type": "boolean" - }, - "max_fail_percentage": { - "title": "Max Fail Percentage", - "type": "number" - }, - "module_defaults": { - "title": "Module Defaults" - }, - "name": { - "title": "Name", - "type": "string" - }, - "no_log": { - "$ref": "#/$defs/templated-boolean" - }, - "order": { - "enum": [ - "default", - "sorted", - "reverse_sorted", - "reverse_inventory", - "shuffle" - ], - "title": "Order", - "type": "string" - }, - "port": { - "title": "Port", - "type": "integer" - }, - "post_tasks": { - "$ref": "#/$defs/tasks" - }, - "pre_tasks": { - "$ref": "#/$defs/tasks" - }, - "remote_user": { - "title": "Remote User", - "type": "string" - }, - "roles": { - "items": { - "anyOf": [ - { - "$ref": "#/$defs/play-role" - }, - { - "type": "string" - } - ] - }, - "markdownDescription": "Roles let you automatically load related vars, files, tasks, handlers, and other Ansible artifacts based on a known file structure. After you group your content in roles, you can easily reuse them and share them with other users.\n See [roles](https://docs.ansible.com/ansible/latest/user_guide/playbooks_reuse_roles.html#roles)", - "title": "Roles", - "type": "array" - }, - "run_once": { - "$ref": "#/$defs/templated-boolean", - "title": "Run Once" - }, - "serial": { - "anyOf": [ - { - "type": "integer" - }, - { - "pattern": "^\\d+\\.?\\d*%?$", - "type": "string" - }, - { - "items": { - "anyOf": [ - { - "type": "integer" - }, - { - "pattern": "^\\d+\\.?\\d*%?$", - "type": "string" - } - ] - }, - "type": "array" - } - ], - "markdownDescription": "Integer, percentage or list of those. See [Setting the batch size with serial](https://docs.ansible.com/ansible/latest/user_guide/playbooks_strategies.html#setting-the-batch-size-with-serial)", - "title": "Batch size" - }, - "strategy": { - "title": "Strategy", - "type": "string" - }, - "tags": { - "anyOf": [ - { - "type": "string" - }, - { - "items": { - "type": "string" - }, - "type": "array" - } - ], - "title": "Tags" - }, - "tasks": { - "$ref": "#/$defs/tasks" - }, - "throttle": { - "$ref": "#/$defs/templated-integer", - "title": "Throttle" - }, - "timeout": { - "title": "Timeout", - "type": "integer" - }, - "vars": { - "title": "Vars", - "type": "object" - }, - "vars_files": { - "items": { - "type": "string" - }, - "title": "Vars Files", - "type": "array" - }, - "vars_prompt": { - "items": { - "$ref": "#/$defs/vars_prompt" - }, - "markdownDescription": "See [vars_prompt](https://docs.ansible.com/ansible/latest/user_guide/playbooks_prompts.html)", - "title": "vars_prompt", - "type": "array" - }, - "when": { - "$ref": "#/$defs/complex_conditional", - "title": "When" - } - }, - "required": [ - "hosts" - ], - "title": "play", - "type": "object" - }, - "play-role": { - "markdownDescription": "See [roles](https://docs.ansible.com/ansible/latest/user_guide/playbooks_reuse_roles.html#roles)", - "properties": { - "any_errors_fatal": { - "title": "Any Errors Fatal", - "type": "boolean" - }, - "become": { - "$ref": "#/$defs/templated-boolean", - "title": "Become" - }, - "become_exe": { - "title": "Become Exe", - "type": "string" - }, - "become_flags": { - "title": "Become Flags", - "type": "string" - }, - "become_method": { - "$ref": "#/$defs/become_method" - }, - "become_user": { - "title": "Become User", - "type": "string" - }, - "check_mode": { - "$ref": "#/$defs/complex_conditional", - "title": "Check Mode" - }, - "collections": { - "items": { - "type": "string" - }, - "title": "Collections", - "type": "array" - }, - "connection": { - "title": "Connection", - "type": "string" - }, - "debugger": { - "title": "Debugger", - "type": "string" - }, - "delegate_to": { - "title": "Delegate To", - "type": "string" - }, - "diff": { - "title": "Diff", - "type": "boolean" - }, - "environment": { - "$ref": "#/$defs/environment" - }, - "ignore_errors": { - "$ref": "#/$defs/ignore_errors" - }, - "ignore_unreachable": { - "title": "Ignore Unreachable", - "type": "boolean" - }, - "module_defaults": { - "title": "Module Defaults" - }, - "name": { - "title": "Name", - "type": "string" - }, - "no_log": { - "$ref": "#/$defs/templated-boolean" - }, - "port": { - "title": "Port", - "type": "integer" - }, - "remote_user": { - "title": "Remote User", - "type": "string" - }, - "role": { - "title": "Role", - "type": "string" - }, - "run_once": { - "$ref": "#/$defs/templated-boolean", - "title": "Run Once" - }, - "tags": { - "anyOf": [ - { - "type": "string" - }, - { - "items": { - "type": "string" - }, - "type": "array" - } - ], - "title": "Tags" - }, - "throttle": { - "$ref": "#/$defs/templated-integer", - "title": "Throttle" - }, - "timeout": { - "title": "Timeout", - "type": "integer" - }, - "vars": { - "title": "Vars", - "type": "object" - }, - "when": { - "$ref": "#/$defs/complex_conditional", - "title": "When" - } - }, - "required": [ - "role" - ], - "title": "play-role", - "type": "object" - }, - "playbook": { - "examples": [ - "playbooks/*.yml", - "playbooks/*.yaml" - ], - "items": { - "oneOf": [ - { - "$ref": "#/$defs/ansible.builtin.import_playbook" - }, - { - "$ref": "#/$defs/play" - } - ] - }, - "title": "Ansible Playbook", - "type": "array" - }, "task": { "additionalProperties": true, "not": { @@ -927,28 +486,6 @@ "title": "task", "type": "object" }, - "tasks": { - "$schema": "http://json-schema.org/draft-07/schema", - "examples": [ - "tasks/*.yml", - "handlers/*.yml" - ], - "items": { - "anyOf": [ - { - "$ref": "#/$defs/task" - }, - { - "$ref": "#/$defs/block" - } - ] - }, - "title": "Ansible Tasks Schema", - "type": [ - "array", - "null" - ] - }, "templated-boolean": { "oneOf": [ { @@ -981,65 +518,6 @@ "type": "string" } ] - }, - "vars_prompt": { - "additionalProperties": false, - "properties": { - "confirm": { - "title": "Confirm", - "type": "boolean" - }, - "default": { - "title": "Default", - "type": "string" - }, - "encrypt": { - "enum": [ - "des_crypt", - "bsdi_crypt", - "bigcrypt", - "crypt16", - "md5_crypt", - "bcrypt", - "sha1_crypt", - "sun_md5_crypt", - "sha256_crypt", - "sha512_crypt", - "apr_md5_crypt", - "phpass", - "pbkdf2_digest", - "cta_pbkdf2_sha1", - "dlitz_pbkdf2_sha1", - "scram", - "bsd_nthash" - ], - "title": "Encrypt", - "type": "string" - }, - "name": { - "title": "Name", - "type": "string" - }, - "private": { - "default": true, - "title": "Private", - "type": "boolean" - }, - "prompt": { - "title": "Prompt", - "type": "string" - }, - "salt_size": { - "default": 8, - "title": "Salt Size", - "type": "integer" - } - }, - "required": [ - "name", - "prompt" - ], - "type": "object" } }, "$id": "https://raw.githubusercontent.com/ansible/schemas/main/f/ansible-tasks.json", diff --git a/test/eco/debops.result b/test/eco/debops.result index c8a6b1a3f4..e7b66acdf1 100644 --- a/test/eco/debops.result +++ b/test/eco/debops.result @@ -12,7 +12,7 @@ warn_list: # or 'skip_list' to silence them completely STDOUT: -ansible/roles/boxbackup/meta/main.yml:1: schema: Additional properties are not allowed ('pki_authorities', 'pki_certificates', 'pki_private_groups_present', 'pki_realms', 'pki_routes', 'when' were unexpected) (schema[meta]) +ansible/roles/boxbackup/meta/main.yml:1: schema: Additional properties are not allowed ('pki_authorities', 'pki_certificates', 'pki_private_groups_present', 'pki_realms', 'pki_routes' were unexpected) (schema[meta]) ansible/roles/lvm/vars/lvm_config_2.02.168.yml:1: schema: 'global' does not match any of the regexes: '^(?!(False|None|True|and|any_errors_fatal|as|assert|async|await|become|become_exe|become_flags|become_method|become_user|break|check_mode|class|collections|connection|continue|debugger|def|del|diff|elif|else|environment|except|fact_path|finally|for|force_handlers|from|gather_facts|gather_subset|gather_timeout|global|handlers|hosts|if|ignore_errors|ignore_unreachable|import|in|is|lambda|max_fail_percentage|module_defaults|name|no_log|nonlocal|not|or|order|pass|port|post_tasks|pre_tasks|raise|remote_user|return|roles|run_once|serial|strategy|tags|tasks|throttle|timeout|try|vars|vars_files|vars_prompt|while|with|yield)$)[\\w]*$' (schema[vars]) ansible/roles/lvm/vars/lvm_config_debian_stretch.yml:1: schema: 'global' does not match any of the regexes: '^(?!(False|None|True|and|any_errors_fatal|as|assert|async|await|become|become_exe|become_flags|become_method|become_user|break|check_mode|class|collections|connection|continue|debugger|def|del|diff|elif|else|environment|except|fact_path|finally|for|force_handlers|from|gather_facts|gather_subset|gather_timeout|global|handlers|hosts|if|ignore_errors|ignore_unreachable|import|in|is|lambda|max_fail_percentage|module_defaults|name|no_log|nonlocal|not|or|order|pass|port|post_tasks|pre_tasks|raise|remote_user|return|roles|run_once|serial|strategy|tags|tasks|throttle|timeout|try|vars|vars_files|vars_prompt|while|with|yield)$)[\\w]*$' (schema[vars]) ansible/roles/rails_deploy/meta/main.yml:1: schema: Additional properties are not allowed ('apt_preferences__dependent_list' was unexpected) (schema[meta]) diff --git a/test/eco/zuul-jobs.result b/test/eco/zuul-jobs.result index 0de847f23e..d9805b5b99 100644 --- a/test/eco/zuul-jobs.result +++ b/test/eco/zuul-jobs.result @@ -13,7 +13,7 @@ INFO Discovered files to lint using: git ls-files --cached --others --exclud INFO Excluded removed files using: git ls-files --deleted -z INFO Discovered files to lint using: git ls-files --cached --others --exclude-standard -z INFO Excluded removed files using: git ls-files --deleted -z -WARNING Listing 66 violation(s) that are fatal +WARNING Listing 61 violation(s) that are fatal You can skip specific rules or tags by adding them to your configuration file: # .config/ansible-lint.yml warn_list: # or 'skip_list' to silence them completely @@ -35,7 +35,7 @@ roles/ensure-chart-testing/tasks/main.yaml:27: risky-file-permissions: File perm roles/ensure-dhall/tasks/main.yaml:15: risky-file-permissions: File permissions unset or incorrect. roles/ensure-go/tasks/install-go.yaml:12: risky-file-permissions: File permissions unset or incorrect. roles/ensure-haskell-stack/tasks/main.yaml:11: unnamed-task: All tasks should be named. -roles/ensure-kubernetes/tasks/minikube.yaml:1: schema: False is not of type 'string' (schema[tasks]) +roles/ensure-kubernetes/tasks/minikube.yaml:1: schema: True is not of type 'string' (schema[tasks]) roles/ensure-nimble/tasks/main.yaml:1: schema: 1 is not of type 'string' (schema[tasks]) roles/ensure-nimble/tasks/main.yaml:14: unnamed-task: All tasks should be named. roles/ensure-packer/tasks/install-packer.yaml:21: risky-file-permissions: File permissions unset or incorrect. @@ -70,15 +70,10 @@ roles/tox/tasks/main.yaml:39: unnamed-task: All tasks should be named. roles/trigger-readthedocs/tasks/main.yaml:11: unnamed-task: All tasks should be named. roles/trigger-readthedocs/tasks/main.yaml:30: unnamed-task: All tasks should be named. roles/upload-git-mirror/tasks/main.yaml:1: unnamed-task: All tasks should be named. -roles/upload-logs-azure/meta/main.yaml:1: schema: {'dependencies': [{'role': 'upload-logs-base'}]} is not of type 'null' (schema[meta]) roles/upload-logs-azure/tasks/main.yaml:7: unnamed-task: All tasks should be named. -roles/upload-logs-gcs/meta/main.yaml:1: schema: {'dependencies': [{'role': 'upload-logs-base'}]} is not of type 'null' (schema[meta]) roles/upload-logs-gcs/tasks/main.yaml:7: unnamed-task: All tasks should be named. -roles/upload-logs-ibm/meta/main.yaml:1: schema: {'dependencies': [{'role': 'upload-logs-base'}]} is not of type 'null' (schema[meta]) roles/upload-logs-ibm/tasks/main.yaml:7: unnamed-task: All tasks should be named. -roles/upload-logs-s3/meta/main.yaml:1: schema: {'dependencies': [{'role': 'upload-logs-base'}]} is not of type 'null' (schema[meta]) roles/upload-logs-s3/tasks/main.yaml:7: unnamed-task: All tasks should be named. -roles/upload-logs-swift/meta/main.yaml:1: schema: {'dependencies': [{'role': 'upload-logs-base'}]} is not of type 'null' (schema[meta]) roles/upload-logs-swift/tasks/main.yaml:7: unnamed-task: All tasks should be named. roles/upload-logs-swift/tasks/main.yaml:33: unnamed-task: All tasks should be named. roles/upload-logs/tasks/main.yaml:6: unnamed-task: All tasks should be named.