Merge pull request #119 from dreamhost/distro-work-libvirt-rabbit-956265
move libvirt and rabbitmq commands to yaml file
This commit is contained in:
commit
928ece372b
@ -31,6 +31,17 @@ commands:
|
|||||||
grant_all: ["mysql", "--user=%USER%", "--password=%PASSWORD%", '-e',
|
grant_all: ["mysql", "--user=%USER%", "--password=%PASSWORD%", '-e',
|
||||||
"\"GRANT ALL PRIVILEGES ON *.* TO '%USER%'@'%' IDENTIFIED BY '%PASSWORD%'; FLUSH PRIVILEGES;\""]
|
"\"GRANT ALL PRIVILEGES ON *.* TO '%USER%'@'%' IDENTIFIED BY '%PASSWORD%'; FLUSH PRIVILEGES;\""]
|
||||||
|
|
||||||
|
libvirt:
|
||||||
|
restart: ['service', 'libvirtd', 'restart']
|
||||||
|
status: ['service', 'libvirtd', 'status']
|
||||||
|
|
||||||
|
rabbit-mq:
|
||||||
|
start: ['service', "rabbitmq-server", "start"]
|
||||||
|
stop: ['service', "rabbitmq-server", "stop"]
|
||||||
|
status: ['service', "rabbitmq-server", "status"]
|
||||||
|
restart: ['service', "rabbitmq-server", "restart"]
|
||||||
|
change_password: ['rabbitmqctl', 'change_password', 'guest']
|
||||||
|
|
||||||
components:
|
components:
|
||||||
|
|
||||||
db:
|
db:
|
||||||
@ -459,7 +470,7 @@ components:
|
|||||||
removable: True
|
removable: True
|
||||||
version: 1.12*
|
version: 1.12*
|
||||||
|
|
||||||
rabbitmq:
|
rabbit-mq:
|
||||||
packages:
|
packages:
|
||||||
- name: rabbitmq-server
|
- name: rabbitmq-server
|
||||||
pre-install:
|
pre-install:
|
||||||
|
@ -33,7 +33,6 @@ commands:
|
|||||||
- service
|
- service
|
||||||
- libvirtd
|
- libvirtd
|
||||||
- status
|
- status
|
||||||
libvirt-daemon: libvirtd
|
|
||||||
mysql:
|
mysql:
|
||||||
# NOTE: we aren't stopping any sql injection...
|
# NOTE: we aren't stopping any sql injection...
|
||||||
create_db:
|
create_db:
|
||||||
@ -79,6 +78,14 @@ commands:
|
|||||||
- mysqld
|
- mysqld
|
||||||
- stop
|
- stop
|
||||||
pip: pip-python
|
pip: pip-python
|
||||||
|
|
||||||
|
rabbit-mq:
|
||||||
|
start: ['service', "rabbitmq-server", "start"]
|
||||||
|
stop: ['service', "rabbitmq-server", "stop"]
|
||||||
|
status: ['service', "rabbitmq-server", "status"]
|
||||||
|
restart: ['service', "rabbitmq-server", "restart"]
|
||||||
|
change_password: ['rabbitmqctl', 'change_password', 'guest']
|
||||||
|
|
||||||
components:
|
components:
|
||||||
db:
|
db:
|
||||||
install: devstack.distros.rhel6:DBInstaller
|
install: devstack.distros.rhel6:DBInstaller
|
||||||
|
@ -49,7 +49,6 @@ commands:
|
|||||||
- service
|
- service
|
||||||
- libvirt-bin
|
- libvirt-bin
|
||||||
- status
|
- status
|
||||||
libvirt-daemon: libvirt-bin
|
|
||||||
mysql:
|
mysql:
|
||||||
# NOTE: we aren't stopping any sql injection...
|
# NOTE: we aren't stopping any sql injection...
|
||||||
create_db:
|
create_db:
|
||||||
@ -95,6 +94,13 @@ commands:
|
|||||||
- mysql
|
- mysql
|
||||||
- stop
|
- stop
|
||||||
pip: pip
|
pip: pip
|
||||||
|
rabbit-mq:
|
||||||
|
start: ['service', "rabbitmq-server", "start"]
|
||||||
|
stop: ['service', "rabbitmq-server", "stop"]
|
||||||
|
status: ['service', "rabbitmq-server", "status"]
|
||||||
|
restart: ['service', "rabbitmq-server", "restart"]
|
||||||
|
change_password: ['rabbitmqctl', 'change_password', 'guest']
|
||||||
|
|
||||||
components:
|
components:
|
||||||
db:
|
db:
|
||||||
install: devstack.distros.oneiric:DBInstaller
|
install: devstack.distros.oneiric:DBInstaller
|
||||||
|
@ -23,13 +23,6 @@ from devstack import shell as sh
|
|||||||
|
|
||||||
LOG = logging.getLogger("devstack.components.rabbit")
|
LOG = logging.getLogger("devstack.components.rabbit")
|
||||||
|
|
||||||
# So far these are distro independent..
|
|
||||||
START_CMD = ['service', "rabbitmq-server", "start"]
|
|
||||||
STOP_CMD = ['service', "rabbitmq-server", "stop"]
|
|
||||||
STATUS_CMD = ['service', "rabbitmq-server", "status"]
|
|
||||||
RESTART_CMD = ['service', "rabbitmq-server", "restart"]
|
|
||||||
PWD_CMD = ['rabbitmqctl', 'change_password', 'guest']
|
|
||||||
|
|
||||||
# Default password (guest)
|
# Default password (guest)
|
||||||
RESET_BASE_PW = ''
|
RESET_BASE_PW = ''
|
||||||
|
|
||||||
@ -52,7 +45,7 @@ class RabbitUninstaller(comp.PkgUninstallComponent):
|
|||||||
try:
|
try:
|
||||||
self.runtime.restart()
|
self.runtime.restart()
|
||||||
LOG.info("Attempting to reset the rabbit-mq guest password to \"%s\"", RESET_BASE_PW)
|
LOG.info("Attempting to reset the rabbit-mq guest password to \"%s\"", RESET_BASE_PW)
|
||||||
cmd = PWD_CMD + [RESET_BASE_PW]
|
cmd = self.distro.get_command('rabbit-mq', 'change_password') + [RESET_BASE_PW]
|
||||||
sh.execute(*cmd, run_as_root=True)
|
sh.execute(*cmd, run_as_root=True)
|
||||||
except IOError:
|
except IOError:
|
||||||
LOG.warn(("Could not reset the rabbit-mq password. You might have to manually "
|
LOG.warn(("Could not reset the rabbit-mq password. You might have to manually "
|
||||||
@ -72,7 +65,7 @@ class RabbitInstaller(comp.PkgInstallComponent):
|
|||||||
LOG.info("Setting up your rabbit-mq guest password.")
|
LOG.info("Setting up your rabbit-mq guest password.")
|
||||||
self.runtime.restart()
|
self.runtime.restart()
|
||||||
passwd = self.pw_gen.get_password("rabbit", PW_USER_PROMPT)
|
passwd = self.pw_gen.get_password("rabbit", PW_USER_PROMPT)
|
||||||
cmd = PWD_CMD + [passwd]
|
cmd = self.distro.get_command('rabbit-mq', 'change_password') + [passwd]
|
||||||
sh.execute(*cmd, run_as_root=True)
|
sh.execute(*cmd, run_as_root=True)
|
||||||
LOG.info("Restarting so that your rabbit-mq guest password is reflected.")
|
LOG.info("Restarting so that your rabbit-mq guest password is reflected.")
|
||||||
self.runtime.restart()
|
self.runtime.restart()
|
||||||
@ -88,7 +81,7 @@ class RabbitRuntime(comp.EmptyRuntime):
|
|||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
if self.status() != comp.STATUS_STARTED:
|
if self.status() != comp.STATUS_STARTED:
|
||||||
self._run_cmd(START_CMD)
|
self._run_cmd(self.distro.get_command('rabbit-mq', 'start'))
|
||||||
return 1
|
return 1
|
||||||
else:
|
else:
|
||||||
return 0
|
return 0
|
||||||
@ -97,9 +90,10 @@ class RabbitRuntime(comp.EmptyRuntime):
|
|||||||
# This has got to be the worst status output.
|
# This has got to be the worst status output.
|
||||||
#
|
#
|
||||||
# I have ever seen (its like a weird mix json+crap)
|
# I have ever seen (its like a weird mix json+crap)
|
||||||
run_result = sh.execute(*STATUS_CMD,
|
run_result = sh.execute(
|
||||||
check_exit_code=False,
|
*self.distro.get_command('rabbit-mq', 'status'),
|
||||||
run_as_root=True)
|
check_exit_code=False,
|
||||||
|
run_as_root=True)
|
||||||
if not run_result:
|
if not run_result:
|
||||||
return comp.STATUS_UNKNOWN
|
return comp.STATUS_UNKNOWN
|
||||||
(sysout, stderr) = run_result
|
(sysout, stderr) = run_result
|
||||||
@ -129,14 +123,14 @@ class RabbitRuntime(comp.EmptyRuntime):
|
|||||||
|
|
||||||
def restart(self):
|
def restart(self):
|
||||||
LOG.info("Restarting rabbit-mq.")
|
LOG.info("Restarting rabbit-mq.")
|
||||||
self._run_cmd(RESTART_CMD)
|
self._run_cmd(self.distro.get_command('rabbit-mq', 'restart'))
|
||||||
LOG.info("Please wait %s seconds while it starts up." % (WAIT_ON_TIME))
|
LOG.info("Please wait %s seconds while it starts up." % (WAIT_ON_TIME))
|
||||||
sh.sleep(WAIT_ON_TIME)
|
sh.sleep(WAIT_ON_TIME)
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
if self.status() != comp.STATUS_STOPPED:
|
if self.status() != comp.STATUS_STOPPED:
|
||||||
self._run_cmd(STOP_CMD)
|
self._run_cmd(self.distro.get_command('rabbit-mq', 'stop'))
|
||||||
return 1
|
return 1
|
||||||
else:
|
else:
|
||||||
return 0
|
return 0
|
||||||
|
@ -32,19 +32,6 @@ LIBVIRT_PROTOCOL_MAP = {
|
|||||||
}
|
}
|
||||||
VIRT_LIB = 'libvirt'
|
VIRT_LIB = 'libvirt'
|
||||||
|
|
||||||
# #distros name the libvirt service differently :-(
|
|
||||||
# SV_NAME_MAP = {
|
|
||||||
# settings.RHEL6: 'libvirtd',
|
|
||||||
# settings.FEDORA16: 'libvirtd',
|
|
||||||
# settings.UBUNTU11: 'libvirt-bin',
|
|
||||||
# }
|
|
||||||
|
|
||||||
# #how libvirt is restarted
|
|
||||||
# LIBVIRT_RESTART_CMD = ['service', '%SERVICE%', 'restart']
|
|
||||||
|
|
||||||
# #how we check its status
|
|
||||||
# LIBVIRT_STATUS_CMD = ['service', '%SERVICE%', 'status']
|
|
||||||
|
|
||||||
# This is just used to check that libvirt will work with
|
# This is just used to check that libvirt will work with
|
||||||
# a given protocol, may not be ideal but does seem to crap
|
# a given protocol, may not be ideal but does seem to crap
|
||||||
# out if it won't work, so thats good...
|
# out if it won't work, so thats good...
|
||||||
|
Loading…
Reference in New Issue
Block a user