Esempio n. 1
0
                  [Error(None, "Host vars are generally "
                         "not required")])


def noop(candidate, settings):
    return Result(candidate.path)


rolesfile_should_be_in_yaml = Standard(
    dict(name="Roles file should be in yaml format",
         check=yamlrolesfile,
         types=["rolesfile"]))

role_must_contain_meta_main = Standard(
    dict(name="Roles must contain suitable meta/main.yml",
         check=lintcheck('EXTRA0012'),
         types=["meta"]))

role_meta_main_must_contain_info = Standard(
    dict(name="Roles meta/main.yml must contain important info",
         check=lintcheck('EXTRA0013'),
         types=["meta"]))

variables_should_contain_whitespace = Standard(
    dict(name="Variable uses should contain whitespace",
         check=lintcheck('EXTRA0001'),
         types=[
             "playbook", "task", "handler", "rolevars", "hostvars",
             "groupvars", "template"
         ]))
Esempio n. 2
0
from ansiblereview import Standard, Result, Error, lintcheck
from ansiblereview.groupvars import same_variable_defined_in_competing_groups


def check_fail(candidate, settings):
    return Result(candidate, [Error(1, "test failed")])


def check_success(candidate, settings):
    return Result(candidate)


test_task_ansiblelint_success = Standard(
    dict(check=lintcheck('TEST0002'),
         name="Test task lint success",
         version="0.2",
         types=["playbook", "tasks", "handlers"]))

test_task_ansiblelint_failure = Standard(
    dict(check=lintcheck('TEST0001'),
         name="Test task lint failure",
         version="0.4",
         types=["playbook", "tasks", "handlers"]))

test_failure = Standard(
    dict(check=check_fail,
         name="Test general failure",
         version="0.5",
         types=[
             "playbook", "task", "handler", "rolevars", "hostvars",
             "groupvars", "meta"
Esempio n. 3
0
                  [Error(None, "Host vars are generally not required")])


rolesfile_should_be_in_yaml = Standard(
    dict(name="Roles file should be in yaml format",
         check=yamlrolesfile,
         types=["rolesfile"]))

role_must_contain_meta_main = Standard(
    dict(name="Roles must contain suitable meta/main.yml",
         check=metamain,
         types=["meta"]))

commands_should_be_idempotent = Standard(
    dict(name="Commands should be idempotent",
         check=lintcheck('ANSIBLE0012'),
         types=["playbook", "task"]))

commands_should_not_be_used_in_place_of_modules = Standard(
    dict(name="Commands should not be used in place of modules",
         check=lintcheck('ANSIBLE0006,ANSIBLE0007'),
         types=["playbook", "task", "handler"]))

package_installs_should_not_use_latest = Standard(
    dict(name="Package installs should use present, not latest",
         check=lintcheck('ANSIBLE0010'),
         types=["playbook", "task", "handler"]))

use_shell_only_when_necessary = Standard(
    dict(name="Shell should only be used when essential",
         check=lintcheck('ANSIBLE0013'),
Esempio n. 4
0
from ansiblereview import Standard, Result, Error, lintcheck


def check_fail(candidate, settings):
    return Result(candidate,[Error(1, "test failed")])


def check_success(candidate, settings):
    return Result(candidate)

test_task_ansiblelint_success = Standard(dict(
    check = lintcheck('TEST0002'),
    name = "Test task lint success",
    version = "0.2",
    types = ["playbook", "tasks", "handlers"]
))

test_task_ansiblelint_failure = Standard(dict(
    check = lintcheck('TEST0001'),
    name = "Test task lint failure",
    version = "0.4",
    types = ["playbook", "tasks", "handlers"]
))

test_failure = Standard(dict(
    check = check_fail,
    name = "Test general failure",
    version = "0.5",
    types=["playbook", "task", "handler", "rolevars",
           "hostvars", "groupvars", "meta"]
))
Esempio n. 5
0
rolesfile_should_be_in_yaml = Standard(dict(
    name="Roles file should be in yaml format",
    check=yamlrolesfile,
    types=["rolesfile"]
))

role_must_contain_meta_main = Standard(dict(
    name="Roles must contain suitable meta/main.yml",
    check=metamain,
    types=["meta"]
))

commands_should_be_idempotent = Standard(dict(
    name="Commands should be idempotent",
    check=lintcheck('ANSIBLE0012'),
    types=["playbook", "task"]
))

commands_should_not_be_used_in_place_of_modules = Standard(dict(
    name="Commands should not be used in place of modules",
    check=lintcheck('ANSIBLE0006,ANSIBLE0007'),
    types=["playbook", "task", "handler"]
))

package_installs_should_not_use_latest = Standard(dict(
    name="Package installs should use present, not latest",
    check=lintcheck('ANSIBLE0010'),
    types=["playbook", "task", "handler"]
))