molecule init role my-role-name failed

Created on 15 Apr 2020  路  8Comments  路  Source: ansible-community/molecule

Issue Type

  • Bug report

Molecule and Ansible details

% ansible --version && molecule --version
ansible 2.8.10
  config file = None
  configured module search path = ['/home/shirokih/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/shirokih/.local/lib/python3.6/site-packages/ansible
  executable location = /home/shirokih/.local/bin/ansible
  python version = 3.6.9 (default, Nov  7 2019, 10:44:02) [GCC 8.3.0]
molecule 3.0.3
   ansible==2.8.10 python==3.6

Molecule installation method (one of):

  • pip

Ansible installation method (one of):

  • pip

Detail any linters or test runners used:

Desired Behavior

molecule init role my-role creates diras and finiched with $0

Actual Behaviour

molecule init role my-role
--> Initializing new role my-role...
ERROR: Galaxy failed to create role: Command '['ansible-galaxy', 'init', '-v', '--offline', 'my-role']' returned non-zero exit status 250.: No config file found; using defaults
ERROR! Unexpected Exception, this is probably a bug: no filter named 'comment_ify'
to see the full traceback, use -vvv

because of

% ansible-galaxy init -vvv --offline my-role
ansible-galaxy 2.8.10
  config file = None
  configured module search path = ['/home/shirokih/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/shirokih/.local/lib/python3.6/site-packages/ansible
  executable location = /home/shirokih/.local/bin/ansible-galaxy
  python version = 3.6.9 (default, Nov  7 2019, 10:44:02) [GCC 8.3.0]
No config file found; using defaults
Opened /home/shirokih/.ansible_galaxy
ERROR! Unexpected Exception, this is probably a bug: no filter named 'comment_ify'
the full traceback was:

Traceback (most recent call last):
  File "/home/shirokih/.local/bin/ansible-galaxy", line 110, in <module>
    exit_code = cli.run()
  File "/home/shirokih/.local/lib/python3.6/site-packages/ansible/cli/galaxy.py", line 149, in run
    self.execute()
  File "/home/shirokih/.local/lib/python3.6/site-packages/ansible/cli/__init__.py", line 94, in execute
    fn()
  File "/home/shirokih/.local/lib/python3.6/site-packages/ansible/cli/galaxy.py", line 246, in execute_init
    template_env.get_template(src_template).stream(inject_data).dump(dest_file)
  File "/home/shirokih/.local/lib/python3.6/site-packages/jinja2/environment.py", line 883, in get_template
    return self._load_template(name, self.make_globals(globals))
  File "/home/shirokih/.local/lib/python3.6/site-packages/jinja2/environment.py", line 857, in _load_template
    template = self.loader.load(self, name, globals)
  File "/home/shirokih/.local/lib/python3.6/site-packages/jinja2/loaders.py", line 127, in load
    code = environment.compile(source, name, filename)
  File "/home/shirokih/.local/lib/python3.6/site-packages/jinja2/environment.py", line 638, in compile
    self.handle_exception(source=source_hint)
  File "/home/shirokih/.local/lib/python3.6/site-packages/jinja2/environment.py", line 832, in handle_exception
    reraise(*rewrite_traceback_stack(source=source))
  File "/home/shirokih/.local/lib/python3.6/site-packages/jinja2/_compat.py", line 28, in reraise
    raise value.with_traceback(tb)
  File "/home/shirokih/.local/lib/python3.6/site-packages/ansible/galaxy/data/default/collection/galaxy.yml.j2", line 3, in template
    {{ option.description | comment_ify }}
bug

Most helpful comment

but 3+ version rely on broken dependency and it is a bug.

All 8 comments

I am inclined to believe that is a bug with galaxy as you can easily run the same command run by molecule itself to see if it works. If it fails, is not molecule fault.

i also tested with +-5 version of ansible. the problem is the same.
Molecule 2.22 works well with the same ansible.

It should be obvious that comment_ify is not part of molecule but part of galaxy. Unless you can raise a PR to reproduce the error on CI, I will keep this closed as not a bug.

PS. Molecule 2.22 works for you because that version does not rely on galaxy to initialize roles for it.

but 3+ version rely on broken dependency and it is a bug.

Good afternoon. Faced the same problem when using 3+ version. If you updated the your package and added a broken dependency to it, why don't you consider this a bug of your package?

This looks like a transfer of responsibility to others, although you did the update.

Agreed - molecule 3.0.8 fails spectacularly

While I barely have time to read tickets, I can still look at open pull requests.

Went to Molecule - I am not ANY kind of developer, so have to depend upon precooked options, and this worked for me.
I found that Molecule only supports pip - and since there is not a 3 appended to that, I assume that "pip" means NOT pip3.

I uninstalled the previously installed Molecule package
pip3 uninstall molecule

I then ran:
sudo yum install -y gcc python3-pip python3-devel openssl-devel python3-libselinux
I then installed Molecule:
python3 -m pip install --user "molecule[lint]"

This version works for me just fine now with molecule 3.0.8 on Ansible 2.9.11 python 3.6

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dfinninger picture dfinninger  路  5Comments

surfer190 picture surfer190  路  3Comments

tadeboro picture tadeboro  路  4Comments

brucellino picture brucellino  路  4Comments

dj-wasabi picture dj-wasabi  路  3Comments