Packstack Plugins Clean-up

- Deleted unused import
- Pep8 compliance
- Deleted unused variables

Change-Id: I45f135b2467427cd7ee3b5ba32745af2a631458a
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
This commit is contained in:
Gael Chamoulaud
2014-11-30 18:30:22 +01:00
parent 8e1cecf63c
commit 3da12069ef
18 changed files with 231 additions and 289 deletions

View File

@@ -1,16 +1,11 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
""" """
Installs and configures amqp Installs and configures AMQP
""" """
import logging
import uuid
import os
from packstack.installer import validators from packstack.installer import validators
from packstack.installer import processors from packstack.installer import processors
from packstack.installer import basedefs
from packstack.installer import utils from packstack.installer import utils
from packstack.modules.common import filtered_hosts from packstack.modules.common import filtered_hosts
@@ -19,7 +14,7 @@ from packstack.modules.ospluginutils import (getManifestTemplate,
createFirewallResources) createFirewallResources)
#------------------ oVirt installer initialization ------------------ # ------------- AMQP Packstack Plugin Initialization --------------
PLUGIN_NAME = "AMQP" PLUGIN_NAME = "AMQP"
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue') PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')
@@ -215,7 +210,7 @@ def initSequences(controller):
controller.addSequence("Installing AMQP", [], [], amqpsteps) controller.addSequence("Installing AMQP", [], [], amqpsteps)
#-------------------------- step functions -------------------------- # ------------------------ step functions -------------------------
def create_manifest(config, messages): def create_manifest(config, messages):
server = utils.ScriptRunner(config['CONFIG_AMQP_HOST']) server = utils.ScriptRunner(config['CONFIG_AMQP_HOST'])

View File

@@ -4,8 +4,6 @@
Installs and configures Ceilometer Installs and configures Ceilometer
""" """
import logging
import os
import uuid import uuid
from packstack.installer import utils from packstack.installer import utils
@@ -17,7 +15,7 @@ from packstack.modules.ospluginutils import (getManifestTemplate,
createFirewallResources) createFirewallResources)
#------------------ oVirt installer initialization ------------------ # ------------- Ceilometer Packstack Plugin Initialization --------------
PLUGIN_NAME = "OS-Ceilometer" PLUGIN_NAME = "OS-Ceilometer"
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue') PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')

View File

@@ -4,17 +4,13 @@
Installs and configures Cinder Installs and configures Cinder
""" """
import os
import re import re
import uuid
import logging
from packstack.installer import exceptions from packstack.installer import exceptions
from packstack.installer import processors from packstack.installer import processors
from packstack.installer import validators from packstack.installer import validators
from packstack.installer.utils import split_hosts from packstack.installer.utils import split_hosts
from packstack.installer import basedefs
from packstack.installer import utils from packstack.installer import utils
@@ -23,11 +19,8 @@ from packstack.modules.ospluginutils import (getManifestTemplate,
appendManifestFile, appendManifestFile,
createFirewallResources) createFirewallResources)
from packstack.installer import exceptions
from packstack.installer import output_messages
# ------------------ Cinder Packstack Plugin initialization ------------------
#------------------ oVirt installer initialization ------------------
PLUGIN_NAME = "OS-Cinder" PLUGIN_NAME = "OS-Cinder"
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue') PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')
@@ -581,7 +574,7 @@ def initConfig(controller):
"PRE_CONDITION": check_netapp_eseries_options, "PRE_CONDITION": check_netapp_eseries_options,
"PRE_CONDITION_MATCH": True, "PRE_CONDITION_MATCH": True,
"POST_CONDITION": False, "POST_CONDITION": False,
"POST_CONDITION_MATCH": True}, "POST_CONDITION_MATCH": True}
] ]
for group in conf_groups: for group in conf_groups:
params = conf_params[group["GROUP_NAME"]] params = conf_params[group["GROUP_NAME"]]

View File

@@ -4,12 +4,10 @@
Installs and configures OpenStack Horizon Installs and configures OpenStack Horizon
""" """
import logging
import os import os
import uuid import uuid
from packstack.installer import validators from packstack.installer import validators
from packstack.installer import basedefs, output_messages
from packstack.installer import exceptions from packstack.installer import exceptions
from packstack.installer import utils from packstack.installer import utils
@@ -17,7 +15,7 @@ from packstack.modules.ospluginutils import (getManifestTemplate,
appendManifestFile) appendManifestFile)
#------------------ oVirt installer initialization ------------------ # ------------- Horizon Packstack Plugin Initialization --------------
PLUGIN_NAME = "OS-Horizon" PLUGIN_NAME = "OS-Horizon"
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue') PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')

