Role name openstack-operations does not match `^[a-z][a-z0-9_]+$` pattern

Bug #1917938 reported by John Fulton
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tripleo
Fix Released
Medium
Juan Badia Payno

Bug Description

Running `tox -e linters` inside of tripleo-ansible produces the following error. This wastes developer time because the Ansible-lint test always fails and we need to check if it's just the error below or something wrong with our code. The error below fails ansible lint and should just be fixed.

../../../usr/share/ansible/roles/openstack-operations/tasks/backup_filesystem.yml:1: [E710] Role name openstack-operations does not match `^[a-z][a-z0-9_]+$` pattern
You can skip specific rules or tags by adding them to your configuration file:

┌──────────────────────────────────────────────────────────────────────────────┐
│ # .ansible-lint │
│ warn_list: # or 'skip_list' to silence them completely │
│ - '710' # Role name {} does not match `^[a-z][a-z0-9_]+$` pattern │
└──────────────────────────────────────────────────────────────────────────────┘

bashate..................................................................Passed
ERROR: InvocationError for command /home/stack/tripleo-ansible/.tox/linters/bin/python -m pre_commit run -a (exited with code 1)

Revision history for this message
John Fulton (jfulton-org) wrote :

I know renaming files that we recommend to users can be disruptive so we should have a deprecation process for the old name [1]. Doing this before the next major release (W) would be good.

[1] Here are some examples of deprecating old names:

https://review.opendev.org/c/openstack/tripleo-heat-templates/+/772598
https://github.com/openstack/tripleo-ansible/commit/67ce344e30921c3b4c958aa0f7e4b682d3b24ccf

Revision history for this message
Juan Badia Payno (jbadiapa) wrote :

Not sure if I understood correctly.
The problem here is that the openstack-operations role is not correctly named.
The output regarding the backup_filesystem.yml is just because is the first one on the alphabetical order.

I did a little test, I just move the /usr/share/ansible/roles/openstack-operations role to /usr/share/ansible/roles/openstack_operations and there was no lint errors.

My first question is why is ansible-lint testing files outside of the project.
Should we consider removing the use of openstack-operations project or just renaming the project?
- To remove it, there are 3 dependencies:
   tripleo_ansible/playbooks/container-cleanup.yml
   tripleo_ansible/playbooks/fetch-logs.yml
   tripleo_ansible/playbooks/restart-service.yml

Revision history for this message
Juan Badia Payno (jbadiapa) wrote :
Revision history for this message
Marios Andreou (marios-b) wrote :

o/ Juan for me locally this is green where are you seeing the error is it on some review or locally?

[ @192 tripleo-ansible]$ tox -e linters
linters installed: ansible==2.9.18,appdirs==1.4.4,attrs==20.3.0,certifi==2020.12.5,cffi==1.14.5,cfgv==3.2.0,chardet==4.0.0,cryptography==3.4.6,decorator==4.4.2,distlib==0.3.1,dogpile.cache==1.1.2,filelock==3.0.12,identify==2.1.0,idna==2.10,importlib-metadata==3.7.2,iso8601==0.1.14,Jinja2==2.11.3,jmespath==0.10.0,jsonpatch==1.31,jsonpointer==2.0,jsonschema==3.2.0,keystoneauth1==4.3.1,MarkupSafe==1.1.1,metalsmith==1.4.2,munch==2.5.0,netifaces==0.10.9,nodeenv==1.5.0,openstacksdk==0.54.0,os-service-types==1.7.0,pbr==5.5.1,pre-commit==2.11.0,prettytable==2.1.0,pycparser==2.20,pyrsistent==0.17.3,PyYAML==5.4.1,requests==2.25.1,requestsexceptions==1.4.0,six==1.15.0,stevedore==3.3.0,toml==0.10.2,urllib3==1.26.3,virtualenv==20.4.2,wcwidth==0.2.5,zipp==3.4.1
linters run-test-pre: PYTHONHASHSEED='697243374'
linters run-test: commands[0] | pip check
No broken requirements found.
linters run-test: commands[1] | bash -c 'ANSIBLE_ROLES_PATH='"'"' Documents/WORK/NewEclipsey/Github/Tuskar/tripleo-ansible/tripleo_ansible/roles.galaxy'"'"' ansible-galaxy install -fr Documents/WORK/NewEclipsey/Github/Tuskar/tripleo-ansible/tripleo_ansible/ansible-role-requirements.yml'
- changing role openstack-operations from master to master
- extracting openstack-operations to Documents/WORK/NewEclipsey/Github/Tuskar/tripleo-ansible/tripleo_ansible/roles.galaxy/openstack-operations
- openstack-operations (master) was installed successfully
- changing role config_template from master to master
- extracting config_template to /Documents/WORK/NewEclipsey/Github/Tuskar/tripleo-ansible/tripleo_ansible/roles.galaxy/config_template
- config_template (master) was installed successfully
linters run-test: commands[2] | python -m pre_commit run -a
Fix End of Files.........................................................Passed
Trim Trailing Whitespace.................................................Passed
Mixed line ending........................................................Passed
Check for byte-order marker..............................................Passed
Check that executables have shebangs.....................................Passed
Check for merge conflicts................................................Passed
Check for broken symlinks................................................Passed
Debug Statements (Python)................................................Passed
Check Yaml...............................................................Passed
flake8...................................................................Passed
yamllint.................................................................Passed
Ansible-lint.............................................................Passed
bashate..................................................................Passed
_______________________________________ summary ________________________________________
  linters: commands succeeded
  congratulations :)

