Skip to content

Commit

Permalink
fix projectatomic#199 sccli start and stop method should not return i…
Browse files Browse the repository at this point in the history
…ntermediate state
  • Loading branch information
praveenkumar committed Oct 28, 2016
1 parent b5e3fe6 commit 7334788
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions utils/sccli.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,12 @@ def service_status(service_name):
services = ['etcd', 'kube-apiserver', 'kube-controller-manager',
'kube-scheduler', 'kube-proxy', 'kubelet']
for service in services:
while system("systemctl is-active %s" % service)[0].strip() == 'activating':
time.sleep(1)
status = status or system("systemctl is-active %s" % service)[2]
if status:
service_stop(service_name)
break
return status
else:
while system("systemctl is-active %s" % service_name)[0].strip() == 'activating':
time.sleep(1)
return system("systemctl is-active %s" % service_name)[2]

def service_restart(service_name):
Expand Down Expand Up @@ -236,10 +232,20 @@ def service_start(service_name):
if returncode:
return (output, returncode)
output, returncode = system("systemctl start openshift")[1:]
if output:
return (output, returncode)
# This is required because of proxy configurations.
return system("systemctl restart docker")[1:]
if os.getenv('PROXY', ''):
output, returncode = system("systemctl restart docker")[1:]
if output:
return(output,returncode)
else:
# Since docker service restarted which make openshift service also
# restarted so we need to wait until it start/fail.
while 'activating' in system("systemctl is-active openshift")[0]:
time.sleep(1)
return system("systemctl is-active openshift")[1:]
else:
return(output, returncode)

if service_name == "docker":
return system("systemctl start docker")[1:]

Expand Down

0 comments on commit 7334788

Please sign in to comment.