Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .config/dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ pkgs
placefolder
pluggy
pluginmanager
pmrun
podman
portchannel
prerun
Expand Down Expand Up @@ -313,6 +314,7 @@ sdist
sdists
sectionauthor
seealso
sesu
setenv
setuptools
shortdesc
Expand All @@ -339,6 +341,7 @@ subschema
subschemas
substrs
subtest
sudosu
superfences
supervisorctl
swdepot
Expand Down
2 changes: 1 addition & 1 deletion src/ansiblelint/schemas/__store__.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"url": "https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/changelog.json"
},
"execution-environment": {
"etag": "fb343322c706fe2a571adf4f33e01a4bc86dc1d4ec548c22911eb116ccb355de",
"etag": "f3abb1716134227ccd667607840dd7bdebfd02a8980603df031282126dc78264",
"url": "https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/execution-environment.json"
},
"galaxy": {
Expand Down
29 changes: 18 additions & 11 deletions src/ansiblelint/schemas/ansible.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,26 +41,33 @@
"type": "object"
},
"become_method": {
"markdownDescription": "See [become](https://docs.ansible.com/ansible/latest/user_guide/become.html)",
"oneOf": [
"anyOf": [
{
"enum": [
"sudo",
"su",
"pbrun",
"pfexec",
"runas",
"dzdo",
"ksu",
"doas",
"machinectl"
"ansible.builtin.sudo",
"ansible.builtin.su",
"community.general.pbrun",
"community.general.pfexec",
"ansible.builtin.runas",
"community.general.dzdo",
"community.general.ksu",
"community.general.doas",
"community.general.machinectl",
"community.general.pmrun",
"community.general.sesu",
"community.general.sudosu"
],
"type": "string"
},
{
"$ref": "#/$defs/full-jinja"
},
{
"pattern": "[A-Za-z0-9_\\.]+",
"type": "string"
}
],
"markdownDescription": "See [become](https://docs.ansible.com/ansible/latest/user_guide/become.html)",
"title": "Become Method"
},
"block": {
Expand Down
29 changes: 18 additions & 11 deletions src/ansiblelint/schemas/playbook.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,26 +50,33 @@
"type": "object"
},
"become_method": {
"markdownDescription": "See [become](https://docs.ansible.com/ansible/latest/user_guide/become.html)",
"oneOf": [
"anyOf": [
{
"enum": [
"sudo",
"su",
"pbrun",
"pfexec",
"runas",
"dzdo",
"ksu",
"doas",
"machinectl"
"ansible.builtin.sudo",
"ansible.builtin.su",
"community.general.pbrun",
"community.general.pfexec",
"ansible.builtin.runas",
"community.general.dzdo",
"community.general.ksu",
"community.general.doas",
"community.general.machinectl",
"community.general.pmrun",
"community.general.sesu",
"community.general.sudosu"
],
"type": "string"
},
{
"$ref": "#/$defs/full-jinja"
},
{
"pattern": "[A-Za-z0-9_\\.]+",
"type": "string"
}
],
"markdownDescription": "See [become](https://docs.ansible.com/ansible/latest/user_guide/become.html)",
"title": "Become Method"
},
"block": {
Expand Down
29 changes: 18 additions & 11 deletions src/ansiblelint/schemas/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,33 @@
"$comment": "Generated from ansible.json, do not edit.",
"$defs": {
"become_method": {
"markdownDescription": "See [become](https://docs.ansible.com/ansible/latest/user_guide/become.html)",
"oneOf": [
"anyOf": [
{
"enum": [
"sudo",
"su",
"pbrun",
"pfexec",
"runas",
"dzdo",
"ksu",
"doas",
"machinectl"
"ansible.builtin.sudo",
"ansible.builtin.su",
"community.general.pbrun",
"community.general.pfexec",
"ansible.builtin.runas",
"community.general.dzdo",
"community.general.ksu",
"community.general.doas",
"community.general.machinectl",
"community.general.pmrun",
"community.general.sesu",
"community.general.sudosu"
],
"type": "string"
},
{
"$ref": "#/$defs/full-jinja"
},
{
"pattern": "[A-Za-z0-9_\\.]+",
"type": "string"
}
],
"markdownDescription": "See [become](https://docs.ansible.com/ansible/latest/user_guide/become.html)",
"title": "Become Method"
},
"block": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- command: echo 123
vars:
sudo_var: doo
become_method: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
# ajv errors

```json
[
{
"instancePath": "/0",
"keyword": "required",
"message": "must have required property 'block'",
"params": {
"missingProperty": "block"
},
"schemaPath": "#/required"
},
{
"instancePath": "/0/become_method",
"keyword": "type",
"message": "must be string",
"params": {
"type": "string"
},
"schemaPath": "#/anyOf/0/type"
},
{
"instancePath": "/0/become_method",
"keyword": "enum",
"message": "must be equal to one of the allowed values",
"params": {
"allowedValues": [
"ansible.builtin.sudo",
"ansible.builtin.su",
"community.general.pbrun",
"community.general.pfexec",
"ansible.builtin.runas",
"community.general.dzdo",
"community.general.ksu",
"community.general.doas",
"community.general.machinectl",
"community.general.pmrun",
"community.general.sesu",
"community.general.sudosu"
]
},
"schemaPath": "#/anyOf/0/enum"
},
{
"instancePath": "/0/become_method",
"keyword": "type",
"message": "must be string",
"params": {
"type": "string"
},
"schemaPath": "#/$defs/full-jinja/type"
},
{
"instancePath": "/0/become_method",
"keyword": "type",
"message": "must be string",
"params": {
"type": "string"
},
"schemaPath": "#/anyOf/2/type"
},
{
"instancePath": "/0/become_method",
"keyword": "anyOf",
"message": "must match a schema in anyOf",
"params": {},
"schemaPath": "#/anyOf"
},
{
"instancePath": "/0/become_method",
"keyword": "type",
"message": "must be string",
"params": {
"type": "string"
},
"schemaPath": "#/anyOf/0/type"
},
{
"instancePath": "/0/become_method",
"keyword": "enum",
"message": "must be equal to one of the allowed values",
"params": {
"allowedValues": [
"ansible.builtin.sudo",
"ansible.builtin.su",
"community.general.pbrun",
"community.general.pfexec",
"ansible.builtin.runas",
"community.general.dzdo",
"community.general.ksu",
"community.general.doas",
"community.general.machinectl",
"community.general.pmrun",
"community.general.sesu",
"community.general.sudosu"
]
},
"schemaPath": "#/anyOf/0/enum"
},
{
"instancePath": "/0/become_method",
"keyword": "type",
"message": "must be string",
"params": {
"type": "string"
},
"schemaPath": "#/$defs/full-jinja/type"
},
{
"instancePath": "/0/become_method",
"keyword": "type",
"message": "must be string",
"params": {
"type": "string"
},
"schemaPath": "#/anyOf/2/type"
},
{
"instancePath": "/0/become_method",
"keyword": "anyOf",
"message": "must match a schema in anyOf",
"params": {},
"schemaPath": "#/anyOf"
},
{
"instancePath": "/0",
"keyword": "anyOf",
"message": "must match a schema in anyOf",
"params": {},
"schemaPath": "#/items/anyOf"
}
]
```

# check-jsonschema

stdout:

```json
{
"status": "fail",
"errors": [
{
"filename": "negative_test/playbooks/tasks/become_method_invalid.yml",
"path": "$[0]",
"message": "{'command': 'echo 123', 'vars': {'sudo_var': 'doo'}, 'become_method': True} is not valid under any of the given schemas",
"has_sub_errors": true,
"best_match": {
"path": "$[0]",
"message": "'block' is a required property"
},
"sub_errors": [
{
"path": "$[0].become_method",
"message": "True is not valid under any of the given schemas"
},
{
"path": "$[0].become_method",
"message": "True is not one of ['ansible.builtin.sudo', 'ansible.builtin.su', 'community.general.pbrun', 'community.general.pfexec', 'ansible.builtin.runas', 'community.general.dzdo', 'community.general.ksu', 'community.general.doas', 'community.general.machinectl', 'community.general.pmrun', 'community.general.sesu', 'community.general.sudosu']"
},
{
"path": "$[0].become_method",
"message": "True is not of type 'string'"
},
{
"path": "$[0].become_method",
"message": "True is not of type 'string'"
},
{
"path": "$[0].become_method",
"message": "True is not of type 'string'"
},
{
"path": "$[0]",
"message": "'block' is a required property"
},
{
"path": "$[0].become_method",
"message": "True is not valid under any of the given schemas"
},
{
"path": "$[0].become_method",
"message": "True is not one of ['ansible.builtin.sudo', 'ansible.builtin.su', 'community.general.pbrun', 'community.general.pfexec', 'ansible.builtin.runas', 'community.general.dzdo', 'community.general.ksu', 'community.general.doas', 'community.general.machinectl', 'community.general.pmrun', 'community.general.sesu', 'community.general.sudosu']"
},
{
"path": "$[0].become_method",
"message": "True is not of type 'string'"
},
{
"path": "$[0].become_method",
"message": "True is not of type 'string'"
},
{
"path": "$[0].become_method",
"message": "True is not of type 'string'"
}
]
}
],
"parse_errors": []
}
```

This file was deleted.

Loading