Revision history for this message
John Fulton (jfulton-org) wrote :

The openstack-operations role [1] does not live in tripleo-ansible [2]. When I originally opened the bug I thought this was limited only to tripleo-ansible but I was mistaken.

Another way to describe this bug is:

 While running linters for tripleo-ansible there's a warning about the openatack-operations name

I suspect CI doesn't hit this because it's dedicated to that repos only while in my local environment where I run it on an undercloud both ansible repos are installed so tripleo-ansible's linter is checkikng more than it should.

[1] https://github.com/openstack/ansible-role-openstack-operations
[2] https://github.com/openstack/tripleo-ansible/tree/master/tripleo_ansible/roles

Changed in tripleo:
milestone: wallaby-3 → wallaby-rc1
Changed in tripleo:
milestone: wallaby-rc1 → xena-1
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tripleo-ansible (master)
Changed in tripleo:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tripleo-ansible (master)

Reviewed: https://review.opendev.org/c/openstack/tripleo-ansible/+/795758
Committed: https://opendev.org/openstack/tripleo-ansible/commit/cb2e3fb290c85079c06a6901692af52fc85d06d1
Submitter: "Zuul (22348)"
Branch: master

commit cb2e3fb290c85079c06a6901692af52fc85d06d1
Author: Juan Badia Payno <email address hidden>
Date: Thu Jun 10 12:22:37 2021 +0200

    Force ansible-lint to check just this repository

    Doing tox -e linterns on the undercloud gives the followig error:

    Ansible-lint...............................................Failed
    - hook id: ansible-lint
    - exit code: 2
    INFO Executing syntax check on tripleo_ansible/playbooks/\
    cli-baremetal-clean.yaml (0.77s)
    WARNING Listing 1 violation(s) that are fatal
    ../../../usr/share/ansible/roles/openstack-operations/tasks/\
    restart_service.yml:1:3: syntax-check couldn't resolve module/action \
    'service_map_facts'. This often indicates a misspelling, missing \
    collection, or incorrect module path.
    You can skip specific rules or tags by adding them to your \
    configuration file:
    warn_list: # or 'skip_list' to silence them completely
      - syntax-check # Ansible syntax check failed

    Finished with 1 failure(s), 0 warning(s) on 1382 files.

    This patch fixes this.

    Closes-Bug: #1917938
    Change-Id: Icf626c77db879f6654ed2c34004b8b67e23258ef

Changed in tripleo:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tripleo-ansible (stable/wallaby)

Fix proposed to branch: stable/wallaby
Review: https://review.opendev.org/c/openstack/tripleo-ansible/+/800178

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tripleo-ansible (stable/wallaby)

Reviewed: https://review.opendev.org/c/openstack/tripleo-ansible/+/800178
Committed: https://opendev.org/openstack/tripleo-ansible/commit/f45bff482e72f7227c6ec2dd13d74b4a80b16fd0
Submitter: "Zuul (22348)"
Branch: stable/wallaby

commit f45bff482e72f7227c6ec2dd13d74b4a80b16fd0
Author: Juan Badia Payno <email address hidden>
Date: Thu Jun 10 12:22:37 2021 +0200

    Force ansible-lint to check just this repository

    Doing tox -e linterns on the undercloud gives the followig error:

    Ansible-lint...............................................Failed
    - hook id: ansible-lint
    - exit code: 2
    INFO Executing syntax check on tripleo_ansible/playbooks/\
    cli-baremetal-clean.yaml (0.77s)
    WARNING Listing 1 violation(s) that are fatal
    ../../../usr/share/ansible/roles/openstack-operations/tasks/\
    restart_service.yml:1:3: syntax-check couldn't resolve module/action \
    'service_map_facts'. This often indicates a misspelling, missing \
    collection, or incorrect module path.
    You can skip specific rules or tags by adding them to your \
    configuration file:
    warn_list: # or 'skip_list' to silence them completely
      - syntax-check # Ansible syntax check failed

    Finished with 1 failure(s), 0 warning(s) on 1382 files.

    This patch fixes this.

    Closes-Bug: #1917938
    Change-Id: Icf626c77db879f6654ed2c34004b8b67e23258ef
    (cherry picked from commit cb2e3fb290c85079c06a6901692af52fc85d06d1)

tags: added: in-stable-wallaby
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/tripleo-ansible 3.3.0

This issue was fixed in the openstack/tripleo-ansible 3.3.0 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/tripleo-ansible 4.1.0

This issue was fixed in the openstack/tripleo-ansible 4.1.0 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.