ansible / ansible-content-parser

Apache License 2.0
3 stars 4 forks source link

AttributeError: 'list' object has no attribute 'split' #30

Closed TamiTakamiya closed 10 months ago

TamiTakamiya commented 10 months ago

ansible-content-parser version: 0.0.7 Description: Executed ansible-content-parser with the following commands:

cd /var/tmp
mkdir test
cd test
python3 -m venv venv
source venv/bin/activate
pip install --upgrade pip
pip install ansible-content-parser
ansible-content-parser --version
ansible-content-parser --skip-ansible-lint https://github.com/ansible/ansible-examples out

and got

(venv) /var/tmp/test $ ansible-content-parser --skip-ansible-lint https://github.com/ansible/ansible-examples out
INFO:pipeline:Running data pipeline
INFO:pipeline:Start scanning for 1 projects (total 327 files)
Traceback (most recent call last):
  File "/var/tmp/test/venv/bin/ansible-content-parser", line 8, in <module>
    sys.exit(main())
  File "/var/tmp/test/venv/lib64/python3.10/site-packages/ansible_content_parser/__main__.py", line 305, in main
    return_code = run_pipeline(args, repository_path)
  File "/var/tmp/test/venv/lib64/python3.10/site-packages/ansible_content_parser/pipeline.py", line 40, in run_pipeline
    dp.run(
  File "/var/tmp/test/venv/lib64/python3.10/site-packages/sage_scan/pipeline.py", line 426, in run
    self._multi_stage_scan(input_list)
  File "/var/tmp/test/venv/lib64/python3.10/site-packages/sage_scan/pipeline.py", line 491, in _multi_stage_scan
    self.scan(start, input_data)
  File "/var/tmp/test/venv/lib64/python3.10/site-packages/sage_scan/pipeline.py", line 757, in scan
    if is_skip_file_obj(ari_obj, tasks, plays):
  File "/var/tmp/test/venv/lib64/python3.10/site-packages/sage_scan/pipeline.py", line 1210, in is_skip_file_obj
    basename = vars_file.split("/")[-1]
AttributeError: 'list' object has no attribute 'split'
TamiTakamiya commented 10 months ago

@hirokuni-kitahara It seems to be an issue of sage-scan. Would you take a look?

TamiTakamiya commented 10 months ago

@hirokuni-kitahara This vars_file block is causing the issue:

  vars_files:

     - "vars/external_vars.yml"

     - [ "vars/{{ facter_operatingsystem }}.yml", "vars/defaults.yml" ]

which seems to be a rare case.

hirokuni-kitahara commented 10 months ago

@TamiTakamiya Thank you. I am fixing this issue in sage-scan to support list item in vars_files. will let you know once it gets available (it should be released as sage-scan=0.0.3)

hirokuni-kitahara commented 10 months ago

@TamiTakamiya Now it has been published in PyPI as sage-scan==0.0.3. Could you please try it? Thank you!

TamiTakamiya commented 10 months ago

@hirokuni-kitahara Thank you! I have successfully verified sage-scan 0.0.3 resolved the issue. Closing the issue.