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

"Extract the node key from file" fails if file was generated previously and not set by variable #15

Closed
yakimant opened this issue Sep 19, 2023 · 1 comment · Fixed by #16

Comments

@yakimant
Copy link
Member

Exmplae:

ansible-playbook ansible/main.yml --limit boot-01.do-ams3.shards.test --tags "nim-waku" -i ansible/inventory/test -v
...
TASK [nim-waku : Generate random node key] ***********************************************************************
skipping: [boot-01.do-ams3.shards.test] => {
    "changed": false,
    "false_condition": "not key_file.stat.exists and nim_waku_node_key is not defined\n",
    "skip_reason": "Conditional result was False"
}

TASK [nim-waku : Save generate node key to file] *****************************************************************
skipping: [boot-01.do-ams3.shards.test] => {
    "changed": false,
    "false_condition": "not key_file.stat.exists",
    "skip_reason": "Conditional result was False"
}

TASK [nim-waku : Load existing node key from file] ***************************************************************
skipping: [boot-01.do-ams3.shards.test] => {
    "changed": false,
    "false_condition": "key_generation.skipped is not defined and nim_waku_node_key is not defined\n",
    "skip_reason": "Conditional result was False"
}

TASK [nim-waku : Extract the node key from file] *****************************************************************
fatal: [boot-01.do-ams3.shards.test]: FAILED! => {}

MSG:

The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'content'. 'dict object' has no attribute 'content'

The error appears to be in '/Users/status/.ansible/roles/nim-waku/tasks/nodekey.yml': line 39, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:


- name: Extract the node key from file
  ^ here

Load is skipped wrongly, because generation is skipped.
Maybe it should be the opposite? If generation is skipped - load from file.

- name: Load existing node key from file
slurp:
src: '{{ nim_waku_node_key_file_path | mandatory }}'
register: key_file
when: >
key_generation.skipped is not defined and
nim_waku_node_key is not defined

@yakimant
Copy link
Member Author

If file didn't exist it also fails:

fatal: [store-01.ac-cn-hongkong-c.shards.test]: FAILED! => {}

MSG:

The conditional check 'key_generation.skipped and nim_waku_node_key is not defined
' failed. The error was: error while evaluating conditional (key_generation.skipped and nim_waku_node_key is not defined
): 'dict object' has no attribute 'skipped'. 'dict object' has no attribute 'skipped'

The error appears to be in '/Users/status/work/infra-role-nim-waku/tasks/nodekey.yml': line 39, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:


- name: Extract the node key from file
  ^ here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant