Pep8 fixes, other cleanups and json comment cleanups and keystone bash script removal and replacement with json containing commands.

This commit is contained in:
Joshua Harlow 2012-01-12 20:30:48 -08:00
parent db50e2dc3c
commit 6be35a699b
22 changed files with 439 additions and 169 deletions

@ -1,56 +0,0 @@
#!/bin/bash
BIN_DIR=${BIN_DIR:-.}
# Tenants
$BIN_DIR/keystone-manage $* tenant add admin
$BIN_DIR/keystone-manage $* tenant add demo
$BIN_DIR/keystone-manage $* tenant add invisible_to_admin
# Users
$BIN_DIR/keystone-manage $* user add admin %ADMIN_PASSWORD%
$BIN_DIR/keystone-manage $* user add demo %ADMIN_PASSWORD%
# Roles
$BIN_DIR/keystone-manage $* role add Admin
$BIN_DIR/keystone-manage $* role add Member
$BIN_DIR/keystone-manage $* role add KeystoneAdmin
$BIN_DIR/keystone-manage $* role add KeystoneServiceAdmin
$BIN_DIR/keystone-manage $* role add sysadmin
$BIN_DIR/keystone-manage $* role add netadmin
$BIN_DIR/keystone-manage $* role grant Admin admin admin
$BIN_DIR/keystone-manage $* role grant Member demo demo
$BIN_DIR/keystone-manage $* role grant sysadmin demo demo
$BIN_DIR/keystone-manage $* role grant netadmin demo demo
$BIN_DIR/keystone-manage $* role grant Member demo invisible_to_admin
$BIN_DIR/keystone-manage $* role grant Admin admin demo
$BIN_DIR/keystone-manage $* role grant Admin admin
$BIN_DIR/keystone-manage $* role grant KeystoneAdmin admin
$BIN_DIR/keystone-manage $* role grant KeystoneServiceAdmin admin
# Services
$BIN_DIR/keystone-manage $* service add nova compute "Nova Compute Service"
$BIN_DIR/keystone-manage $* service add ec2 ec2 "EC2 Compatability Layer"
$BIN_DIR/keystone-manage $* service add glance image "Glance Image Service"
$BIN_DIR/keystone-manage $* service add keystone identity "Keystone Identity Service"
if [[ "$ENABLED_SERVICES" =~ "swift" ]]; then
$BIN_DIR/keystone-manage $* service add swift object-store "Swift Service"
fi
#endpointTemplates
$BIN_DIR/keystone-manage $* endpointTemplates add RegionOne nova http://%HOST_IP%:8774/v1.1/%tenant_id% http://%HOST_IP%:8774/v1.1/%tenant_id% http://%HOST_IP%:8774/v1.1/%tenant_id% 1 1
$BIN_DIR/keystone-manage $* endpointTemplates add RegionOne ec2 http://%HOST_IP%:8773/services/Cloud http://%HOST_IP%:8773/services/Admin http://%HOST_IP%:8773/services/Cloud 1 1
$BIN_DIR/keystone-manage $* endpointTemplates add RegionOne glance http://%HOST_IP%:9292/v1.1/%tenant_id% http://%HOST_IP%:9292/v1.1/%tenant_id% http://%HOST_IP%:9292/v1.1/%tenant_id% 1 1
$BIN_DIR/keystone-manage $* endpointTemplates add RegionOne keystone http://%HOST_IP%:5000/v2.0 http://%HOST_IP%:35357/v2.0 http://%HOST_IP%:5000/v2.0 1 1
if [[ "$ENABLED_SERVICES" =~ "swift" ]]; then
$BIN_DIR/keystone-manage $* endpointTemplates add RegionOne swift http://%HOST_IP%:8080/v1/AUTH_%tenant_id% http://%HOST_IP%:8080/ http://%HOST_IP%:8080/v1/AUTH_%tenant_id% 1 1
fi
# Tokens
$BIN_DIR/keystone-manage $* token add %SERVICE_TOKEN% admin admin 2015-02-05T00:00
# EC2 related creds - note we are setting the secret key to ADMIN_PASSWORD
# but keystone doesn't parse them - it is just a blob from keystone's
# point of view
$BIN_DIR/keystone-manage $* credentials add admin EC2 'admin' '%ADMIN_PASSWORD%' admin || echo "no support for adding credentials"
$BIN_DIR/keystone-manage $* credentials add demo EC2 'demo' '%ADMIN_PASSWORD%' demo || echo "no support for adding credentials"

@ -0,0 +1,345 @@
# This is a extended json package definition file
# We allow simple comments (lines starting with a hash symbol)
[
# Tenants
{
"cmd": [
"%BIN_DIR%/keystone-manage",
"tenant",
"add",
"admin"
]
},
{
"cmd": [
"%BIN_DIR%/keystone-manage",
"tenant",
"add",
"demo"
]
},
{
"cmd": [
"%BIN_DIR%/keystone-manage",
"tenant",
"add",
"invisible_to_admin"
]
},
# Users
{
"cmd": [
"%BIN_DIR%/keystone-manage",
"user",
"add",
"admin",
"%ADMIN_PASSWORD%"
]
},
{
"cmd": [
"%BIN_DIR%/keystone-manage",
"user",
"add",
"demo",
"%ADMIN_PASSWORD%"
]
},
# Roles
{
"cmd": [
"%BIN_DIR%/keystone-manage",
"role",
"add",
"Admin"
]
},
{
"cmd": [
"%BIN_DIR%/keystone-manage",
"role",
"add",
"Member"
]
},
{
"cmd": [
"%BIN_DIR%/keystone-manage",
"role",
"add",
"KeystoneAdmin"
]
},
{
"cmd": [
"%BIN_DIR%/keystone-manage",
"role",
"add",
"KeystoneServiceAdmin"
]
},
{
"cmd": [
"%BIN_DIR%/keystone-manage",
"role",
"add",
"sysadmin"
]
},
{
"cmd": [
"%BIN_DIR%/keystone-manage",
"role",
"add",
"netadmin"
]
},
{
"cmd": [
"%BIN_DIR%/keystone-manage",
"role",
"grant",
"Admin",
"admin",
"admin"
]
},
{
"cmd": [
"%BIN_DIR%/keystone-manage",
"role",
"grant",
"Member",
"demo",
"demo"
]
},
{
"cmd": [
"%BIN_DIR%/keystone-manage",
"role",
"grant",
"sysadmin",
"demo",
"demo"
]
},
{
"cmd": [
"%BIN_DIR%/keystone-manage",
"role",
"grant",
"netadmin",
"demo",
"demo"
]
},
{
"cmd": [
"%BIN_DIR%/keystone-manage",
"role",
"grant",
"Member",
"demo",
"invisible_to_admin"
]
},
{
"cmd": [
"%BIN_DIR%/keystone-manage",
"role",
"grant",
"Admin",
"admin",
"demo"
]
},
{
"cmd": [
"%BIN_DIR%/keystone-manage",
"role",
"grant",
"Admin",
"admin"
]
},
{
"cmd": [
"%BIN_DIR%/keystone-manage",
"role",
"grant",
"KeystoneAdmin",
"admin"
]
},
{
"cmd": [
"%BIN_DIR%/keystone-manage",
"role",
"grant",
"KeystoneServiceAdmin",
"admin"
]
},
# Services
{
"cmd": [
"%BIN_DIR%/keystone-manage",
"service",
"add",
"nova",
"compute",
"Nova Compute Service"
]
},
{
"cmd": [
"%BIN_DIR%/keystone-manage",
"service",
"add",
"ec2",
"ec2",
"EC2 Compatability Layer"
]
},
{
"cmd": [
"%BIN_DIR%/keystone-manage",
"service",
"add",
"glance",
"image",
"Glance Image Service"
]
},
{
"cmd": [
"%BIN_DIR%/keystone-manage",
"service",
"add",
"keystone",
"identity",
"Keystone Identity Service"
]
},
{
"cmd": [
"%BIN_DIR%/keystone-manage",
"service",
"add",
"swift",
"object-store",
"Swift Service"
]
},
# endpointTemplates
{
"cmd": [
"%BIN_DIR%/keystone-manage",
"endpointTemplates",
"add",
"RegionOne",
"nova",
"http://%HOST_IP%:8774/v1.1/%tenant_id%",
"http://%HOST_IP%:8774/v1.1/%tenant_id%",
"http://%HOST_IP%:8774/v1.1/%tenant_id%",
"1",
"1"
]
},
{
"cmd": [
"%BIN_DIR%/keystone-manage",
"endpointTemplates",
"add",
"RegionOne",
"ec2",
"http://%HOST_IP%:8773/services/Cloud",
"http://%HOST_IP%:8773/services/Admin",
"http://%HOST_IP%:8773/services/Cloud",
"1",
"1"
]
},
{
"cmd": [
"%BIN_DIR%/keystone-manage",
"endpointTemplates",
"add",
"RegionOne",
"glance",
"http://%HOST_IP%:9292/v1.1/%tenant_id%",
"http://%HOST_IP%:9292/v1.1/%tenant_id%",
"http://%HOST_IP%:9292/v1.1/%tenant_id%",
"1",
"1"
]
},
{
"cmd": [
"%BIN_DIR%/keystone-manage",
"endpointTemplates",
"add",
"RegionOne",
"keystone",
"http://%HOST_IP%:5000/v2.0",
"http://%HOST_IP%:35357/v2.0",
"http://%HOST_IP%:5000/v2.0",
"1",
"1"
]
},
{
"cmd": [
"%BIN_DIR%/keystone-manage",
"endpointTemplates",
"add",
"RegionOne",
"swift",
"http://%HOST_IP%:8080/v1/AUTH_%tenant_id%",
"http://%HOST_IP%:8080/",
"http://%HOST_IP%:8080/v1/AUTH_%tenant_id%",
"1",
"1"
]
},
# Tokens
{
"cmd": [
"%BIN_DIR%/keystone-manage",
"token",
"add",
"%SERVICE_TOKEN%",
"admin",
"admin",
"2015-02-05T00:00"
]
},
# EC2 related creds - note we are setting the secret key to ADMIN_PASSWORD
# but keystone doesn't parse them - it is just a blob from keystone's
# point of view
{
"cmd": [
"%BIN_DIR%/keystone-manage",
"credentials",
"add",
"admin",
"EC2",
"admin",
"%ADMIN_PASSWORD%",
"admin"
]
},
{
"cmd": [
"%BIN_DIR%/keystone-manage",
"credentials",
"add",
"demo",
"EC2",
"demo",
"%ADMIN_PASSWORD%",
"demo"
]
}
]

@ -1,7 +1,5 @@
#this is a extended json package definition file - we allow simple comments (starting with a hash symbol)
#for a given distro, when the component is installed
#the following packages will be installed with
#the distribution specific package installation class
# This is a extended json package definition file
# We allow simple comments (lines starting with a hash symbol)
{
"ubuntu-oneiric": {
"mysql-client-5.1": {
@ -25,7 +23,7 @@
"removable": true,
"pre-install": [
{
#this apparently is a action needed for ubuntu/debian to not prompt for passwords...
# This apparently is a action needed for ubuntu/debian to not prompt for passwords...
"run_as_root": true,
"cmd": [
"debconf-set-selections"
@ -51,17 +49,17 @@
"removable": true,
"post-install": [
{
#Make sure it'll start on reboot
# Make sure it'll start on reboot
"run_as_root": true,
"cmd" : [ "chkconfig", "mysqld", "on"]
},
{
#Start the mysql service
# Start the mysql service
"run_as_root": true,
"cmd" : [ "service", "mysqld", "start"]
},
{
#Set the root password
# Set the root password
"run_as_root": true,
"cmd" : [ "mysqladmin", "-u", "root",
"password", "%PASSWORD%" ]

@ -1,7 +1,5 @@
#this is a extended json package definition file - we allow simple comments (starting with a hash symbol)
#for a given distro, when the component is installed
#the following packages could be installed with
#the distribution specific package installation class
# This is a extended json package definition file
# We allow simple comments (lines starting with a hash symbol)
{
"ubuntu-oneiric": {
"pep8": {

@ -1,7 +1,5 @@
#this is a extended json package definition file - we allow simple comments (starting with a hash symbol)
#for a given distro, when the component is installed
#the following packages will be installed with
#the distribution specific package installation class
# This is a extended json package definition file
# We allow simple comments (lines starting with a hash symbol)
{
"ubuntu-oneiric": {
"python-eventlet": {

@ -1,7 +1,5 @@
#this is a extended json package definition file - we allow simple comments (starting with a hash symbol)
#for a given distro, when the component is installed
#the following packages will be installed with
#the distribution specific package installation class
# This is a extended json package definition file
# We allow simple comments (lines starting with a hash symbol)
{
"ubuntu-oneiric": {
"apache2": {

@ -1,7 +1,5 @@
#this is a extended json package definition file - we allow simple comments (starting with a hash symbol)
#for a given distro, when the component is installed
#the following packages will be installed with
#the distribution specific package installation class
# This is a extended json package definition file
# We allow simple comments (lines starting with a hash symbol)
{
"ubuntu-oneiric": {
"python-setuptools": {

@ -1,7 +1,5 @@
#this is a extended json package definition file - we allow simple comments (starting with a hash symbol)
#for a given distro, when the component is installed
#the following packages will be installed with
#the distribution specific package installation class
# This is a extended json package definition file
# We allow simple comments (lines starting with a hash symbol)
{
"ubuntu-oneiric": {
"lvm2": {

@ -1,7 +1,5 @@
#this is a extended json package definition file - we allow simple comments (starting with a hash symbol)
#for a given distro, when the component is installed
#the following packages will be installed with
#the distribution specific package installation class
# This is a extended json package definition file
# We allow simple comments (lines starting with a hash symbol)
{
"ubuntu-oneiric": {
"python-numpy": {

@ -1,7 +1,5 @@
#this is a extended json package definition file - we allow simple comments (starting with a hash symbol)
#for a given distro, when the component is installed
#the following packages will be installed with
#the distribution specific package installation class
# This is a extended json package definition file
# We allow simple comments (lines starting with a hash symbol)
{
"ubuntu-oneiric": {
"iscsitarget": {

@ -1,7 +1,5 @@
#this is a extended json package definition file - we allow simple comments (starting with a hash symbol)
#for a given distro, when the component is installed
#the following packages will be installed with
#the distribution specific package installation class
# This is a extended json package definition file
# We allow simple comments (lines starting with a hash symbol)
{
"ubuntu-oneiric": {
"dnsmasq-base": {

@ -1,7 +1,5 @@
#this is a extended json package definition file - we allow simple comments (starting with a hash symbol)
#for a given distro, when the component is installed
#the following packages will be installed with
#the distribution specific package installation class
# This is a extended json package definition file
# We allow simple comments (lines starting with a hash symbol)
{
"ubuntu-oneiric": {
"rabbitmq-server": {

@ -1,7 +1,5 @@
#this is a extended json package definition file - we allow simple comments (starting with a hash symbol)
#for a given distro, when the component is installed
#the following packages will be installed with
#the distribution specific package installation class
# This is a extended json package definition file
# We allow simple comments (lines starting with a hash symbol)
{
"ubuntu-oneiric": {
"curl": {

@ -110,16 +110,20 @@ class DBInstaller(ComponentBase, InstallComponent):
out['HOST_IP'] = hostip
return out
def _post_install(self, pkgs):
#run whatever the pkgs have specified
Packager.post_install(pkgs, self._get_install_params())
def _do_install(self, pkgs):
mp = self._get_install_params()
self.packager.pre_install(pkgs, mp)
self.packager.install_batch(pkgs)
self.packager.post_install(pkgs, mp)
#
#extra actions to ensure we are granted access
#
dbtype = self.cfg.get("db", "type")
dbactions = DB_ACTIONS.get(dbtype)
if(dbactions and dbactions.get('grant_all')):
#update the DB to give user 'USER'@'%' full control of the all databases:
grant_cmd = dbactions.get('grant_all')
params = self._get_install_params()
params = mp
cmds = list()
cmds.append({
'cmd': grant_cmd,
@ -128,30 +132,22 @@ class DBInstaller(ComponentBase, InstallComponent):
#shell seems to be needed here
#since python escapes this to much...
execute_template(*cmds, params=params, shell=True)
#
#special mysql actions
if(dbactions and dbtype == MYSQL):
cmd = dbactions.get('host_adjust')
if(cmd):
execute(*cmd, run_as_root=True, shell=True)
def _pre_install(self, pkgs):
#run whatever the pkgs have specified
Packager.pre_install(pkgs, self._get_install_params())
def install(self):
#just install the pkgs
pkgs = get_pkg_list(self.distro, TYPE)
pkgnames = sorted(pkgs.keys())
LOG.info("Installing packages %s" % (", ".join(pkgnames)))
#run any pre-installs cmds
self._pre_install(pkgs)
#now install the pkgs
self.packager.install_batch(pkgs)
self._do_install(pkgs)
#add trace used to remove the pkgs
for name in pkgnames:
self.tracewriter.package_install(name, pkgs.get(name))
#run any post-installs cmds
self._post_install(pkgs)
#restart it to make sure all good
self.runtime.restart()
return self.tracedir

@ -214,14 +214,18 @@ class GlanceInstaller(GlanceBase, InstallComponent):
self.tracewriter.dir_made(*dirsmade)
return self.tracedir
def _do_install(self, pkgs):
mp = self._get_param_map()
self.packager.pre_install(pkgs, mp)
self.packager.install_batch(pkgs)
self.packager.post_install(pkgs, mp)
def install(self):
#get all the packages for glance for the specified distro
pkgs = get_pkg_list(self.distro, TYPE)
pkgnames = sorted(pkgs.keys())
LOG.debug("Installing packages %s" % (", ".join(pkgnames)))
Packager.pre_install(pkgs, self._get_param_map())
self.packager.install_batch(pkgs)
Packager.post_install(pkgs, self._get_param_map())
self._do_install(pkgs)
#add trace used to remove the pkgs
for name in pkgnames:
self.tracewriter.package_install(name, pkgs.get(name))

@ -17,9 +17,10 @@ import os
import os.path
import Util
from Util import (KEYSTONE,
from Util import (KEYSTONE,
get_pkg_list, get_dbdsn,
param_replace, get_host_ip)
param_replace, get_host_ip,
execute_template)
import Logger
import Component
import Downloader
@ -42,7 +43,7 @@ PY_UNINSTALL = ['python', 'setup.py', 'develop', '--uninstall']
ROOT_CONF = "keystone.conf"
CONFIGS = [ROOT_CONF]
BIN_DIR = "bin"
DATA_SCRIPT = "keystone_data.sh"
DATA_CMDS = "keystone_data_cmds.json"
DB_NAME = "keystone"
@ -58,7 +59,7 @@ class KeystoneUninstaller(KeystoneBase, UninstallComponent):
def __init__(self, *args, **kargs):
KeystoneBase.__init__(self, *args, **kargs)
self.tracereader = TraceReader(self.tracedir, Trace.IN_TRACE)
def unconfigure(self):
#get rid of all files configured
cfgfiles = self.tracereader.files_configured()
@ -112,13 +113,18 @@ class KeystoneInstaller(KeystoneBase, InstallComponent):
self.tracewriter.dir_made(*dirsmade)
return self.tracedir
def _do_install(self, pkgs):
self.packager.pre_install(pkgs)
self.packager.install_batch(pkgs)
self.packager.post_install(pkgs)
def install(self):
pkgs = get_pkg_list(self.distro, TYPE)
pkgnames = sorted(pkgs.keys())
LOG.debug("Installing packages %s" % (", ".join(pkgnames)))
self.packager.install_batch(pkgs)
self._do_install(pkgs)
#this trace is used to remove the pkgs
for name in pkgnames:
#this trace is used to remove the pkgs
self.tracewriter.package_install(name, pkgs.get(name))
dirsmade = mkdirslist(self.tracedir)
#this trace is used to remove the dirs created
@ -159,21 +165,13 @@ class KeystoneInstaller(KeystoneBase, InstallComponent):
Db.create_db(self.cfg, DB_NAME)
def _setup_data(self):
contents = load_file(self.scriptfn)
cmds = load_json(self.scriptfn)
#we don't break on the missing ones
#since it appears that this config "script"
#also uses the same param format for its own templates...
repcontents = param_replace(contents, self._get_param_map(), ignore_missing=True)
tgtfn = joinpths(self.appdir, 'bin', DATA_SCRIPT)
write_file(tgtfn, repcontents)
#this trace is used to remove the files configured
self.tracewriter.cfg_write(tgtfn)
#now run it
env_additions = dict()
env_additions['ENABLED_SERVICES'] = ",".join(self.othercomponents)
env_additions['BIN_DIR'] = joinpths(self.appdir, 'bin')
cmd = ['bash', tgtfn]
execute(*cmd, env_overrides=env_additions)
params = self._get_param_map()
params['BIN_DIR'] = self.bindir
execute_template(cmds, params=params, ignore_missing=True)
def _config_apply(self, contents, fn):
lines = contents.splitlines()

@ -38,22 +38,20 @@ class Packager():
def remove_batch(self, pkgs):
raise NotImplementedError()
def pre_install(self, pkgs, installparams=None):
pkgnames = sorted(pkgs.keys())
for name in pkgnames:
packageinfo = pkgs.get(name)
preinstallcmds = packageinfo.get(Util.PRE_INSTALL)
if(preinstallcmds and len(preinstallcmds)):
LOG.info("Running pre-install commands for package %s." % (name))
execute_template(*preinstallcmds, params=installparams)
def pre_install(pkgs, installparams=None):
pkgnames = sorted(pkgs.keys())
for name in pkgnames:
packageinfo = pkgs.get(name)
preinstallcmds = packageinfo.get(Util.PRE_INSTALL)
if(preinstallcmds and len(preinstallcmds)):
LOG.info("Running pre-install commands for package %s." % (name))
execute_template(*preinstallcmds, params=installparams)
def post_install(pkgs, installparams=None):
pkgnames = sorted(pkgs.keys())
for name in pkgnames:
packageinfo = pkgs.get(name)
postinstallcmds = packageinfo.get(Util.POST_INSTALL)
if(postinstallcmds and len(postinstallcmds)):
LOG.info("Running post-install commands for package %s." % (name))
execute_template(*postinstallcmds, params=installparams)
def post_install(self, pkgs, installparams=None):
pkgnames = sorted(pkgs.keys())
for name in pkgnames:
packageinfo = pkgs.get(name)
postinstallcmds = packageinfo.get(Util.POST_INSTALL)
if(postinstallcmds and len(postinstallcmds)):
LOG.info("Running post-install commands for package %s." % (name))
execute_template(*postinstallcmds, params=installparams)

@ -19,7 +19,7 @@ import Component
from Component import (ComponentBase, RuntimeComponent,
UninstallComponent, InstallComponent)
import Exceptions
from Exceptions import (StartException, StopException,
from Exceptions import (StartException, StopException,
StatusException, RestartException)
import Packager
import Util
@ -83,14 +83,17 @@ class RabbitInstaller(ComponentBase, InstallComponent):
cmd = PWD_CMD + [passwd]
execute(*cmd, run_as_root=True)
def _do_install(self, pkgs):
self.packager.pre_install(pkgs)
self.packager.install_batch(pkgs)
self.packager.post_install(pkgs)
def install(self):
#just install the pkg
pkgs = get_pkg_list(self.distro, TYPE)
pkgnames = sorted(pkgs.keys())
LOG.debug("Installing packages %s" % (", ".join(pkgnames)))
Packager.pre_install(pkgs)
self.packager.install_batch(pkgs)
Packager.post_install(pkgs)
self._do_install(pkgs)
for name in pkgnames:
#this trace is used to remove the pkgs
self.tracewriter.package_install(name, pkgs.get(name))

@ -174,12 +174,14 @@ def execute_template(*cmds, **kargs):
if(not cmds or len(cmds) == 0):
return
params_replacements = kargs.pop('params')
ignore_missing = kargs.pop('ignore_missing', False)
for cmdinfo in cmds:
cmd_to_run_templ = cmdinfo.get("cmd")
cmd_to_run = list()
for piece in cmd_to_run_templ:
if(params_replacements and len(params_replacements)):
cmd_to_run.append(param_replace(piece, params_replacements))
cmd_to_run.append(param_replace(piece, params_replacements,
ignore_missing=ignore_missing))
else:
cmd_to_run.append(piece)
stdin_templ = cmdinfo.get('stdin')
@ -188,7 +190,8 @@ def execute_template(*cmds, **kargs):
stdin_full = list()
for piece in stdin_templ:
if(params_replacements and len(params_replacements)):
stdin_full.append(param_replace(piece, params_replacements))
stdin_full.append(param_replace(piece, params_replacements,
ignore_missing=ignore_missing))
else:
stdin_full.append(piece)
stdin = joinlinesep(stdin_full)

@ -72,11 +72,11 @@ class AptPackager(Packager.Packager):
cmds.append(torun)
if(len(cmds)):
cmd = APT_GET + APT_DO_REMOVE + cmds
execute(*cmd, run_as_root=True,
execute(*cmd, run_as_root=True,
env_overrides=ENV_ADDITIONS)
#clean them out
cmd = APT_GET + APT_AUTOREMOVE
execute(*cmd, run_as_root=True,
execute(*cmd, run_as_root=True,
env_overrides=ENV_ADDITIONS)
def install_batch(self, pkgs):
@ -93,7 +93,7 @@ class AptPackager(Packager.Packager):
#install them
if(len(cmds)):
cmd = APT_GET + APT_INSTALL + cmds
execute(*cmd, run_as_root=True,
execute(*cmd, run_as_root=True,
env_overrides=ENV_ADDITIONS)
@ -155,7 +155,7 @@ def _pkg_remove_special(name, pkginfo):
#probably useful to do this
time.sleep(1)
cmd = APT_GET + APT_PURGE + [name + "=" + version]
execute(*cmd, run_as_root=True,
execute(*cmd, run_as_root=True,
env_overrides=ENV_ADDITIONS)
return True
return False

@ -24,6 +24,7 @@ LOG = Logger.getLogger("install.package.yum")
YUM_CMD = ['yum']
YUM_INSTALL = ["install", "-y"]
class YumPackager(Packager.Packager):
def __init__(self):
LOG.info("Init called")
@ -51,6 +52,6 @@ class YumPackager(Packager.Packager):
LOG.debug("About to run:%s" % (cmd))
execute(*cmd, run_as_root=True)
def install_batch(self, pkgs, params=None):
def install_batch(self, pkgs):
LOG.info("install_batch called")
self._do_cmd(YUM_INSTALL, pkgs)

2
stack

@ -209,7 +209,7 @@ def check_root(action, rootdir):
sublisting = os.listdir(rootdir)
if(len(sublisting) != 0):
#something exists, not good
root_there = True
root_there = True
if(root_there):
LOG.error("Root directory [%s] already exists (and it's not empty)! Please remove it or uninstall components!" % (rootdir))
return False