View File

@@ -4,21 +4,16 @@
Installs and configures Glance Installs and configures Glance
""" """
import uuid
import logging
from packstack.installer import validators from packstack.installer import validators
from packstack.installer import processors from packstack.installer import processors
from packstack.installer import basedefs
from packstack.installer import utils from packstack.installer import utils
from packstack.installer.utils import split_hosts
from packstack.modules.shortcuts import get_mq from packstack.modules.shortcuts import get_mq
from packstack.modules.ospluginutils import (getManifestTemplate, from packstack.modules.ospluginutils import (getManifestTemplate,
appendManifestFile, appendManifestFile,
createFirewallResources) createFirewallResources)
#------------------ oVirt installer initialization ------------------ # ------------- Glance Packstack Plugin Initialization --------------
PLUGIN_NAME = "OS-Glance" PLUGIN_NAME = "OS-Glance"
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue') PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')

View File

@@ -1,12 +1,10 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
""" """
Installs and configures heat Installs and configures Heat
""" """
import uuid import uuid
import logging
import os
from packstack.installer import utils from packstack.installer import utils
from packstack.installer import validators from packstack.installer import validators
@@ -14,12 +12,11 @@ from packstack.installer import processors
from packstack.modules.shortcuts import get_mq from packstack.modules.shortcuts import get_mq
from packstack.modules.ospluginutils import (getManifestTemplate, from packstack.modules.ospluginutils import (getManifestTemplate,
manifestfiles,
appendManifestFile, appendManifestFile,
createFirewallResources) createFirewallResources)
#------------------ oVirt installer initialization ------------------ # ------------- Heat Packstack Plugin Initialization --------------
PLUGIN_NAME = "OS-Heat" PLUGIN_NAME = "OS-Heat"
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue') PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')
@@ -171,7 +168,7 @@ def initSequences(controller):
controller.addSequence("Installing Heat", [], [], steps) controller.addSequence("Installing Heat", [], [], steps)
#-------------------------- step functions -------------------------- # ------------------------ step functions -------------------------
def create_manifest(config, messages): def create_manifest(config, messages):
manifestfile = "%s_heat.pp" % config['CONFIG_CONTROLLER_HOST'] manifestfile = "%s_heat.pp" % config['CONFIG_CONTROLLER_HOST']

View File

@@ -4,12 +4,10 @@
Installs and configures Keystone Installs and configures Keystone
""" """
import logging
import uuid import uuid
from packstack.installer import validators from packstack.installer import validators
from packstack.installer import processors from packstack.installer import processors
from packstack.installer import basedefs
from packstack.installer import utils from packstack.installer import utils
from packstack.modules.ospluginutils import (getManifestTemplate, from packstack.modules.ospluginutils import (getManifestTemplate,
@@ -17,7 +15,7 @@ from packstack.modules.ospluginutils import (getManifestTemplate,
createFirewallResources) createFirewallResources)
#------------------ oVirt installer initialization ------------------ # ------------- Keystone Packstack Plugin Initialization --------------
PLUGIN_NAME = "OS-Keystone" PLUGIN_NAME = "OS-Keystone"
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue') PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')

View File

@@ -4,13 +4,9 @@
Installs and configures MariaDB Installs and configures MariaDB
""" """
import uuid
import logging
from packstack.installer import validators from packstack.installer import validators
from packstack.installer import processors from packstack.installer import processors
from packstack.installer import utils from packstack.installer import utils
from packstack.installer.utils import split_hosts
from packstack.modules.common import filtered_hosts from packstack.modules.common import filtered_hosts
from packstack.modules.ospluginutils import (getManifestTemplate, from packstack.modules.ospluginutils import (getManifestTemplate,
@@ -18,7 +14,7 @@ from packstack.modules.ospluginutils import (getManifestTemplate,
createFirewallResources) createFirewallResources)
#------------------ oVirt installer initialization ------------------ # ------------- MariaDB Packstack Plugin Initialization --------------
PLUGIN_NAME = "MariaDB" PLUGIN_NAME = "MariaDB"
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue') PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')

View File

