Skip to content

Commit ed9a21b

Browse files
author
Eric Diven
committed
Use JAVA8_HOME for server upgrade
1 parent e1c3af2 commit ed9a21b

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

prestoadmin/package.py

+13-9
Original file line numberDiff line numberDiff line change
@@ -89,27 +89,31 @@ def deploy(local_path=None):
8989
print("Package deployed successfully on: " + env.host)
9090

9191

92-
def rpm_install(rpm_name):
93-
_LOGGER.info("Installing the rpm")
92+
def _rpm_install(package_path):
9493
nodeps = ''
9594
if env.nodeps:
9695
nodeps = '--nodeps '
9796

9897
if 'java8_home' not in env or env.java8_home is None:
99-
ret = sudo('rpm -i %s%s' %
100-
(nodeps, os.path.join(constants.REMOTE_PACKAGES_PATH,
101-
rpm_name)))
98+
ret = sudo('rpm -i %s%s' % (nodeps, package_path))
10299
else:
103100
with shell_env(JAVA8_HOME='%s' % env.java8_home):
104-
ret = sudo('rpm -i %s%s' %
105-
(nodeps, os.path.join(constants.REMOTE_PACKAGES_PATH,
106-
rpm_name)))
101+
ret = sudo('rpm -i %s%s' % (nodeps, package_path))
102+
103+
return ret
104+
105+
106+
def rpm_install(rpm_name):
107+
_LOGGER.info("Installing the rpm")
108+
package_path = os.path.join(constants.REMOTE_PACKAGES_PATH, rpm_name)
109+
ret = _rpm_install(package_path)
107110
if ret.succeeded:
108111
print("Package installed successfully on: " + env.host)
109112

110113

111114
def rpm_upgrade(rpm_name):
112115
_LOGGER.info("Upgrading the rpm")
116+
113117
nodeps = ''
114118
if env.nodeps:
115119
nodeps = '--nodeps '
@@ -119,6 +123,6 @@ def rpm_upgrade(rpm_name):
119123
% package_path, quiet=True)
120124

121125
ret_uninstall = sudo('rpm -e %s%s' % (nodeps, package_name))
122-
ret_install = sudo('rpm -i %s%s' % (nodeps, package_path))
126+
ret_install = _rpm_install(package_path)
123127
if ret_uninstall.succeeded and ret_install.succeeded:
124128
print("Package upgraded successfully on: " + env.host)

0 commit comments

Comments
 (0)