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

VMware: fix for vmware_guest_file_operation binary file #57614

Merged
merged 1 commit into from
Jul 15, 2019
Merged

VMware: fix for vmware_guest_file_operation binary file #57614

merged 1 commit into from
Jul 15, 2019

Conversation

stravassac
Copy link
Contributor

SUMMARY

Fix bug #57475 for copy binary file withon python 3.X

#57475

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

vmware_guest_file_operation

@ansibot
Copy link
Contributor

ansibot commented Jun 10, 2019

@ansibot ansibot added affects_2.9 This issue/PR affects Ansible v2.9 bug This issue/PR relates to a bug. cloud community_review In order to be merged, this PR must follow the community review workflow. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. owner_pr This PR is made by the module's maintainer. python3 small_patch support:community This issue/PR relates to code supported by the Ansible community. vmware VMware community labels Jun 10, 2019
@stravassac stravassac changed the title fix for vmware_guest_file_operation bianry file fix for vmware_guest_file_operation binary file Jun 10, 2019
@Akasurde Akasurde changed the title fix for vmware_guest_file_operation binary file VMware: fix for vmware_guest_file_operation binary file Jun 10, 2019
@Akasurde Akasurde removed the needs_triage Needs a first human triage before being processed. label Jun 10, 2019
@Akasurde
Copy link
Member

@stravassac Thanks for the PR. Could you please write test case(s) for this change ? Thanks.

needs_info

@ansibot ansibot added needs_info This issue requires further information. Please answer any outstanding questions. and removed community_review In order to be merged, this PR must follow the community review workflow. labels Jun 10, 2019
@stravassac
Copy link
Contributor Author

stravassac commented Jun 10, 2019

@Akasurde, is it enough for you ?

- name: test
  hosts: all
  vars:
    ansible_python_interpreter: "/usr/bin/env python"
    var_my_file: "hostnamectl"
  tasks:
    - name: file
      vmware_guest_file_operation:
        hostname: XXXXXXX
        username: "{{ lookup('env','VMWARE_USER') }}"
        password: "{{ lookup('env','VMWARE_PASSWORD') }}"
        datacenter: XXXXX
        validate_certs: False
        folder: /vm/
        vm_id: test1
        vm_username: root
        vm_password: XXXX
        copy:
          src: "/usr/bin/{{var_my_file}}"
          dest: "/root/{{var_my_file}}"
          #overwrite: True

      delegate_to: localhost

Before fix
TASK [file] ************************************************************************************************************************************************************************************************
fatal: [127.0.0.1]: FAILED! => {"changed": false, "msg": "'utf-8' codec can't decode byte 0xf8 in position 96: invalid start byte"}

after
TASK [file] ************************************************************************************************************************************************************************************************
ok: [127.0.0.1]

It's also work with text file

@ansibot ansibot added community_review In order to be merged, this PR must follow the community review workflow. and removed needs_info This issue requires further information. Please answer any outstanding questions. labels Jun 10, 2019
@jillr
Copy link
Contributor

jillr commented Jun 11, 2019

@stravassac Integration tests should look similar to the other vmware modules, using the prepare_vmware_tests role to setup the test environment and asserts to ensure test outcomes. For example: https://github.com/ansible/ansible/tree/devel/test/integration/targets/vmware_guest_facts. The directory here would be in test/integration/targets/vmware_guest_file_operation.

@goneri
Copy link
Contributor

goneri commented Jun 11, 2019

I would prefer an unit-test for this kind of thing, it will be more efficient and faster. This being said, the fix is obvious.

@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Jun 19, 2019
@Akasurde Akasurde merged commit 262c9ff into ansible:devel Jul 15, 2019
@Akasurde
Copy link
Member

@stravassac Thanks for the contribution.

@stravassac stravassac deleted the fix_vmware_guest_file_operation branch July 15, 2019 13:46
@ansible ansible locked and limited conversation to collaborators Aug 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.9 This issue/PR affects Ansible v2.9 bug This issue/PR relates to a bug. cloud community_review In order to be merged, this PR must follow the community review workflow. module This issue/PR relates to a module. owner_pr This PR is made by the module's maintainer. python3 small_patch stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. support:community This issue/PR relates to code supported by the Ansible community. vmware VMware community
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants