lingarajg commented on code in PR #3681:
URL: https://github.com/apache/ambari/pull/3681#discussion_r1191615369
##########
ambari-agent/conf/unix/agent-multiplier.py:
##########
@@ -317,42 +317,42 @@ def run(self):
self.cmd_status()
def cmd_start(self):
- print "Starting %d host(s)" % len(self.hosts)
+ print("Starting %d host(s)" % len(self.hosts))
for host in self.hosts:
cmd = "ambari-agent start --home %s" % (host.home_dir)
os.environ['AMBARI_AGENT_CONF_DIR'] = os.path.join(host.home_dir,
"etc/ambari-agent/conf")
subprocess32.call(cmd, shell=True, env=os.environ)
def cmd_stop(self):
- print "Stopping %d host(s)" % len(self.hosts)
+ print("Stopping %d host(s)" % len(self.hosts))
for host in self.hosts:
cmd = "ambari-agent stop --home %s" % (host.home_dir)
os.environ['AMBARI_AGENT_CONF_DIR'] = os.path.join(host.home_dir,
"etc/ambari-agent/conf")
subprocess32.call(cmd, shell=True, env=os.environ)
Review Comment:
Update subprocess32 to subprocess ?
##########
ambari-agent/conf/unix/agent-multiplier.py:
##########
@@ -317,42 +317,42 @@ def run(self):
self.cmd_status()
def cmd_start(self):
- print "Starting %d host(s)" % len(self.hosts)
+ print("Starting %d host(s)" % len(self.hosts))
for host in self.hosts:
cmd = "ambari-agent start --home %s" % (host.home_dir)
os.environ['AMBARI_AGENT_CONF_DIR'] = os.path.join(host.home_dir,
"etc/ambari-agent/conf")
subprocess32.call(cmd, shell=True, env=os.environ)
def cmd_stop(self):
- print "Stopping %d host(s)" % len(self.hosts)
+ print("Stopping %d host(s)" % len(self.hosts))
for host in self.hosts:
cmd = "ambari-agent stop --home %s" % (host.home_dir)
os.environ['AMBARI_AGENT_CONF_DIR'] = os.path.join(host.home_dir,
"etc/ambari-agent/conf")
subprocess32.call(cmd, shell=True, env=os.environ)
def cmd_restart(self):
- print "Restarting %d host(s)" % len(self.hosts)
+ print("Restarting %d host(s)" % len(self.hosts))
for host in self.hosts:
cmd = "ambari-agent restart --home %s" % (host.home_dir)
os.environ['AMBARI_AGENT_CONF_DIR'] = os.path.join(host.home_dir,
"etc/ambari-agent/conf")
subprocess32.call(cmd, shell=True, env=os.environ)
Review Comment:
Update subprocess32 to subprocess ?
##########
ambari-agent/conf/unix/agent-multiplier.py:
##########
@@ -317,42 +317,42 @@ def run(self):
self.cmd_status()
def cmd_start(self):
- print "Starting %d host(s)" % len(self.hosts)
+ print("Starting %d host(s)" % len(self.hosts))
for host in self.hosts:
cmd = "ambari-agent start --home %s" % (host.home_dir)
os.environ['AMBARI_AGENT_CONF_DIR'] = os.path.join(host.home_dir,
"etc/ambari-agent/conf")
subprocess32.call(cmd, shell=True, env=os.environ)
Review Comment:
Update subprocess32 to subprocess ?
##########
ambari-agent/conf/unix/agent-multiplier.py:
##########
@@ -226,7 +226,7 @@ def create_host_name_script(self, host_name,
host_name_script):
"echo HOSTNAME"
with open(str(host_name_script), "w+") as f:
f.writelines(template.replace("HOSTNAME", host_name))
- subprocess32.call("chmod +x %s" % host_name_script, shell=True)
+ subprocess.call("chmod +x %s" % host_name_script, shell=True)
Review Comment:
Any security considerations here ? can the subprocess call be used with
shell=False ?
Example - subprocess.call(["chmod" + " +x " + host_name_script], shell=False)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]