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

created: true is ignored in state.yml #4037

Closed
mluzarreta opened this issue Sep 8, 2023 · 1 comment · Fixed by #4038
Closed

created: true is ignored in state.yml #4037

mluzarreta opened this issue Sep 8, 2023 · 1 comment · Fixed by #4038

Comments

@mluzarreta
Copy link
Contributor

Issue Type

  • Bug report

Molecule and Ansible details

ansible --version && molecule --version
ansible [core 2.15.3]
  config file = None
  configured module search path = ['/home/manu/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/manu/.local/share/virtualenvs/molecule-test-IsY3eZIi/lib/python3.11/site-packages/ansible
  ansible collection location = /home/manu/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/manu/.local/share/virtualenvs/molecule-test-IsY3eZIi/bin/ansible
  python version = 3.11.5 (main, Aug 28 2023, 20:02:58) [GCC 13.2.1 20230801] (/home/manu/.local/share/virtualenvs/molecule-test-IsY3eZIi/bin/python)
  jinja version = 3.1.2
  libyaml = True
molecule 6.0.2 using python 3.11
    ansible:2.15.3
    default:6.0.2 from molecule
    molecule-qemu:0.5.3 from molecule_qemu

Molecule installation method: source
Ansible installation method: pip

Desired Behavior

In molecule v5, the create step was automatically skipped when created: true in <XDG_CACHE_HOME>/molecule//<scenario>/state.yml with the message WARNING Skipping, instances already created.. This is the desired behavior.

Here an example with a simple hello_world role after a molecule create execution. The molecule-qemu plugin is used here.

❯ molecule converge
INFO     default scenario test matrix: dependency, create, prepare, converge
INFO     Performing prerun with role_name_check=0...
INFO     Set ANSIBLE_LIBRARY=/home/manu/.cache/ansible-compat/35072c/modules:/home/manu/.ansible/plugins/modules:/usr/share/ansible/plugins/modules
INFO     Set ANSIBLE_COLLECTIONS_PATH=/home/manu/.cache/ansible-compat/35072c/collections:/home/manu/.ansible/collections:/usr/share/ansible/collections
INFO     Set ANSIBLE_ROLES_PATH=/home/manu/.cache/ansible-compat/35072c/roles:/home/manu/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles
INFO     Running default > dependency
WARNING  Skipping, missing the requirements file.
WARNING  Skipping, missing the requirements file.
INFO     Running default > create
WARNING  Skipping, instances already created.
INFO     Running default > prepare
WARNING  Skipping, prepare playbook not configured.
INFO     Running default > converge

PLAY [all] *********************************************************************

TASK [hello_world : Hello world] ***********************************************
ok: [test-hello-world] => {
    "msg": "Hello, world!"
}

PLAY RECAP *********************************************************************
test-hello-world           : ok=1    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

Actual Behaviour

Since molecule v6, the WARNING Skipping, instances already created. message is no longer displayed and the create step is executed each time the molecule converge is called.

Here an example with the same role, with the same conditions except that molecule version is 6.0.2.

INFO     default scenario test matrix: dependency, create, prepare, converge
INFO     Performing prerun with role_name_check=0...
INFO     Running default > dependency
WARNING  Skipping, missing the requirements file.
WARNING  Skipping, missing the requirements file.
INFO     Running default > create

PLAY [Create] ******************************************************************

TASK [Gather only necessary facts] *********************************************
ok: [localhost]

TASK [Register VMs data] *******************************************************
ok: [localhost] => (item=test-hello-world)

TASK [Prepare VMs data] ********************************************************
ok: [localhost]
...
TASK [Dump VMs config] *********************************************************
ok: [localhost]

PLAY RECAP *********************************************************************
localhost                  : ok=31   changed=0    unreachable=0    failed=0    skipped=5    rescued=0    ignored=0

INFO     Running default > prepare
WARNING  Skipping, prepare playbook not configured.
INFO     Running default > converge

PLAY [all] *********************************************************************

TASK [hello_world : Hello world] ***********************************************
ok: [test-hello-world] => {
    "msg": "Hello, world!"
}

PLAY RECAP *********************************************************************
test-hello-world           : ok=1    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0
mluzarreta added a commit to mluzarreta/molecule that referenced this issue Sep 8, 2023
mluzarreta added a commit to mluzarreta/molecule that referenced this issue Sep 8, 2023
@elara-leitstellentechnik

@mluzarreta Could you kindly open a pull request with your commit, so this can be fixed upstream as well?

ssbarnea added a commit that referenced this issue Oct 17, 2023
Fixes: #4037

Co-authored-by: Sorin Sbarnea <ssbarnea@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants