Skip to content

Commit

Permalink
Closes-Bug: #1610074
Browse files Browse the repository at this point in the history
renamed rpm package could have been used to add image to SM. Extract
package name from package itself instead of package filename.

Change-Id: I6ea449bd6952dcc454d893216182997c56dbe70d
  • Loading branch information
kamleshp committed Aug 8, 2016
1 parent 317f03d commit 9939ad0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/server_mgr_main.py
Expand Up @@ -1546,7 +1546,10 @@ def put_image(self):
version = subprocess.check_output(['dpkg-deb', '-f',tmp_pkg.strip(),'Version'])
elif output and 'RPM' in output:
sm = ServerMgrUtil()
version = sm.get_package_version(os.path.basename(image_path))
# package could have been renamed, extract package name using rpm
cmd = "rpm -qp %s" %image_path.strip()
pkg_name = subprocess.check_output(cmd, shell = True)
version = sm.get_package_version(pkg_name)
else:
version = subprocess.check_output(['dpkg-deb', '-f',image_path,'Version'])
version = version.strip('\n')
Expand Down

0 comments on commit 9939ad0

Please sign in to comment.