Bug 2055416

Summary: redhat.satellite.content_upload ansible module with unexpected src parameter behavior
Product: Red Hat Satellite Reporter: Dan Kolepp <dkolepp>
Component: Ansible CollectionAssignee: Evgeni Golov <egolov>
Status: CLOSED ERRATA QA Contact: Griffin Sullivan <gsulliva>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.9.8CC: egolov
Target Milestone: 6.12.0Keywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: ansible-collection-redhat-satellite-3.3.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-11-16 13:33:27 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Dan Kolepp 2022-02-16 21:20:16 UTC
Description of problem:
I am unable to use the `redhat.satellite.content_upload` module from the certified content collection to upload content to satellite, unless I first transfer that file to actual satellite host.  I should be able to use a `src` value that corresponds to a file on the (local) controller, which is then transfered as part of this task.

The only way to use this (at the moment) is to do the following:
1. Transfer the file to the satellite host (to /tmp)
2. Run the redhat.satellite.content_upload module with the src pointing the location on satellite (/tmp)
3. Remove the transferred file from satellite (from /tmp)

at a minimum, the documentation should be updated if this is indeed the case, so that users know the file must already exist on the satellite host.  But this doesn't seem to follow the conventions of the `copy` module, or other modules, where the `src` parameter references a local file.

Version-Release number of selected component (if applicable): 3.1.0


How reproducible:



Steps to Reproduce:
1.  Pick a file on the controller (localhost probably) and configure a playbook to try and upload this content to a configured satellite file type repository.
2.Modify the playbook to first transfer, and then use the remote file to upload.


Actual results:
described above.

Expected results:
described above.


Additional info:

Comment 1 Evgeni Golov 2022-02-17 06:21:44 UTC
The src points to whatever machine you're running the module against.

So if youre playbook says "hosts: localhsot", it will be localhost, if your playbook says "hosts: satellite.example.com" it will be satellite.example.com

Comment 2 Dan Kolepp 2022-02-17 15:50:05 UTC
This is *unexpected* behavior in my opinion - based on other standard/common modules. For other modules, there is a `remote_src` option to indicate that the "src" is located remotely, and not on the controller.

If this is the case - I would state this explicitly in the documentation.  Right now, the description says:

src:  file to upload

I would change this to something like: "file to upload, which exists on the host targeted by the task", or provide additional information.

Here is the copy module: https://docs.ansible.com/ansible/latest/collections/ansible/builtin/copy_module.html

The "src" definition here is "common" for many modules - like "template", etc.

Comment 3 Brad Buckingham 2022-07-18 09:42:28 UTC
Moving to ON_DEV as this is already included in 6.12: 
ansible-collection-redhat-satellite-3.3.0-1.el8sat.noarch

Comment 4 Griffin Sullivan 2022-07-22 14:09:26 UTC
Verified in 6.12.0 snap 3.0

redhat.satellite.content_upload src description is updated.

Steps to Reproduce:

1) SSH into Satellite

2) # ansible-doc redhat.satellite.content_upload

Expected Result:
src description is updated to "File (on the remote/target machine) to upload"

Actual Result:
src description is updated to "File (on the remote/target machine) to upload"

Comment 8 errata-xmlrpc 2022-11-16 13:33:27 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Important: Satellite 6.12 Release), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2022:8506