Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix role name handling in prerun.py #1490

Merged
merged 13 commits into from Apr 7, 2021
Merged

Fix role name handling in prerun.py #1490

merged 13 commits into from Apr 7, 2021

Commits on Mar 23, 2021

  1. src/ansiblelint/prerun.py: Fix role name from SCM

    According to
    https://galaxy.ansible.com/docs/contributing/creating_role.html#role-metadata:
    
    "role_name is not used at all if the role is installed using its Git URL.
     Instead, the name of the repo is used."
    
    So, make _install_galaxy_role() respect this to compute the role
    name. To avoid importing ansible galaxy files, the SCM list
    is hardcoded to git or hg.
    
    Signed-off-by: Arnaud Patard <apatard@hupstream.com>
    apatard committed Mar 23, 2021
    Configuration menu
    Copy the full SHA
    9f0c1d5 View commit details
    Browse the repository at this point in the history
  2. src/ansiblelint/prerun.py: Use computed fqrn in _install_galaxy_role()

    _install_galaxy_role() is taking great pain to get and check
    the fqrn, even handling/using the  shortname when the 'role-name'
    check is in skip_list but the code is not using the fqrn value to
    create the symlink in .cache/roles.
    Correct this by using the computed fqrn name for the link name.
    
    Signed-off-by: Arnaud Patard <apatard@hupstream.com>
    apatard committed Mar 23, 2021
    Configuration menu
    Copy the full SHA
    fb390ab View commit details
    Browse the repository at this point in the history

Commits on Mar 24, 2021

  1. playbooks/eco.yml: Change geerlingguy.mysql checkout path

    Change the ansible-role-mysql git clone path to match the role
    fqrn as it's what's used with galaxy and what's currently done
    by the role ci.
    (ref: https://github.com/geerlingguy/ansible-role-mysql/blob/86ffba892e1553b7e6f042ec007eef25daa8f5db/.github/workflows/ci.yml#L21)
    
    Signed-off-by: Arnaud Patard <apatard@hupstream.com>
    apatard committed Mar 24, 2021
    Configuration menu
    Copy the full SHA
    67b94ad View commit details
    Browse the repository at this point in the history

Commits on Mar 25, 2021

  1. Configuration menu
    Copy the full SHA
    32ebbd4 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    cf9d993 View commit details
    Browse the repository at this point in the history

Commits on Mar 30, 2021

  1. src/ansiblelint/prerun.py: Try to handle author name in metadata author

    If the author field in meta/main.yml looks like "John Doe" (at least 2 words
    separated by a space), act as if there was no namespace.
    It's not perfect but it's not possible to match author<->galaxy account
    and there will still be a warning/error issued about it, since
    the fqrn won't match namespace.role_name.
    
    Signed-off-by: Arnaud Patard <apatard@hupstream.com>
    apatard committed Mar 30, 2021
    Configuration menu
    Copy the full SHA
    46c8cdf View commit details
    Browse the repository at this point in the history
  2. src/ansiblelint/prerun.py: Fix role regexp used to strip prefixes

    According to :
    https://galaxy.ansible.com/docs/contributing/creating_role.html#role-metadata:
    
    In the past, Galaxy would apply a regex expression to the GitHub repository
    name and automatically remove 'ansible-' and 'ansible-role-'. For example, if
    your repository name was 'ansible-role-apache', the role name would translate
    to 'apache',
    
    So update the regexp to handle ansible-role- and ansible-
    
    Signed-off-by: Arnaud Patard <apatard@hupstream.com>
    apatard committed Mar 30, 2021
    Configuration menu
    Copy the full SHA
    91b3981 View commit details
    Browse the repository at this point in the history
  3. src/ansiblelint/prerun.py: Fix link name when 'role-name' in skip_list

    If the role-name rule is in skip_list:
    - if role_name is set in meta/main.yml, assume that the author wants
      to use this name, even if it's still not up to standards and set
      the link name to the computed fqrn,
    - if the role_name is not set, just use the current directory name.
      Note: don't use 'role_name' variable here since some part of the
      name has been stripped from the current directory name.
    
    Signed-off-by: Arnaud Patard <apatard@hupstream.com>
    apatard committed Mar 30, 2021
    Configuration menu
    Copy the full SHA
    407393e View commit details
    Browse the repository at this point in the history
  4. src/ansiblelint/prerun.py: split _install_galaxy_role

    Flake8 is complaining that the function is now too complex, so
    split it into several ones.
    
    Signed-off-by: Arnaud Patard <apatard@hupstream.com>
    apatard committed Mar 30, 2021
    Configuration menu
    Copy the full SHA
    1635649 View commit details
    Browse the repository at this point in the history
  5. src/ansiblelint/prerun.py: Make _get_galaxy_role_* return empty string

    Instead of using None for value not found and sometime return
    an empty string make both functions always return a string and
    make it empty is something went wrong.
    
    Signed-off-by: Arnaud Patard <apatard@hupstream.com>
    apatard committed Mar 30, 2021
    Configuration menu
    Copy the full SHA
    5dad14a View commit details
    Browse the repository at this point in the history
  6. src/ansiblelint/prerun.py: Revert "Fix role name from SCM"

    As it may lead to breakages, drop the check on .git or .hg
    presence to get role name.
    
    Signed-off-by: Arnaud Patard <apatard@hupstream.com>
    apatard committed Mar 30, 2021
    Configuration menu
    Copy the full SHA
    8a8624d View commit details
    Browse the repository at this point in the history

Commits on Apr 1, 2021

  1. Configuration menu
    Copy the full SHA
    7daa4b3 View commit details
    Browse the repository at this point in the history

Commits on Apr 7, 2021

  1. Configuration menu
    Copy the full SHA
    dd57f2e View commit details
    Browse the repository at this point in the history