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

Error with string value beginning from "!" sign #68

Open
l-e-s opened this issue May 20, 2019 · 1 comment
Open

Error with string value beginning from "!" sign #68

l-e-s opened this issue May 20, 2019 · 1 comment

Comments

@l-e-s
Copy link

l-e-s commented May 20, 2019

I use ansible 2.7.9 (Ansible AWX 4.0.0.0), latest yedit.
I found that yedit cannot parse the string if it begins from "!" sign, for example:

somerole/tasks/main.yml

- name: import kwoodson.yedit YAML editor
  import_role:
    name: ansible-role-yedit

- name: Update environment
  yedit:
    src: '{{ deploypath }}/file.yml'
    separator: '|'
    state: present
    edits:
    - { key: a|b, value: '{{ somevalue }}' }

host_vars/somehost
somevalue: '!sometext'

I receive an error:

File \"/tmp/ansible_yedit_payload_ECyASG/__main__.py\", line 969, in <module>\r\n  File \"/tmp/ansible_yedit_payload_ECyASG/__main__.py\", line 961, in main\r\n  File \"/tmp/ansible_yedit_payload_ECyASG/__main__.py\", line 889, in run_ansible\r\n  File \"/tmp/ansible_yedit_payload_ECyASG/__main__.py\", line 784, in process_edits\r\n  File \"/tmp/ansible_yedit_payload_ECyASG/__main__.py\", line 775, in parse_value\r\n__main__.YeditException: Could not determine type of incoming value. value=[<type 'str'>] vtype=[]\r\n"
@atodorov-storpool
Copy link

Old issue but I've found that if you define value_type as str the error should disappear:

- name: import kwoodson.yedit YAML editor
  import_role:
    name: ansible-role-yedit

- name: Update environment
  yedit:
    src: '{{ deploypath }}/file.yml'
    separator: '|'
    state: present
    value_type: str
    edits:
    - { key: a|b, value: '!sometext' }

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

No branches or pull requests

2 participants