mirror of
https://github.com/thegeeklab/ansible-later.git
synced 2024-11-22 04:40:42 +00:00
feat: add rule CheckLocalAction
This commit is contained in:
parent
3bcfb4852e
commit
273b32a200
22
ansiblelater/rules/CheckLocalAction.py
Normal file
22
ansiblelater/rules/CheckLocalAction.py
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
# Copyright (c) 2016, Tsukinowa Inc. <info@tsukinowa.jp>
|
||||||
|
# Copyright (c) 2018, Ansible Project
|
||||||
|
from ansiblelater.standard import StandardBase
|
||||||
|
|
||||||
|
|
||||||
|
class CheckLocalAction(StandardBase):
|
||||||
|
|
||||||
|
sid = "ANSIBLE0024"
|
||||||
|
description = "Don't use local_action"
|
||||||
|
helptext = ("`delegate_to: localhost` should be used instead of `local_action`")
|
||||||
|
version = "0.2"
|
||||||
|
types = ["playbook", "task", "handler"]
|
||||||
|
|
||||||
|
def check(self, candidate, settings):
|
||||||
|
yamllines, errors = self.get_normalized_yaml(candidate, settings)
|
||||||
|
|
||||||
|
if not errors:
|
||||||
|
for i, line in yamllines:
|
||||||
|
if 'local_action' in line:
|
||||||
|
errors.append(self.Error(i, self.helptext))
|
||||||
|
|
||||||
|
return self.Result(candidate.path, errors)
|
@ -38,3 +38,4 @@ Reviews are nothing without some rules or standards against which to review. ans
|
|||||||
| CheckMetaChangeFromDefault | ANSIBLE0021 | Roles meta/main.yml default values should be changed. | |
|
| CheckMetaChangeFromDefault | ANSIBLE0021 | Roles meta/main.yml default values should be changed. | |
|
||||||
| CheckWhenFormat | ANSIBLE0022 | Don't use Jinja2 in `when`. | |
|
| CheckWhenFormat | ANSIBLE0022 | Don't use Jinja2 in `when`. | |
|
||||||
| CheckNestedJinja | ANSIBLE0023 | Don't use nested Jinja2 pattern. | |
|
| CheckNestedJinja | ANSIBLE0023 | Don't use nested Jinja2 pattern. | |
|
||||||
|
| CheckLocalAction | ANSIBLE0024 | Don't use local_action. | |
|
||||||
|
Loading…
Reference in New Issue
Block a user