Giter Club home page Giter Club logo

Comments (9)

marcelmamula avatar marcelmamula commented on July 19, 2024

Did you check previous step in execution log that it registered that variable? It is possible it did not find any files, therefore item was not defined.

I have been running it in current state and I never had this issue with .item.

- name: SAP SWPM - Find sapcontrol log file/s
  ansible.builtin.find:
    paths: "{{ swpm_last_install_path.stdout }}"
    recurse: false
    file_type: file
    patterns: '.*sapcontrol.*log'
    use_regex: true
  register: swpm_output_sapcontrol_files

from community.sap_install.

berndfinger avatar berndfinger commented on July 19, 2024

@rnozaki I had the same error when testing an S/4HANA Foundation 2022 installation last week but I could not finish my investigation. Trying to reproduce it again now and also testing the solution you proposed.

from community.sap_install.

rnozaki avatar rnozaki commented on July 19, 2024

Did you check previous step in execution log that it registered that variable? It is possible it did not find any files, therefore item was not defined.

I have been running it in current state and I never had this issue with .item.

- name: SAP SWPM - Find sapcontrol log file/s
  ansible.builtin.find:
    paths: "{{ swpm_last_install_path.stdout }}"
    recurse: false
    file_type: file
    patterns: '.*sapcontrol.*log'
    use_regex: true
  register: swpm_output_sapcontrol_files

As I mentioned, I tested the new code with the exact same conditions it was working before.
And when I added the new label, it found the element.
So in my case, just fixing the label solved the problem.

Have you executed this code in your environment?

from community.sap_install.

marcelmamula avatar marcelmamula commented on July 19, 2024

Did you check previous step in execution log that it registered that variable? It is possible it did not find any files, therefore item was not defined.
I have been running it in current state and I never had this issue with .item.

- name: SAP SWPM - Find sapcontrol log file/s
  ansible.builtin.find:
    paths: "{{ swpm_last_install_path.stdout }}"
    recurse: false
    file_type: file
    patterns: '.*sapcontrol.*log'
    use_regex: true
  register: swpm_output_sapcontrol_files

As I mentioned, I tested the new code with the exact same conditions it was working before. And when I added the new label, it found the element. So in my case, just fixing the label solved the problem.

Have you executed this code in your environment?

That is why I was mentioning previous step. It would be good to know what was actual content of your "{{ swpm_output_sapcontrol_files }}" variable and if it contains array with items.

I have run this role 20+ times over last 2 weeks (ASCS/ERS, S4H, NW) and it never failed with this error, even if SWPM was successful or failed.

from community.sap_install.

rnozaki avatar rnozaki commented on July 19, 2024

Did you check previous step in execution log that it registered that variable? It is possible it did not find any files, therefore item was not defined.
I have been running it in current state and I never had this issue with .item.

- name: SAP SWPM - Find sapcontrol log file/s
  ansible.builtin.find:
    paths: "{{ swpm_last_install_path.stdout }}"
    recurse: false
    file_type: file
    patterns: '.*sapcontrol.*log'
    use_regex: true
  register: swpm_output_sapcontrol_files

As I mentioned, I tested the new code with the exact same conditions it was working before. And when I added the new label, it found the element. So in my case, just fixing the label solved the problem.
Have you executed this code in your environment?

That is why I was mentioning previous step. It would be good to know what was actual content of your "{{ swpm_output_sapcontrol_files }}" variable and if it contains array with items.

I have run this role 20+ times over last 2 weeks (ASCS/ERS, S4H, NW) and it never failed with this error, even if SWPM was successful or failed.

Have you run it in the last 3 days? Because this is when the PR 665 was merged.

from community.sap_install.

marcelmamula avatar marcelmamula commented on July 19, 2024

Sorry @rnozaki , it seems @berndfinger moved his PR and it changed items as you said. I have not tested it with his PR. You can disregard my comments.

from community.sap_install.

berndfinger avatar berndfinger commented on July 19, 2024

@rnozaki @marcelmamula In #665, I overlooked the fact that the loop variable from the task SAP SWPM - Get sapcontrol file/s is re-used for the label in the task SAP SWPM - Display status from sapcontrol file/s.
Thanks for solving the problem @rnozaki!

from community.sap_install.

berndfinger avatar berndfinger commented on July 19, 2024

Solved in #682.

from community.sap_install.

berndfinger avatar berndfinger commented on July 19, 2024

FYI - Test playbook for those who want to reproduce the problem:

- name: junk
  hosts: localhost
  vars:
    dummy:
      - 'test1'
      - 'test2'

  gather_facts: no

  tasks:

    - name: Display the list
      ansible.builtin.debug:
        msg: "{{ dummy }}"
 
    - name: Run command and register output with new loop_var
      ansible.builtin.command: "echo {{ line_item }}" 
      register: output
      loop: "{{ dummy }}"
      loop_control:
        loop_var: line_item

    - name: Display output with correct loop label
      ansible.builtin.debug:
        msg: "{{ command_output.stdout_lines }}"
      loop: "{{ output.results }}"
      loop_control:
        loop_var: command_output
        label: "{{ command_output.line_item }}"

    - name: Display output with wrong loop label
      ansible.builtin.debug:
        msg: "{{ command_output.stdout_lines }}"
      loop: "{{ output.results }}"
      loop_control:
        loop_var: command_output
        label: "{{ command_output.item }}"

from community.sap_install.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.