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

python exception while running yedit #74

Open
dmitrym0 opened this issue Aug 17, 2019 · 1 comment
Open

python exception while running yedit #74

dmitrym0 opened this issue Aug 17, 2019 · 1 comment

Comments

@dmitrym0
Copy link

dmitrym0 commented Aug 17, 2019

Hello everyone,

I have a simple yml:

- hosts: localhost
  roles:
  - roles/kwoodson.yedit
  tasks:
  - name: manage yaml files
    yedit:
      src: ~/workspace/docker-machines/test/docker-compose.yml
      key: services.atb.image
      value:
        wakka

However it fails with

module 'yaml' has no attribute 'RoundTripDumper'

Here's the full stack trace:

fatal: [localhost]: FAILED! => {
    "changed": false,
    "module_stderr": "/Users/dmitry/.ansible/tmp/ansible-tmp-1566064416.420654-155937174493441/AnsiballZ_yedit.py:18: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses\n  import imp\nTraceback (most recent call last):\n  File \"/var/folders/l7/y1c6vkdx02l2mrw0_z90ggcr0000gn/T/ansible_yedit_payload_5wbjyf6s/__main__.py\", line 444, in write\nAttributeError: module 'yaml' has no attribute 'RoundTripDumper'\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File \"/Users/dmitry/.ansible/tmp/ansible-tmp-1566064416.420654-155937174493441/AnsiballZ_yedit.py\", line 114, in <module>\n    _ansiballz_main()\n  File \"/Users/dmitry/.ansible/tmp/ansible-tmp-1566064416.420654-155937174493441/AnsiballZ_yedit.py\", line 106, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/Users/dmitry/.ansible/tmp/ansible-tmp-1566064416.420654-155937174493441/AnsiballZ_yedit.py\", line 49, in invoke_module\n    imp.load_module('__main__', mod, module, MOD_DESC)\n  File \"/usr/local/Cellar/ansible/2.8.4/libexec/lib/python3.7/imp.py\", line 234, in load_module\n    return load_source(name, filename, file)\n  File \"/usr/local/Cellar/ansible/2.8.4/libexec/lib/python3.7/imp.py\", line 169, in load_source\n    module = _exec(spec, sys.modules[name])\n  File \"<frozen importlib._bootstrap>\", line 630, in _exec\n  File \"<frozen importlib._bootstrap_external>\", line 728, in exec_module\n  File \"<frozen importlib._bootstrap>\", line 219, in _call_with_frames_removed\n  File \"/var/folders/l7/y1c6vkdx02l2mrw0_z90ggcr0000gn/T/ansible_yedit_payload_5wbjyf6s/__main__.py\", line 969, in <module>\n  File \"/var/folders/l7/y1c6vkdx02l2mrw0_z90ggcr0000gn/T/ansible_yedit_payload_5wbjyf6s/__main__.py\", line 961, in main\n  File \"/var/folders/l7/y1c6vkdx02l2mrw0_z90ggcr0000gn/T/ansible_yedit_payload_5wbjyf6s/__main__.py\", line 893, in run_ansible\n  File \"/var/folders/l7/y1c6vkdx02l2mrw0_z90ggcr0000gn/T/ansible_yedit_payload_5wbjyf6s/__main__.py\", line 446, in write\n  File \"/var/folders/l7/y1c6vkdx02l2mrw0_z90ggcr0000gn/T/ansible_yedit_payload_5wbjyf6s/__main__.py\", line 408, in _write\nFileNotFoundError: [Errno 2] No such file or directory: '~/workspace/docker-machines/test/docker-compose.yml.yedit'\n",
    "module_stdout": "",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 1
}

However I do believe I have the latest Yaml module:

~/w/a/docker ❯❯❯ python3.7                                                                                                                                                                                                    master ◼
Python 3.7.4 (default, Jul  9 2019, 18:13:23)
[Clang 10.0.1 (clang-1001.0.46.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import yaml
>>> yaml.__version__
'5.1.2'

This is on:

  • MacOS 10.14
  • Ansible 2.8.4
@idolize
Copy link

idolize commented Sep 21, 2023

I'm seeing this exact same error. Were you able to get it resolved @dmitrym0?

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