Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

Did something change recently? #20

Closed
johnpetersjr opened this issue Apr 3, 2020 · 9 comments
Closed

Did something change recently? #20

johnpetersjr opened this issue Apr 3, 2020 · 9 comments

Comments

@johnpetersjr
Copy link

johnpetersjr commented Apr 3, 2020

Been using this for a while, and now suddenly today getting this error on ansible lint checks during my GitHub action check:

+ ansible-lint -v --force-color '' 'devel/my_yaml_file.yml'
Traceback (most recent call last):
  File "/usr/local/bin/ansible-lint", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.8/site-packages/ansiblelint/__main__.py", line 187, in main
    matches.extend(runner.run())
  File "/usr/local/lib/python3.8/site-packages/ansiblelint/__init__.py", line 263, in run
    files.append({'path': ansiblelint.utils.normpath(playbook[0]), 'type': playbook[1]})
  File "/usr/local/lib/python3.8/site-packages/ansiblelint/utils.py", line 725, in normpath
    return os.path.relpath(str(path))
  File "/usr/local/lib/python3.8/posixpath.py", line 453, in relpath
    raise ValueError("no path specified")
ValueError: no path specified
@johnpetersjr
Copy link
Author

johnpetersjr commented Apr 3, 2020

Here's my workflow:

---
name: Ansible Lint
on: [pull_request]
jobs:
  linting_check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Lint Ansible Playbook
        uses: ansible/ansible-lint-action@master
        with:
          targets: |
            devel/my_yaml_file.yml

@webknjaz
Copy link
Member

webknjaz commented Apr 3, 2020

Yeah, I think it may be related to ce0c313#diff-b958f585a04af5ee2087610ea7180f34R86.

/cc @xunholy ^

@DO1JLR
Copy link
Contributor

DO1JLR commented Apr 3, 2020

I already mentioned something like that at #17 (comment)

The problem here is the quoted empty "$opts" variable.

@DO1JLR
Copy link
Contributor

DO1JLR commented Apr 3, 2020

And @webknjaz and @xunholy talked about it here: #17 (comment)

DO1JLR added a commit to DO1JLR/ansible-lint-action that referenced this issue Apr 3, 2020
Why should we pass some arguments with quotations and other arguments without?

I removed the quotations from ``"$opts"`` to resolve a broken command if the opts variable is empty.

There was a discussion about this in [PR17](ansible#17 (comment))

This will probably Resolve Issue ansible#20
@johnpetersjr
Copy link
Author

Seems like now when I specify targets, it is not finding my target playbook.

Strange. Let me try and figure it out.

@webknjaz
Copy link
Member

webknjaz commented Apr 3, 2020

I'm pretty sure it's the same issue. Those quotes would need to be reverted too.

webknjaz added a commit that referenced this issue Apr 3, 2020
@webknjaz
Copy link
Member

webknjaz commented Apr 3, 2020

Reverted.

@johnpetersjr
Copy link
Author

Same thing is happening with opts as well.

+ args=("$@")
+ '[' /entrypoint.sh = /entrypoint.sh ']'
+ echo -E '\nRunning Ansible Lint...\n'
\nRunning Ansible Lint...\n
+ ansible::lint '-x 204'
+ : 'my_yaml_file.yml
'
+ : /github/workspace
+ pushd /github/workspace
+ local opts
++ parse_args '-x 204'
++ local opts=
++ ((  1  ))
++ case "$1" in
++ echo 'ERROR: Unsupported flag: '\''-x 204'\'''
ERROR: Unsupported flag: '-x 204'
++ exit 1
+ opts=
/github/workspace /github/workspace

@vvarga007
Copy link

Same thing is happening with opts as well.

+ args=("$@")
+ '[' /entrypoint.sh = /entrypoint.sh ']'
+ echo -E '\nRunning Ansible Lint...\n'
\nRunning Ansible Lint...\n
+ ansible::lint '-x 204'
+ : 'my_yaml_file.yml
'
+ : /github/workspace
+ pushd /github/workspace
+ local opts
++ parse_args '-x 204'
++ local opts=
++ ((  1  ))
++ case "$1" in
++ echo 'ERROR: Unsupported flag: '\''-x 204'\'''
ERROR: Unsupported flag: '-x 204'
++ exit 1
+ opts=
/github/workspace /github/workspace

That is because of this commit:
54851ed

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants