Giter VIP home page Giter VIP logo

linter-ansible-syntax's People

Contributors

arcanemagus avatar mschuchard avatar walterrowe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

linter-ansible-syntax's Issues

Fails to parse dynamic-inventory

If I include the dynamic inventory script in the settings I'm getting that it failed to parse the inventory file and only implicit localhost is available.
Removing the inventory setting altogether naturally throws a null pointer.
Is there a workaround for this to use this package with dynamic inventories or disable parsing the inventory (if the rest of the functionality is not dependent on this)?

ansible version detect still broken

This is related to issue #7. The version detect is still broken 11 months later.

% /usr/local/bin/ansible-playbook --version
ansible-playbook 2.9.11
  config file = /Users/wrowe/git-repos/examples/ansible.cfg
  configured module search path = ['/Users/wrowe/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/Cellar/ansible/2.9.11/libexec/lib/python3.8/site-packages/ansible
  executable location = /usr/local/bin/ansible-playbook
  python version = 3.8.5 (default, Jul 21 2020, 10:48:26) [Clang 11.0.3 (clang-1103.0.32.62)]

% which ansible-lint                       
/usr/local/bin/ansible-lint
% /usr/local/bin/ansible-lint --version
ansible-lint 4.2.0

% pip3 show ansible
WARNING: Package(s) not found: ansible

% brew info python3
[email protected]: stable 3.8.5 (bottled)
Interpreted, interactive, object-oriented programming language
https://www.python.org/
/usr/local/Cellar/[email protected]/3.8.5 (4,422 files, 68.4MB) *
  Poured from bottle on 2020-07-24 at 11:55:40
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/[email protected]
License: Python-2.0
==> Dependencies
Build: pkg-config ✔
Required: gdbm ✔, [email protected] ✔, readline ✔, sqlite ✔, xz ✔
==> Caveats
Python has been installed as
  /usr/local/bin/python3

Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
  /usr/local/opt/[email protected]/libexec/bin

You can install Python packages with
  pip3 install <package>
They will install into the site-package directory
  /usr/local/lib/python3.8/site-packages

See: https://docs.brew.sh/Homebrew-and-Python

% brew info ansible
ansible: stable 2.9.11 (bottled), HEAD
Automate deployment, configuration, and upgrading
https://www.ansible.com/
/usr/local/Cellar/ansible/2.9.11 (18,085 files, 223MB) *
  Poured from bottle on 2020-08-07 at 09:54:15
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/ansible.rb
License: GPL-3.0
==> Dependencies
Build: pkg-config ✔
Required: libyaml ✔, [email protected] ✔, [email protected] ✔
==> Options
--HEAD
	Install HEAD version

I am using atom.io and ansible on macOS. ansible is installed with brew. I can confirm that the proposed solution in #7 works for me.

Screen Shot 2020-08-07 at 10 00 10 AM

new ansible version issue

Hello,

I've updated the ansible version to ansible 2.2.2.0 and got the following error:

An unexpected error with ansible, ansible-lint, linter-ansible-linting, atom, linter, and/or your playbook, has occurred.
Could you please help me to resolve this issue.

Thanks,

Support for per-project parameters (inventory/roles_path/module_path)

Hi!

I'm loving the idea of having the official ansible-playbook syntax checking as a linter in Atom!

In the current form of the implementation I'm having troubles with making linter-ansible-syntax
work with my many different Ansible projects. All of them have different places for roles, inventories and the like. I realised that this is not a use case for this linter currently.

On the command line this is relatively easy to achieve without having to pass anything but the playbook name to ansible-playbook --check-syntax: As long as the playbook check is executed from within the directory where the playbook resides, an ansible.cfg file in the same folder will be picked up by ansible-playbook.
I'm wondering, could it maybe be a relatively easy way to support a vastly wider range of use cases by having the linter execute ansible-playbook in the folder where the playbook resides? That way ansible-playbook would automatically pick up a possible local ansible.cfg file, which would in turn add support for all the endless things that can be specified in the ansible.cfg to linter-ansible-syntax. This would also be easy to maintain, since no parameters need to be understood or touched by the linter.

But maybe I am missing something here?
I don't have experience with Atom package development but if you would be interested in implementing this, I would be willing to help out - in case you need any help at all 😛

Cheers,
oolongbrothers

Limit linting to only files with a hosts attribute?

  • The Ansible syntax check does not understand how to parse task lists that are included as part of a playbook (including roles) and will display 'attribute' is not a valid attribute for a Play in those instances.

Is there any way to make this more robust? If not then this generally doesn't seem very useful for role-building.

What I'm thinking is, could you only run this may if there's a - hosts: in the file?

detection of ansible version is broken

currently you check for the ansible version being greater than 2.0 as follows:

49 if (/1.\d+.\d+/.exec(output)) {

that does no work when the output of ansible-playbook --version is as follows:

ansible-playbook 2.8.4
config file = None
configured module search path = ['/Users/lfredriksen/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/Cellar/ansible/2.8.4/libexec/lib/python3.7/site-packages/ansible
executable location = /usr/local/bin/ansible-playbook
python version = 3.7.4 (default, Jul 9 2019, 18:13:23) [Clang 10.0.1 (clang-1001.0.46.4)]

because the regex you have will match on clang-1001.0.46

suggest you agment the regex to something like:
if (/ansible-playbook 1.\d+.\d+/.exec(output)) {

Please support source.ansible-advanced

I noticed this package was not linting with ansible-advanced from language-ansible.
There is no mention that this would be the case. Changing to source.ansible got the linter to fire.
If this package supported ansible-advanced syntax that would be best. Thank you.

Not found inventory, roles path

Hello, I have some problems with plugin:

Error Ansible: the role 'nodejs' was not found in /Users/guard/Documents/ansible/server/playbooks/roles:/Users/guard/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles:/Users/guard/Documents/ansible/server/playbooks
Warning Ansible: No inventory was parsed, only implicit localhost is available.
Warning Ansible: provided hosts list is empty, only localhost is available. Note that.

As I understand, plugin don't see my ansible.cfg
Ansible works perfectly (see all roles, hosts)
ansible-lint, ansible-playbook --syntax-check launched from the shell successfully works

project tree

.
├── README.md
├── ansible.cfg
├── env
│   ├── dev
│   │   ├── group_vars
│   │   ├── host_vars
│   │   └── hosts
│   └── prod
│       ├── group_vars
│       ├── host_vars
│       └── hosts
├── playbooks
│   ├── ...
│   ├── nodejs.yml
└── roles
    ├── ...
    └── nodejs
        ├── defaults
        └── tasks

ansible.cfg

[defaults]
inventory = env/dev/hosts
roles_path = roles

my environment

macos: 10.15.1
ansible: 2.9.14
atom: 1.52.0
language-ansible: 0.2.2
linter: 3.1.1
linter-ansible-syntax: 1.3.0

all other plugins disabled for debug

Improved version detect

It is still using the --help option vs --version. The --help option does not provide the version number.

I created a new PR that changes --help to --version, and includes 0 and 1 version check.

Should be bullet proof now.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.