Switch all of the commands in YAML files to simple strings and
parse them into lists in the code that fetches commands from the config.
This commit is contained in:
parent
462eee3a99
commit
cefd378401
File diff suppressed because it is too large
Load Diff
@ -1,101 +1,42 @@
|
|||||||
---
|
---
|
||||||
# RedHat Enterprise Linux 6
|
# RedHat Enterprise Linux 6
|
||||||
distro_pattern: redhat-6(.*)
|
|
||||||
name: rhel-6
|
name: rhel-6
|
||||||
packager_name: devstack.distros.rhel6:YumPackager
|
distro_pattern: redhat-6(.*)
|
||||||
commands:
|
commands:
|
||||||
apache:
|
apache:
|
||||||
restart:
|
restart: service httpd restart
|
||||||
- service
|
|
||||||
- httpd
|
|
||||||
- restart
|
|
||||||
settings:
|
settings:
|
||||||
# Ensure runs after wsgi.conf (file naming wise)
|
|
||||||
conf-link-target: /etc/httpd/conf.d/wsgi-horizon-000-default.conf
|
conf-link-target: /etc/httpd/conf.d/wsgi-horizon-000-default.conf
|
||||||
start:
|
start: service httpd start
|
||||||
- service
|
status: service httpd status
|
||||||
- httpd
|
stop: service httpd stop
|
||||||
- start
|
|
||||||
status:
|
|
||||||
- service
|
|
||||||
- httpd
|
|
||||||
- status
|
|
||||||
stop:
|
|
||||||
- service
|
|
||||||
- httpd
|
|
||||||
- stop
|
|
||||||
git:
|
git:
|
||||||
checkout:
|
checkout: git checkout
|
||||||
- git
|
clone: git clone
|
||||||
- checkout
|
pull: git pull
|
||||||
clone:
|
|
||||||
- git
|
|
||||||
- clone
|
|
||||||
pull:
|
|
||||||
- git
|
|
||||||
- pull
|
|
||||||
libvirt:
|
libvirt:
|
||||||
restart:
|
restart: service libvirtd restart
|
||||||
- service
|
status: service libvirtd status
|
||||||
- libvirtd
|
|
||||||
- restart
|
|
||||||
status:
|
|
||||||
- service
|
|
||||||
- libvirtd
|
|
||||||
- status
|
|
||||||
mysql:
|
mysql:
|
||||||
# NOTE: we aren't stopping any sql injection...
|
create_db: mysql --user=%USER% --password=%PASSWORD% -e "CREATE DATABASE %DB%;"
|
||||||
create_db:
|
drop_db: mysql --user=%USER% --password=%PASSWORD% -e "DROP DATABASE IF EXISTS
|
||||||
- mysql
|
%DB%;"
|
||||||
- --user=%USER%
|
grant_all: mysql --user=%USER% --password=%PASSWORD% -e "GRANT ALL PRIVILEGES
|
||||||
- --password=%PASSWORD%
|
ON *.* TO '%USER%'@'%' IDENTIFIED BY '%PASSWORD%'; FLUSH PRIVILEGES;"
|
||||||
- -e
|
restart: service mysqld restart
|
||||||
- CREATE DATABASE %DB%;
|
set_pwd: mysql --user=%USER% --password=%OLD_PASSWORD% -e "USE mysql; UPDATE
|
||||||
drop_db:
|
user SET password=PASSWORD('%NEW_PASSWORD%') WHERE User='%USER%'; FLUSH
|
||||||
- mysql
|
PRIVILEGES;"
|
||||||
- --user=%USER%
|
start: service mysqld start
|
||||||
- --password=%PASSWORD%
|
status: service mysqld status
|
||||||
- -e
|
stop: service mysqld stop
|
||||||
- DROP DATABASE IF EXISTS %DB%;
|
|
||||||
grant_all:
|
|
||||||
- mysql
|
|
||||||
- --user=%USER%
|
|
||||||
- --password=%PASSWORD%
|
|
||||||
- -e
|
|
||||||
- '"GRANT ALL PRIVILEGES ON *.* TO ''%USER%''@''%'' IDENTIFIED BY ''%PASSWORD%'';
|
|
||||||
FLUSH PRIVILEGES;"'
|
|
||||||
restart:
|
|
||||||
- service
|
|
||||||
- mysqld
|
|
||||||
- restart
|
|
||||||
set_pwd:
|
|
||||||
- mysql
|
|
||||||
- --user=%USER%
|
|
||||||
- --password=%OLD_PASSWORD%
|
|
||||||
- -e
|
|
||||||
- '"USE mysql; UPDATE user SET password=PASSWORD(''%NEW_PASSWORD%'') WHERE
|
|
||||||
User=''%USER%''; FLUSH PRIVILEGES;"'
|
|
||||||
start:
|
|
||||||
- service
|
|
||||||
- mysqld
|
|
||||||
- start
|
|
||||||
status:
|
|
||||||
- service
|
|
||||||
- mysqld
|
|
||||||
- status
|
|
||||||
stop:
|
|
||||||
- service
|
|
||||||
- mysqld
|
|
||||||
- stop
|
|
||||||
pip: pip-python
|
pip: pip-python
|
||||||
|
|
||||||
rabbit-mq:
|
rabbit-mq:
|
||||||
start: ['service', "rabbitmq-server", "start"]
|
change_password: rabbitmqctl change_password guest
|
||||||
stop: ['service', "rabbitmq-server", "stop"]
|
restart: service rabbitmq-server restart
|
||||||
status: ['service', "rabbitmq-server", "status"]
|
start: service rabbitmq-server start
|
||||||
restart: ['service', "rabbitmq-server", "restart"]
|
status: service rabbitmq-server status
|
||||||
change_password: ['rabbitmqctl', 'change_password', 'guest']
|
stop: service rabbitmq-server stop
|
||||||
|
|
||||||
components:
|
components:
|
||||||
db:
|
db:
|
||||||
install: devstack.distros.rhel6:DBInstaller
|
install: devstack.distros.rhel6:DBInstaller
|
||||||
@ -702,5 +643,6 @@ components:
|
|||||||
start: devstack.components.swift:SwiftRuntime
|
start: devstack.components.swift:SwiftRuntime
|
||||||
stop: devstack.components.swift:SwiftRuntime
|
stop: devstack.components.swift:SwiftRuntime
|
||||||
uninstall: devstack.components.swift:SwiftUninstaller
|
uninstall: devstack.components.swift:SwiftUninstaller
|
||||||
|
packager_name: devstack.distros.rhel6:YumPackager
|
||||||
...
|
...
|
||||||
|
|
||||||
|
@ -5,111 +5,41 @@ name: ubuntu-oneiric
|
|||||||
packager_name: devstack.distros.oneiric:AptPackager
|
packager_name: devstack.distros.oneiric:AptPackager
|
||||||
commands:
|
commands:
|
||||||
apache:
|
apache:
|
||||||
restart:
|
restart: service apache2 restart
|
||||||
- service
|
|
||||||
- apache2
|
|
||||||
- restart
|
|
||||||
settings:
|
settings:
|
||||||
conf-link-target: /etc/apache2/sites-enabled/000-default
|
conf-link-target: /etc/apache2/sites-enabled/000-default
|
||||||
start:
|
start: service apache2 start
|
||||||
- service
|
status: service apache2 status
|
||||||
- apache2
|
stop: service apache2 stop
|
||||||
- start
|
|
||||||
status:
|
|
||||||
- service
|
|
||||||
- apache2
|
|
||||||
- status
|
|
||||||
stop:
|
|
||||||
- service
|
|
||||||
- apache2
|
|
||||||
- stop
|
|
||||||
git:
|
git:
|
||||||
checkout:
|
checkout: git checkout
|
||||||
- git
|
clone: git clone
|
||||||
- checkout
|
pull: git pull
|
||||||
clone:
|
|
||||||
- git
|
|
||||||
- clone
|
|
||||||
pull:
|
|
||||||
- git
|
|
||||||
- pull
|
|
||||||
iscsi:
|
iscsi:
|
||||||
restart:
|
restart: service tgt restart
|
||||||
- service
|
start: service tgt start
|
||||||
- tgt
|
status: service tgt status
|
||||||
- restart
|
stop: service tgt stop
|
||||||
start:
|
|
||||||
- service
|
|
||||||
- tgt
|
|
||||||
- start
|
|
||||||
status:
|
|
||||||
- service
|
|
||||||
- tgt
|
|
||||||
- status
|
|
||||||
stop:
|
|
||||||
- service
|
|
||||||
- tgt
|
|
||||||
- stop
|
|
||||||
libvirt:
|
libvirt:
|
||||||
restart:
|
restart: service libvirt-bin restart
|
||||||
- service
|
status: service libvirt-bin status
|
||||||
- libvirt-bin
|
|
||||||
- restart
|
|
||||||
status:
|
|
||||||
- service
|
|
||||||
- libvirt-bin
|
|
||||||
- status
|
|
||||||
mysql:
|
mysql:
|
||||||
# NOTE: we aren't stopping any sql injection...
|
# NOTE: we aren't stopping any sql injection...
|
||||||
create_db:
|
create_db: mysql --user=%USER% --password=%PASSWORD% -e "CREATE DATABASE %DB%;"
|
||||||
- mysql
|
drop_db: mysql --user=%USER% --password=%PASSWORD% -e "DROP DATABASE IF EXISTS %DB%;"
|
||||||
- --user=%USER%
|
grant_all: mysql --user=%USER% --password=%PASSWORD% -e "GRANT ALL PRIVILEGES ON *.* TO '%USER%'@'%' IDENTIFIED BY '%PASSWORD%'; FLUSH PRIVILEGES;"
|
||||||
- --password=%PASSWORD%
|
restart: service mysql restart
|
||||||
- -e
|
set_pwd: mysql --user=%USER% --password=%OLD_PASSWORD% -e "USE mysql; UPDATE user SET password=PASSWORD('%NEW_PASSWORD%') WHERE User='%USER%'; FLUSH PRIVILEGES;"
|
||||||
- CREATE DATABASE %DB%;
|
start: service mysql start
|
||||||
drop_db:
|
status: service mysql status
|
||||||
- mysql
|
stop: service mysql stop
|
||||||
- --user=%USER%
|
|
||||||
- --password=%PASSWORD%
|
|
||||||
- -e
|
|
||||||
- DROP DATABASE IF EXISTS %DB%;
|
|
||||||
grant_all:
|
|
||||||
- mysql
|
|
||||||
- --user=%USER%
|
|
||||||
- --password=%PASSWORD%
|
|
||||||
- -e
|
|
||||||
- '"GRANT ALL PRIVILEGES ON *.* TO ''%USER%''@''%'' IDENTIFIED BY ''%PASSWORD%'';
|
|
||||||
FLUSH PRIVILEGES;"'
|
|
||||||
restart:
|
|
||||||
- service
|
|
||||||
- mysql
|
|
||||||
- restart
|
|
||||||
set_pwd:
|
|
||||||
- mysql
|
|
||||||
- --user=%USER%
|
|
||||||
- --password=%OLD_PASSWORD%
|
|
||||||
- -e
|
|
||||||
- '"USE mysql; UPDATE user SET password=PASSWORD(''%NEW_PASSWORD%'') WHERE
|
|
||||||
User=''%USER%''; FLUSH PRIVILEGES;"'
|
|
||||||
start:
|
|
||||||
- service
|
|
||||||
- mysql
|
|
||||||
- start
|
|
||||||
status:
|
|
||||||
- service
|
|
||||||
- mysql
|
|
||||||
- status
|
|
||||||
stop:
|
|
||||||
- service
|
|
||||||
- mysql
|
|
||||||
- stop
|
|
||||||
pip: pip
|
pip: pip
|
||||||
rabbit-mq:
|
rabbit-mq:
|
||||||
start: ['service', "rabbitmq-server", "start"]
|
start: service rabbitmq-server start
|
||||||
stop: ['service', "rabbitmq-server", "stop"]
|
stop: service rabbitmq-server stop
|
||||||
status: ['service', "rabbitmq-server", "status"]
|
status: service rabbitmq-server status
|
||||||
restart: ['service', "rabbitmq-server", "restart"]
|
restart: service rabbitmq-server restart
|
||||||
change_password: ['rabbitmqctl', 'change_password', 'guest']
|
change_password: rabbitmqctl change_password guest
|
||||||
|
|
||||||
components:
|
components:
|
||||||
db:
|
db:
|
||||||
|
@ -53,12 +53,12 @@ class DBUninstaller(comp.PkgUninstallComponent):
|
|||||||
|
|
||||||
def pre_uninstall(self):
|
def pre_uninstall(self):
|
||||||
dbtype = self.cfg.get("db", "type")
|
dbtype = self.cfg.get("db", "type")
|
||||||
dbactions = self.distro.get_command(dbtype, quiet=True)
|
dbactions = self.distro.get_command_config(dbtype, quiet=True)
|
||||||
try:
|
try:
|
||||||
if dbactions:
|
if dbactions:
|
||||||
LOG.info(("Attempting to reset your db password to \"%s\" so"
|
LOG.info(("Attempting to reset your db password to \"%s\" so"
|
||||||
" that we can set it the next time you install.") % (RESET_BASE_PW))
|
" that we can set it the next time you install.") % (RESET_BASE_PW))
|
||||||
pwd_cmd = dbactions.get('set_pwd')
|
pwd_cmd = self.distro.get_command(dbtype, 'set_pwd')
|
||||||
if pwd_cmd:
|
if pwd_cmd:
|
||||||
LOG.info("Ensuring your database is started before we operate on it.")
|
LOG.info("Ensuring your database is started before we operate on it.")
|
||||||
self.runtime.restart()
|
self.runtime.restart()
|
||||||
@ -68,7 +68,7 @@ class DBUninstaller(comp.PkgUninstallComponent):
|
|||||||
'USER': self.cfg.getdefaulted("db", "sql_user", 'root'),
|
'USER': self.cfg.getdefaulted("db", "sql_user", 'root'),
|
||||||
}
|
}
|
||||||
cmds = [{'cmd': pwd_cmd}]
|
cmds = [{'cmd': pwd_cmd}]
|
||||||
utils.execute_template(*cmds, params=params, shell=True)
|
utils.execute_template(*cmds, params=params)
|
||||||
except IOError:
|
except IOError:
|
||||||
LOG.warn(("Could not reset the database password. You might have to manually "
|
LOG.warn(("Could not reset the database password. You might have to manually "
|
||||||
"reset the password to \"%s\" before the next install") % (RESET_BASE_PW))
|
"reset the password to \"%s\" before the next install") % (RESET_BASE_PW))
|
||||||
@ -111,12 +111,12 @@ class DBInstaller(comp.PkgInstallComponent):
|
|||||||
|
|
||||||
# Extra actions to ensure we are granted access
|
# Extra actions to ensure we are granted access
|
||||||
dbtype = self.cfg.get("db", "type")
|
dbtype = self.cfg.get("db", "type")
|
||||||
dbactions = self.distro.get_command(dbtype, quiet=True)
|
dbactions = self.distro.get_command_config(dbtype, quiet=True)
|
||||||
|
|
||||||
# Set your password
|
# Set your password
|
||||||
try:
|
try:
|
||||||
if dbactions:
|
if dbactions:
|
||||||
pwd_cmd = dbactions.get('set_pwd')
|
pwd_cmd = self.distro.get_command(dbtype, 'set_pwd')
|
||||||
if pwd_cmd:
|
if pwd_cmd:
|
||||||
LOG.info(("Attempting to set your db password"
|
LOG.info(("Attempting to set your db password"
|
||||||
" just incase it wasn't set previously."))
|
" just incase it wasn't set previously."))
|
||||||
@ -128,14 +128,14 @@ class DBInstaller(comp.PkgInstallComponent):
|
|||||||
'OLD_PASSWORD': RESET_BASE_PW,
|
'OLD_PASSWORD': RESET_BASE_PW,
|
||||||
}
|
}
|
||||||
cmds = [{'cmd': pwd_cmd}]
|
cmds = [{'cmd': pwd_cmd}]
|
||||||
utils.execute_template(*cmds, params=params, shell=True)
|
utils.execute_template(*cmds, params=params)
|
||||||
except IOError:
|
except IOError:
|
||||||
LOG.warn(("Couldn't set your db password. It might have already been "
|
LOG.warn(("Couldn't set your db password. It might have already been "
|
||||||
"set by a previous process."))
|
"set by a previous process."))
|
||||||
|
|
||||||
# Ensure access granted
|
# Ensure access granted
|
||||||
if dbactions:
|
if dbactions:
|
||||||
grant_cmd = dbactions.get('grant_all')
|
grant_cmd = self.distro.get_command(dbtype, 'grant_all')
|
||||||
if grant_cmd:
|
if grant_cmd:
|
||||||
user = self.cfg.getdefaulted("db", "sql_user", 'root')
|
user = self.cfg.getdefaulted("db", "sql_user", 'root')
|
||||||
LOG.info("Updating the DB to give user '%s' full control of all databases." % (user))
|
LOG.info("Updating the DB to give user '%s' full control of all databases." % (user))
|
||||||
@ -148,7 +148,7 @@ class DBInstaller(comp.PkgInstallComponent):
|
|||||||
cmds = [{'cmd': grant_cmd}]
|
cmds = [{'cmd': grant_cmd}]
|
||||||
# Shell seems to be needed here
|
# Shell seems to be needed here
|
||||||
# since python escapes this to much...
|
# since python escapes this to much...
|
||||||
utils.execute_template(*cmds, params=params, shell=True)
|
utils.execute_template(*cmds, params=params)
|
||||||
|
|
||||||
|
|
||||||
class DBRuntime(comp.EmptyRuntime):
|
class DBRuntime(comp.EmptyRuntime):
|
||||||
@ -158,11 +158,11 @@ class DBRuntime(comp.EmptyRuntime):
|
|||||||
|
|
||||||
def _get_run_actions(self, act, exception_cls):
|
def _get_run_actions(self, act, exception_cls):
|
||||||
dbtype = self.cfg.get("db", "type")
|
dbtype = self.cfg.get("db", "type")
|
||||||
distro_options = self.distro.get_command(dbtype)
|
distro_options = self.distro.get_command_config(dbtype)
|
||||||
if distro_options is None:
|
if distro_options is None:
|
||||||
msg = BASE_ERROR % (act, dbtype)
|
msg = BASE_ERROR % (act, dbtype)
|
||||||
raise NotImplementedError(msg)
|
raise NotImplementedError(msg)
|
||||||
return distro_options.get(act)
|
return self.distro.get_command(dbtype, act)
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
if self.status() != comp.STATUS_STARTED:
|
if self.status() != comp.STATUS_STARTED:
|
||||||
@ -190,8 +190,8 @@ class DBRuntime(comp.EmptyRuntime):
|
|||||||
LOG.info("Restarting your database.")
|
LOG.info("Restarting your database.")
|
||||||
restartcmd = self._get_run_actions('restart', excp.RestartException)
|
restartcmd = self._get_run_actions('restart', excp.RestartException)
|
||||||
sh.execute(*restartcmd,
|
sh.execute(*restartcmd,
|
||||||
run_as_root=True,
|
run_as_root=True,
|
||||||
check_exit_code=True)
|
check_exit_code=True)
|
||||||
LOG.info("Please wait %s seconds while it restarts." % self.wait_time)
|
LOG.info("Please wait %s seconds while it restarts." % self.wait_time)
|
||||||
sh.sleep(self.wait_time)
|
sh.sleep(self.wait_time)
|
||||||
return 1
|
return 1
|
||||||
@ -217,9 +217,8 @@ class DBRuntime(comp.EmptyRuntime):
|
|||||||
|
|
||||||
def drop_db(cfg, pw_gen, distro, dbname):
|
def drop_db(cfg, pw_gen, distro, dbname):
|
||||||
dbtype = cfg.get("db", "type")
|
dbtype = cfg.get("db", "type")
|
||||||
dbactions = distro.get_command(dbtype)
|
dropcmd = distro.get_command(dbtype, 'drop_db', silent=True)
|
||||||
if dbactions and dbactions.get('drop_db'):
|
if dropcmd:
|
||||||
dropcmd = dbactions.get('drop_db')
|
|
||||||
params = dict()
|
params = dict()
|
||||||
params['PASSWORD'] = pw_gen.get_password("sql", PASSWORD_PROMPT)
|
params['PASSWORD'] = pw_gen.get_password("sql", PASSWORD_PROMPT)
|
||||||
params['USER'] = cfg.getdefaulted("db", "sql_user", 'root')
|
params['USER'] = cfg.getdefaulted("db", "sql_user", 'root')
|
||||||
@ -237,9 +236,8 @@ def drop_db(cfg, pw_gen, distro, dbname):
|
|||||||
|
|
||||||
def create_db(cfg, pw_gen, distro, dbname):
|
def create_db(cfg, pw_gen, distro, dbname):
|
||||||
dbtype = cfg.get("db", "type")
|
dbtype = cfg.get("db", "type")
|
||||||
dbactions = distro.get_command(dbtype)
|
createcmd = distro.get_command(dbtype, 'create_db', silent=True)
|
||||||
if dbactions and dbactions.get('create_db'):
|
if createcmd:
|
||||||
createcmd = dbactions.get('create_db')
|
|
||||||
params = dict()
|
params = dict()
|
||||||
params['PASSWORD'] = pw_gen.get_password("sql", PASSWORD_PROMPT)
|
params['PASSWORD'] = pw_gen.get_password("sql", PASSWORD_PROMPT)
|
||||||
params['USER'] = cfg.getdefaulted("db", "sql_user", 'root')
|
params['USER'] = cfg.getdefaulted("db", "sql_user", 'root')
|
||||||
|
@ -80,8 +80,9 @@ class HorizonInstaller(comp.PythonInstallComponent):
|
|||||||
|
|
||||||
def _get_symlinks(self):
|
def _get_symlinks(self):
|
||||||
links = comp.PythonInstallComponent._get_symlinks(self)
|
links = comp.PythonInstallComponent._get_symlinks(self)
|
||||||
link_tgt = self.distro.get_command('apache', 'settings',
|
link_tgt = self.distro.get_command_config(
|
||||||
'conf-link-target', quiet=True)
|
'apache', 'settings', 'conf-link-target',
|
||||||
|
quiet=True)
|
||||||
if link_tgt:
|
if link_tgt:
|
||||||
src = self._get_target_config_name(HORIZON_APACHE_CONF)
|
src = self._get_target_config_name(HORIZON_APACHE_CONF)
|
||||||
links[src] = link_tgt
|
links[src] = link_tgt
|
||||||
|
@ -49,6 +49,8 @@ RSYNC_SERVICE_RESTART = ['service', 'rsync', 'restart']
|
|||||||
RSYSLOG_SERVICE_RESTART = ['service', 'rsyslog', 'restart']
|
RSYSLOG_SERVICE_RESTART = ['service', 'rsyslog', 'restart']
|
||||||
RSYNC_ON_OFF_RE = re.compile(r'^\s*RSYNC_ENABLE\s*=\s*(.*)$', re.I)
|
RSYNC_ON_OFF_RE = re.compile(r'^\s*RSYNC_ENABLE\s*=\s*(.*)$', re.I)
|
||||||
|
|
||||||
|
# FIXME: This should come from the persona, if we really expect
|
||||||
|
# people to change it.
|
||||||
# Defines our auth service type
|
# Defines our auth service type
|
||||||
AUTH_SERVICE = 'keystone'
|
AUTH_SERVICE = 'keystone'
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
import glob
|
import glob
|
||||||
import platform
|
import platform
|
||||||
import re
|
import re
|
||||||
|
import shlex
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
@ -84,7 +85,7 @@ class Distro(object):
|
|||||||
self._commands = commands
|
self._commands = commands
|
||||||
self._components = components
|
self._components = components
|
||||||
|
|
||||||
def get_command(self, key, *more_keys, **kargs):
|
def get_command_config(self, key, *more_keys, **kargs):
|
||||||
""" Gets a end object for a given set of keys """
|
""" Gets a end object for a given set of keys """
|
||||||
root = self._commands
|
root = self._commands
|
||||||
acutal_keys = [key] + list(more_keys)
|
acutal_keys = [key] + list(more_keys)
|
||||||
@ -105,9 +106,18 @@ class Distro(object):
|
|||||||
end_value = root[end_key]
|
end_value = root[end_key]
|
||||||
else:
|
else:
|
||||||
end_value = root.get(end_key)
|
end_value = root.get(end_key)
|
||||||
LOG.debug("Retrieved end command: %s", end_value)
|
LOG.debug("Retrieved end command config: %s", end_value)
|
||||||
return end_value
|
return end_value
|
||||||
|
|
||||||
|
def get_command(self, key, *more_keys, **kargs):
|
||||||
|
"""Retrieves a string for running a command from the setup
|
||||||
|
and splits it to return a list.
|
||||||
|
"""
|
||||||
|
val = self.get_command_config(key, *more_keys, **kargs)
|
||||||
|
ret_val = shlex.split(val) if val else []
|
||||||
|
LOG.debug("Parsed configured command: %s", ret_val)
|
||||||
|
return ret_val
|
||||||
|
|
||||||
def known_component(self, name):
|
def known_component(self, name):
|
||||||
return name in self._components
|
return name in self._components
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ def _make_pip_name(name, version):
|
|||||||
|
|
||||||
def install(pip, distro):
|
def install(pip, distro):
|
||||||
name = pip['name']
|
name = pip['name']
|
||||||
root_cmd = distro.get_command('pip')
|
root_cmd = distro.get_command_config('pip')
|
||||||
LOG.audit("Installing python package (%s) using pip command (%s)" % (name, root_cmd))
|
LOG.audit("Installing python package (%s) using pip command (%s)" % (name, root_cmd))
|
||||||
name_full = _make_pip_name(name, pip.get('version'))
|
name_full = _make_pip_name(name, pip.get('version'))
|
||||||
real_cmd = [root_cmd, 'install'] + PIP_INSTALL_CMD_OPTS
|
real_cmd = [root_cmd, 'install'] + PIP_INSTALL_CMD_OPTS
|
||||||
|
@ -101,9 +101,9 @@ def execute(*cmd, **kwargs):
|
|||||||
execute_cmd = str_cmd.strip()
|
execute_cmd = str_cmd.strip()
|
||||||
|
|
||||||
if not shell:
|
if not shell:
|
||||||
LOG.audit('Running cmd: %s' % (execute_cmd))
|
LOG.audit('Running cmd: %r' % (execute_cmd))
|
||||||
else:
|
else:
|
||||||
LOG.audit('Running shell cmd: %s' % (execute_cmd))
|
LOG.audit('Running shell cmd: %r' % (execute_cmd))
|
||||||
|
|
||||||
if process_input is not None:
|
if process_input is not None:
|
||||||
LOG.audit('With stdin: %s' % (process_input))
|
LOG.audit('With stdin: %s' % (process_input))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user