@@ -4,12 +4,8 @@
Installs and configures Nagios Installs and configures Nagios
""" """
import uuid
import logging
from packstack.installer import validators from packstack.installer import validators
from packstack.installer import processors from packstack.installer import processors
from packstack.installer import basedefs, output_messages
from packstack.installer import utils from packstack.installer import utils
from packstack.modules.common import filtered_hosts from packstack.modules.common import filtered_hosts
@@ -18,7 +14,7 @@ from packstack.modules.ospluginutils import (getManifestTemplate,
createFirewallResources) createFirewallResources)
#------------------ oVirt installer initialization ------------------ # ------------- Nagios Packstack Plugin Initialization --------------
PLUGIN_NAME = "OS-Nagios" PLUGIN_NAME = "OS-Nagios"
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue') PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')

View File

@@ -1,16 +1,10 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
""" """
Installs and configures neutron Installs and configures Neutron
""" """
import logging
import os
import re
import uuid
from packstack.installer import utils from packstack.installer import utils
from packstack.installer import exceptions
from packstack.installer import validators from packstack.installer import validators
from packstack.installer import processors from packstack.installer import processors
from packstack.installer import output_messages from packstack.installer import output_messages
@@ -23,7 +17,7 @@ from packstack.modules.ospluginutils import (getManifestTemplate,
createFirewallResources) createFirewallResources)
#------------------ oVirt installer initialization ------------------ # ------------- Neutron Packstack Plugin Initialization --------------
PLUGIN_NAME = "OS-Neutron" PLUGIN_NAME = "OS-Neutron"
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue') PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')

View File

@@ -1,12 +1,10 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
""" """
Installs and configures nova Installs and configures Nova
""" """
import os import os
import uuid
import logging
import platform import platform
import socket import socket
@@ -19,7 +17,7 @@ from packstack.modules.ospluginutils import (NovaConfig, getManifestTemplate,
createFirewallResources) createFirewallResources)
#------------------ oVirt installer initialization ------------------ # ------------- Nova Packstack Plugin Initialization --------------
PLUGIN_NAME = "OS-Nova" PLUGIN_NAME = "OS-Nova"
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue') PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')
@@ -381,7 +379,7 @@ def bring_up_ifcfg(host, device):
raise ScriptRuntimeError(msg) raise ScriptRuntimeError(msg)
#-------------------------- step functions -------------------------- # ------------------------ Step Functions -------------------------
def create_ssh_keys(config, messages): def create_ssh_keys(config, messages):
migration_key = os.path.join(basedefs.VAR_DIR, 'nova_migration_key') migration_key = os.path.join(basedefs.VAR_DIR, 'nova_migration_key')

View File

@@ -4,18 +4,15 @@
Installs and configures an OpenStack Client Installs and configures an OpenStack Client
""" """
import logging
import os import os
from packstack.installer import validators
from packstack.installer import basedefs, output_messages
from packstack.installer import utils from packstack.installer import utils
from packstack.modules.ospluginutils import (getManifestTemplate, from packstack.modules.ospluginutils import (getManifestTemplate,
appendManifestFile) appendManifestFile)
#------------------ oVirt installer initialization ------------------ # ------------- OpenStack Client Packstack Plugin Initialization --------------
PLUGIN_NAME = "OS-Client" PLUGIN_NAME = "OS-Client"
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue') PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')

View File

@@ -1,11 +1,9 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
""" """
Installs and configures an OpenStack Client Plugin responsible for post-installation configuration
""" """
import logging
from packstack.installer import utils from packstack.installer import utils
from packstack.modules.common import filtered_hosts from packstack.modules.common import filtered_hosts
@@ -13,7 +11,7 @@ from packstack.modules.ospluginutils import (getManifestTemplate,
appendManifestFile) appendManifestFile)
#------------------ oVirt installer initialization ------------------ # ------------- Postscript Packstack Plugin Initialization --------------
PLUGIN_NAME = "Postscript" PLUGIN_NAME = "Postscript"
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue') PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')

View File

@@ -5,7 +5,6 @@ Plugin responsible for setting OpenStack global options
""" """
import glob import glob
import logging
import os import os
import re import re
import uuid import uuid
@@ -18,7 +17,7 @@ from packstack.modules.ospluginutils import (getManifestTemplate,
appendManifestFile) appendManifestFile)
#------------------ oVirt installer initialization ------------------ # ------------- Prescript Packstack Plugin Initialization --------------
PLUGIN_NAME = "Prescript" PLUGIN_NAME = "Prescript"
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue') PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')
@@ -444,8 +443,8 @@ def initConfig(controller):
"before next major release." "before next major release."
), ),
"PROMPT": ( "PROMPT": (
"Enable this on your own risk. Do you want to use unsupported " "Enable this on your own risk. Do you want to use "
"parameters" "insupported parameters"
), ),
"OPTION_LIST": ["y", "n"], "OPTION_LIST": ["y", "n"],
"DEFAULT_VALUE": "n", "DEFAULT_VALUE": "n",

View File

@@ -1,12 +1,9 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
""" """
Installs and configures neutron Installs and configures Provisioning for demo usage and testing
""" """
import logging
import uuid
from packstack.installer import utils from packstack.installer import utils
from packstack.installer import validators from packstack.installer import validators
from packstack.installer import processors from packstack.installer import processors
@@ -16,7 +13,7 @@ from packstack.modules.ospluginutils import (appendManifestFile,
getManifestTemplate) getManifestTemplate)
#------------------ oVirt installer initialization ------------------ # ------------- Provision Packstack Plugin Initialization --------------
PLUGIN_NAME = "OS-Provision" PLUGIN_NAME = "OS-Provision"
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue') PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')

View File

@@ -1,17 +1,16 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
""" """
Installs and configures puppet Installs and configures Puppet
""" """
import sys import sys
import logging import logging
import os import os
import platform
import time import time
from packstack.installer import utils from packstack.installer import utils
from packstack.installer import basedefs, output_messages from packstack.installer import basedefs
from packstack.installer.exceptions import ScriptRuntimeError, PuppetError from packstack.installer.exceptions import ScriptRuntimeError, PuppetError
from packstack.modules.common import filtered_hosts from packstack.modules.common import filtered_hosts
@@ -20,7 +19,7 @@ from packstack.modules.ospluginutils import (manifestfiles,
from packstack.modules.puppet import scan_logfile, validate_logfile from packstack.modules.puppet import scan_logfile, validate_logfile
#------------------ oVirt installer initialization ------------------ # ------------- Puppet Packstack Plugin Initialization --------------
PLUGIN_NAME = "Puppet" PLUGIN_NAME = "Puppet"
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue') PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')
@@ -151,10 +150,8 @@ def install_deps(config, messages):
for hostname in filtered_hosts(config): for hostname in filtered_hosts(config):
server = utils.ScriptRunner(hostname) server = utils.ScriptRunner(hostname)
packages = ' '.join(deps) packages = ' '.join(deps)
server.append("yum install -y %s" server.append("yum install -y %s" % packages)
% packages) server.append("yum update -y %s" % packages)
server.append("yum update -y %s"
% packages)
# yum does not fail if one of the packages is missing # yum does not fail if one of the packages is missing
for package in deps: for package in deps:
server.append("rpm -q --whatprovides %s" % (package)) server.append("rpm -q --whatprovides %s" % (package))

View File

@@ -1,16 +1,14 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
""" """
prepare server Plugin responsible for Server Preparation.
""" """
import os import os
import re import re
import uuid
import logging import logging
import platform import platform
from packstack.installer import basedefs
from packstack.installer import exceptions from packstack.installer import exceptions
from packstack.installer import utils from packstack.installer import utils
from packstack.installer import validators from packstack.installer import validators
@@ -18,7 +16,7 @@ from packstack.installer import validators
from packstack.modules.common import filtered_hosts, is_all_in_one from packstack.modules.common import filtered_hosts, is_all_in_one
#------------------ oVirt installer initialization ------------------ # ------------ Server Preparation Packstack Plugin Initialization -------------
PLUGIN_NAME = "OS-SERVERPREPARE" PLUGIN_NAME = "OS-SERVERPREPARE"
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue') PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')

View File

@@ -1,19 +1,17 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
""" """
Installs and configures an OpenStack Swift Installs and configures Swift
""" """
import os import os
import re import re
import uuid import uuid
import logging
import netaddr import netaddr
from packstack.installer import validators from packstack.installer import validators
from packstack.installer import processors from packstack.installer import processors
from packstack.installer.exceptions import ParamValidationError from packstack.installer.exceptions import ParamValidationError
from packstack.installer import basedefs
from packstack.installer import utils from packstack.installer import utils
from packstack.installer.utils import split_hosts from packstack.installer.utils import split_hosts
@@ -22,7 +20,7 @@ from packstack.modules.ospluginutils import (getManifestTemplate,
createFirewallResources) createFirewallResources)
#------------------ oVirt installer initialization ------------------ # ------------- Swift Packstack Plugin Initialization --------------
PLUGIN_NAME = "OS-Swift" PLUGIN_NAME = "OS-Swift"
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue') PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')