Use service_pause / service_resume
This commit is contained in:
parent
946d369de6
commit
aa55460f6b
|
@ -5,13 +5,6 @@ from charmhelpers.core import hookenv
|
|||
from charmhelpers.core import host
|
||||
|
||||
if __name__ == "__main__":
|
||||
if not host.service_stop("mysql"):
|
||||
if not host.service_pause("mysql"):
|
||||
hookenv.action_fail("Failed to stop service mysql.")
|
||||
sys.exit(-1)
|
||||
try:
|
||||
override_file = open('/etc/init/mysql.override', 'w')
|
||||
except IOError, e:
|
||||
hookenv.action_fail("Error creating override file: %s\n" % e)
|
||||
sys.exit(-2)
|
||||
override_file.write("manual\n")
|
||||
override_file.close()
|
||||
|
|
|
@ -6,18 +6,8 @@ from charmhelpers.core import hookenv
|
|||
from charmhelpers.core import host
|
||||
|
||||
if __name__ == "__main__":
|
||||
override_path = '/etc/init/mysql.override'
|
||||
if os.path.exists(override_path):
|
||||
try:
|
||||
os.remove(override_path)
|
||||
except OSError, e:
|
||||
hookenv.action_fail("Error removing override file: %s\n" % e)
|
||||
sys.exit(-1)
|
||||
else:
|
||||
print "No override file."
|
||||
|
||||
if not host.service_start("mysql"):
|
||||
if not host.service_resume("mysql"):
|
||||
hookenv.action_fail("Failed to start service mysql.")
|
||||
sys.exit(-2)
|
||||
sys.exit(-1)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue