Bug 1745081 - Hammer content view import failing to import when using relative path.
Summary: Hammer content view import failing to import when using relative path.
Keywords:
Status: NEW
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Inter Satellite Sync
Version: 6.5.0
Hardware: x86_64
OS: Linux
unspecified
medium vote
Target Milestone: Unspecified
Assignee: satellite6-bugs
QA Contact: Lai
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-08-23 15:06 UTC by Rudnei Bertol Jr.
Modified: 2020-07-29 18:56 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Target Upstream Version:


Attachments (Terms of Use)

Description Rudnei Bertol Jr. 2019-08-23 15:06:56 UTC
Description of problem:

When using a relative path to run the `hammer content-view version import` the import is failing due to the command search the files unpacked from the tarball on the root ('/') directory.  


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

~~~
~]# hammer --version
hammer (0.15.1.2)
 * hammer_cli_csv (unknown version)
 * hammer_cli_foreman (0.15.1.1)
 * hammer_cli_foreman_admin (0.0.8)
 * hammer_cli_foreman_ansible (unknown version)
 * hammer_cli_foreman_bootdisk (0.1.3.3)
 * hammer_cli_foreman_discovery (1.0.0)
 * hammer_cli_foreman_docker (unknown version)
 * hammer_cli_foreman_openscap (0.1.6)
 * hammer_cli_foreman_remote_execution (unknown version)
 * hammer_cli_foreman_tasks (unknown version)
 * hammer_cli_foreman_templates (0.1.2)
 * hammer_cli_foreman_virt_who_configure (unknown version)
 * hammer_cli_katello (0.16.0.11)
~~~


How reproducible:

Generate an exported content view version and import it on a Satellite, cd into '/var/lib/pulp/katello-export' directory and run the 'hammer content-view version import' using the relative path.


I have confirmed that if you place the tarball into /var/lib/pulp/katello-export, cd into /var/lib/pulp/katello-export, and run the import using the fully qualified path to the export file that it does work, as we can see on the following output

~~~
[root@rhel2 katello-export]# hammer content-view version import --export-tar export-gluster-3.tar --organization-id 1
[...............................................................................................................................................................................................................................] [100%]
No new packages.
Error: RPM1004: Error retrieving metadata: [Errno 2] No such file or directory: '//./export-gluster-3/My_Laptop/content_views/gluster/1.0/content/dist/rhel/server/7/7Server/x86_64/rhgs-server/3.1/os/repodata/repomd.xml'
Could not impot the content view:
  augeas-devel-1.4.0-9.el7.x86_64.rpm not available in repository Red_Hat_Gluster_Storage_3_Server_RPMs_x86_64_7Server
~~~

Steps to Reproduce:
1. Copy the tarball file exported to '/var/lib/pulp/katello-export' directory
2. Cd into '/var/lib/pulp/katello-export'
3. Run the `hammer content-view version import` command using the relative path. 

Actual results:

The importer process is failing to import the rpm files due to the permission.


Expected results:

The rpm files would be imported on the Satellite.


Additional info:

Comment 3 Jeffrey Cutter 2019-08-23 16:10:07 UTC
Similarly, it will fail if you do not change directory to /var/lib/pulp/katello-export before running the command.  It would be desirable to be able to run the command from anywhere.

If you are in /var/lib/pulp/katello-export and specify a relative path to the file it errors:

[root@rhel2 katello-export]# hammer content-view version import --export-tar export-gluster-3.tar --organization-id 1
[...............................................................................................................................................................................................................................] [100%]
No new packages.
Error: RPM1004: Error retrieving metadata: [Errno 2] No such file or directory: '//./export-gluster-3/My_Laptop/content_views/gluster/1.0/content/dist/rhel/server/7/7Server/x86_64/rhgs-server/3.1/os/repodata/repomd.xml'
Could not import the content view:
  augeas-devel-1.4.0-9.el7.x86_64.rpm not available in repository Red_Hat_Gluster_Storage_3_Server_RPMs_x86_64_7Server


If you are not in /var/lib/pulp/katello-export and specify a full path to the file it also errors:

[root@rhel2 ~]# hammer content-view version import --export-tar /var/lib/pulp/katello-export/export-ansible-8.tar --organization-id 1
[....................................                                                                       ] [33%]
No new packages.
Error: RPM1004: Error retrieving metadata: [Errno 2] No such file or directory: '///var/lib/pulp/katello-export/export-ansible-8/My_Laptop/content_views/ansible/4.0/content/dist/rhel/server/7/7Server/x86_64/ansible/2.6/os/repodata/repomd.xml'
[..........................................................................................................] [100%]
[root@rhel2 ~]#


Note You need to log in before you can comment on or make changes to this bug.