Bug 1444894

Summary: rhn-satellite-activate not expanding tilde in the manifest path
Product: Red Hat Satellite 5 Reporter: Radovan Drazny <rdrazny>
Component: InstallerAssignee: Gennadii Altukhov <galtukho>
Status: CLOSED CURRENTRELEASE QA Contact: Pavel Studeník <pstudeni>
Severity: low Docs Contact:
Priority: unspecified    
Version: 580CC: galtukho, pstudeni, tlestach
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: spacewalk-backend-2.5.3-127-sat Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-06-21 12:16:36 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:
Bug Depends On:    
Bug Blocks: 1358815    

Description Radovan Drazny 2017-04-24 13:52:07 UTC
Description of problem:
When activating a Satellite server with rhn-satellite-activate, and the path to a manifest file is entered with a tilde (~) for a home directory, the path is not expanded and the manifest is not found by activation command.

Version-Release number of selected component (if applicable):
spacewalk-backend-tools-2.5.3-111.el6sat

How reproducible:
always

Steps to Reproduce:
1. Place the manifest file in your home dir
2. 
# ls -lh ~/manifest.zip 
-rw-r--r--. 1 root root 424K Apr 24 09:24 /root/manifest.zip
# rhn-satellite-activate --manifest=~/manifest.zip

ERROR: unhandled exception occurred:
Traceback (most recent call last):
  File "/usr/bin/rhn-satellite-activate", line 38, in <module>
    sys.exit(abs(mod.main() or 0))
  File "/usr/lib/python2.6/site-packages/spacewalk/satellite_tools/rhn_satellite_activate.py", line 488, in main
    cdn_activate = cdn_activation.Activation(options.manifest)
  File "/usr/lib/python2.6/site-packages/spacewalk/cdn_tools/activation.py", line 37, in __init__
    self.manifest = Manifest(manifest_path)
  File "/usr/lib/python2.6/site-packages/spacewalk/cdn_tools/manifest.py", line 60, in __init__
    top_zip = zipfile.ZipFile(zip_path, 'r')
  File "/usr/lib64/python2.6/zipfile.py", line 683, in __init__
    self.fp = open(file, modeDict[mode])
IOError: [Errno 2] No such file or directory: '~/manifest.zip'

Actual results:
Path is not expanded and manifest file is not found.

Expected results:
Path is expanded and manifest file is successfully opened.

Additional info:
Same problem when using ~username shortut, for example "~root/manifest.zip"

Comment 1 Tomas Lestach 2017-04-25 14:23:16 UTC
I think this is expected.
Jan, can you confirm rhn-satellite-activate works with absolute paths only?

Comment 2 Jan Dobes 2017-04-25 15:31:40 UTC
No, rhn-satellite-activate takes also relative paths, the problem here is tilde expansion is not done. It's a minor bug, however, the fix is easy and it was already solved in our other python tools. I would definitely fix it.

Comment 4 Gennadii Altukhov 2017-05-09 09:04:55 UTC
The bug is fixed in upstream:
deb291d682b4b66f3e2297c6e0108e439dce4f02

Comment 9 Gennadii Altukhov 2017-05-10 14:09:47 UTC
spacewalk.git:
67875c07dfe9a4afe5ba126ca58a79257285532c

Comment 12 Pavel Studeník 2017-05-12 18:02:21 UTC
verified spacewalk-backend-tools-2.5.3-130.el6sat.noarch