Skip to content

Commit

Permalink
Import subprocess from eventlet.green package
Browse files Browse the repository at this point in the history
The python kubernetes client requires a newer version of eventlet.
However, newer versions of eventlet have an issue with the subprocess
module, which requires subprocess to be imported from eventlet.green
instead of being imported directly. See:
eventlet/eventlet#413

The eventlet has been upversioned to 0.24.1, therefore, the
subprocess import is changed. This update also fixes the issue
that raise e triggers 'CalledProcessError' object is not
callable error.

Change-Id: If3fd8506ececf062ee1b390dc8a87771cb01dec9
Story: 2006980
Task: 37715
Signed-off-by: Tao Liu <tao.liu@windriver.com>
  • Loading branch information
tliu88 committed Jan 24, 2020
1 parent 46f5626 commit 05c2037
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions distributedcloud/dcmanager/manager/subcloud_audit_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ def _periodic_subcloud_audit_loop(self):
[consts.DEPLOY_STATE_DONE,
consts.DEPLOY_STATE_DEPLOYING,
consts.DEPLOY_STATE_DEPLOY_FAILED]):
LOG.info("Skip subcloud %s audit, deploy_status: %s" %
(subcloud.name, subcloud.deploy_status))
LOG.debug("Skip subcloud %s audit, deploy_status: %s" %
(subcloud.name, subcloud.deploy_status))
continue
# Create a new greenthread for each subcloud to allow the audits
# to be done in parallel. If there are not enough greenthreads
Expand Down
13 changes: 6 additions & 7 deletions distributedcloud/dcmanager/manager/subcloud_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@

import base64
import datetime
from eventlet.green import subprocess
import json
import netaddr
import os
import socket
import subprocess

from six.moves.urllib import error as urllib_error
from six.moves.urllib import parse
Expand Down Expand Up @@ -315,10 +315,9 @@ def update_iso(self, override_path, values):
with open(os.devnull, "w") as fnull:
subprocess.check_call(update_iso_cmd, stdout=fnull,
stderr=fnull)
except subprocess.CalledProcessError as ex:
except subprocess.CalledProcessError:
msg = "Failed to update iso %s, " % str(update_iso_cmd)
LOG.error(msg)
raise ex
raise Exception(msg)
return output_iso_file

def cleanup(self):
Expand Down Expand Up @@ -381,6 +380,7 @@ def prep(self, override_path, payload):
self.create_install_override_file(override_path, payload)

def install(self, log_file_dir, install_command):
LOG.info("Start remote install %s", self.name)
log_file = (log_file_dir + self.name + '_install_' +
str(datetime.datetime.now().strftime('%Y-%m-%d-%H-%M-%S'))
+ '.log')
Expand All @@ -389,9 +389,8 @@ def install(self, log_file_dir, install_command):
subprocess.check_call(install_command,
stdout=f_out_log,
stderr=f_out_log)
except subprocess.CalledProcessError as e:
except subprocess.CalledProcessError:
msg = ("Failed to install the subcloud %s, check individual "
"log at %s for detailed output."
% (self.name, log_file))
LOG.error(msg)
raise e
raise Exception(msg)

0 comments on commit 05c2037

Please sign in to comment.