question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

proposal: a newly created role should always pass linting

See original GitHub issue

Currently if you create a role with molecule it will fail to pass linting because some default fields do still have their original settings.

molecule init role -d vagrant -r test-vagrant

In order to improve the UX we need to find a way to avoid these errors. Also this would allow us to perform a full integration testing on molecule CI, where we validate that user can successfully run all commands on newly created roles.

--> Executing Ansible Lint on /root/rdo/molecule/test-vagrant/molecule/default/playbook.yml...
    [701] Role info should contain platforms
    /root/rdo/molecule/test-vagrant/meta/main.yml:1
    {'meta/main.yml': {'skipped_rules': [], '__file__': u'/root/rdo/molecule/test-vagrant/meta/main.yml', u'dependencies': [], u'galaxy_info': {u'description': u'your description', u'license': u'license (GPLv2, CC-BY, etc)', u'author': u'your name', u'company': u'your company (optional)', u'galaxy_tags': [], '__line__': 2, '__file__': u'/root/rdo/molecule/test-vagrant/meta/main.yml', u'min_ansible_version': 1.2}, '__line__': 1}}

    [703] Should change default metadata: author
    /root/rdo/molecule/test-vagrant/meta/main.yml:1
    {'meta/main.yml': {'skipped_rules': [], '__file__': u'/root/rdo/molecule/test-vagrant/meta/main.yml', u'dependencies': [], u'galaxy_info': {u'description': u'your description', u'license': u'license (GPLv2, CC-BY, etc)', u'author': u'your name', u'company': u'your company (optional)', u'galaxy_tags': [], '__line__': 2, '__file__': u'/root/rdo/molecule/test-vagrant/meta/main.yml', u'min_ansible_version': 1.2}, '__line__': 1}}

    [703] Should change default metadata: description
    /root/rdo/molecule/test-vagrant/meta/main.yml:1
    {'meta/main.yml': {'skipped_rules': [], '__file__': u'/root/rdo/molecule/test-vagrant/meta/main.yml', u'dependencies': [], u'galaxy_info': {u'description': u'your description', u'license': u'license (GPLv2, CC-BY, etc)', u'author': u'your name', u'company': u'your company (optional)', u'galaxy_tags': [], '__line__': 2, '__file__': u'/root/rdo/molecule/test-vagrant/meta/main.yml', u'min_ansible_version': 1.2}, '__line__': 1}}

    [703] Should change default metadata: company
    /root/rdo/molecule/test-vagrant/meta/main.yml:1
    {'meta/main.yml': {'skipped_rules': [], '__file__': u'/root/rdo/molecule/test-vagrant/meta/main.yml', u'dependencies': [], u'galaxy_info': {u'description': u'your description', u'license': u'license (GPLv2, CC-BY, etc)', u'author': u'your name', u'company': u'your company (optional)', u'galaxy_tags': [], '__line__': 2, '__file__': u'/root/rdo/molecule/test-vagrant/meta/main.yml', u'min_ansible_version': 1.2}, '__line__': 1}}

    [703] Should change default metadata: license
    /root/rdo/molecule/test-vagrant/meta/main.yml:1
    {'meta/main.yml': {'skipped_rules': [], '__file__': u'/root/rdo/molecule/test-vagrant/meta/main.yml', u'dependencies': [], u'galaxy_info': {u'description': u'your description', u'license': u'license (GPLv2, CC-BY, etc)', u'author': u'your name', u'company': u'your company (optional)', u'galaxy_tags': [], '__line__': 2, '__file__': u'/root/rdo/molecule/test-vagrant/meta/main.yml', u'min_ansible_version': 1.2}, '__line__': 1}}

Ideas:

  • Get default user from git config user.name
  • Get default email from git config user.email
  • Default to an MIT license.
  • Default to no company
  • Find a simple and popular platform to include by default

Open questions:

  • Can we avoid adding a configuration file for molecule?
  • How could user define new defaults for license and company (we want to avoid adding new cli arguments)
  • What to do if git is not configured yet with user.name and user.email?
  • Would it be acceptable to piggy-back git configuration for fields that have not meaning for git?:
git config user.company "Red Hat"
git config user.license "MIT"

This could be handy for us as we could avoid having to create a new config file.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
ssbarneacommented, Apr 7, 2020

Fixed long time ago.

0reactions
ssbarneacommented, Sep 30, 2019

There is now a PR for removal of cookiecutter role template from molecule and use galaxy init. See https://github.com/ansible/molecule/pull/2342

Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Create and Pitch a New Position: Tips and Example
The proposed position should address this challenge in a direct and measurable way. Prove to your boss that the job will provide significant ......
Read more >
Externalize linting from molecule v3 · Issue #2293 - GitHub
This approach will assure that newly created roles will be tested very well. I propose this because orchestrating linters is a never ending ......
Read more >
Lint Code: What Is Linting + When To Use Lint Tools | Perforce
Linting is the process of checking code for programmatic and stylistic errors. ... Static Code Analyzers; Go Beyond Lint Code Checking.
Read more >
Creating a New Role at Work (and Avoiding Common Mistakes)
Create a business plan or proposal for the new position. Ask the following questions: What skills and core competencies do they need to...
Read more >
How to ensure your success in a newly created role - Viewpoint
With the world of work rapidly changing, new roles are being created constantly. Here are 7 ways to ensure success in a brand...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found