Enable PEP8 checks H102, H232, H233, H301, H904
* H102 Apache 2.0 license header not found * H232 Python 3.x incompatible octal xxx should be written as 0oxxx * H233 Python 3.x incompatible use of print operator * H301 one import per line * H904 Wrap long lines in parentheses instead of a backslash Change-Id: I07003acb76eaa719daabc451239067494efa2bba
This commit is contained in:
parent
d4be291913
commit
d7916cec60
12
docs/conf.py
12
docs/conf.py
@ -1,5 +1,17 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# packstack documentation build configuration file, created by
|
||||
# sphinx-quickstart on Thu Nov 15 20:34:41 2012.
|
||||
#
|
||||
|
@ -1,4 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
"""
|
||||
This module provides all the predefined variables.
|
||||
@ -18,7 +30,7 @@ FILE_YUM_VERSION_LOCK = "/etc/yum/pluginconf.d/versionlock.list"
|
||||
|
||||
PACKSTACK_VAR_DIR = "/var/tmp/packstack"
|
||||
try:
|
||||
os.mkdir(PACKSTACK_VAR_DIR, 0700)
|
||||
os.mkdir(PACKSTACK_VAR_DIR, 0o700)
|
||||
except OSError:
|
||||
# directory is already created, check ownership
|
||||
stat = os.stat(PACKSTACK_VAR_DIR)
|
||||
|
@ -1,4 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import os
|
||||
import stat
|
||||
|
@ -1,4 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
"""
|
||||
Container set for groups and parameters
|
||||
|
@ -1,4 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
"""
|
||||
Base class for steps & sequences
|
||||
|
@ -1,4 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
__all__ = (
|
||||
'PackStackError',
|
||||
|
@ -1,3 +1,16 @@
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
'''
|
||||
external text file to hold all user visible text.
|
||||
info messages begins with INFO_ and error msg with ERR_
|
||||
|
@ -1,11 +1,25 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import netaddr
|
||||
import os
|
||||
import uuid
|
||||
|
||||
from .utils import ScriptRunner, force_ip
|
||||
from .exceptions import ParamProcessingError, NetworkError
|
||||
from .utils import force_ip
|
||||
from .utils import ScriptRunner
|
||||
from .exceptions import NetworkError
|
||||
from .exceptions import ParamProcessingError
|
||||
|
||||
|
||||
__all__ = ('ParamProcessingError', 'process_cidr', 'process_host',
|
||||
|
@ -1,3 +1,16 @@
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import ConfigParser
|
||||
import copy
|
||||
import datetime
|
||||
@ -11,14 +24,16 @@ import traceback
|
||||
import types
|
||||
import textwrap
|
||||
|
||||
from optparse import OptionParser, OptionGroup
|
||||
from optparse import OptionGroup
|
||||
from optparse import OptionParser
|
||||
|
||||
import basedefs
|
||||
import validators
|
||||
from . import utils
|
||||
import processors
|
||||
import output_messages
|
||||
from .exceptions import FlagValidationError, ParamValidationError
|
||||
from .exceptions import FlagValidationError
|
||||
from .exceptions import ParamValidationError
|
||||
|
||||
from packstack import version
|
||||
from packstack.modules.ospluginutils import gethostlist
|
||||
@ -39,7 +54,7 @@ def initLogging(debug):
|
||||
|
||||
# Create the log file with specific permissions, puppet has a habbit of putting
|
||||
# passwords in logs
|
||||
os.close(os.open(logFile, os.O_CREAT | os.O_EXCL, 0600))
|
||||
os.close(os.open(logFile, os.O_CREAT | os.O_EXCL, 0o600))
|
||||
|
||||
hdlr = logging.FileHandler(filename=logFile, mode='w')
|
||||
if (debug):
|
||||
@ -82,8 +97,8 @@ def _getInputFromUser(param):
|
||||
message.write(param.PROMPT)
|
||||
|
||||
val_list = param.VALIDATORS or []
|
||||
if validators.validate_regexp not in val_list \
|
||||
and param.OPTION_LIST:
|
||||
if(validators.validate_regexp not in val_list
|
||||
and param.OPTION_LIST):
|
||||
message.write(" [%s]" % "|".join(param.OPTION_LIST))
|
||||
|
||||
if param.DEFAULT_VALUE:
|
||||
@ -130,7 +145,7 @@ def _getInputFromUser(param):
|
||||
loop = True
|
||||
except KeyboardInterrupt:
|
||||
# add the new line so messages wont be displayed in the same line as the question
|
||||
print ""
|
||||
print("")
|
||||
raise
|
||||
except:
|
||||
logging.error(traceback.format_exc())
|
||||
@ -158,7 +173,7 @@ def input_param(param):
|
||||
logging.debug("Param confirmation passed, value for both questions is identical")
|
||||
break
|
||||
else:
|
||||
print output_messages.INFO_VAL_PASSWORD_DONT_MATCH
|
||||
print(output_messages.INFO_VAL_PASSWORD_DONT_MATCH)
|
||||
else:
|
||||
_getInputFromUser(param)
|
||||
|
||||
@ -272,7 +287,7 @@ def validate_param_value(param, value):
|
||||
try:
|
||||
val_func(value, opt_list)
|
||||
except ParamValidationError as ex:
|
||||
print 'Parameter %s failed validation: %s' % (cname, ex)
|
||||
print('Parameter %s failed validation: %s' % (cname, ex))
|
||||
raise
|
||||
|
||||
|
||||
@ -287,14 +302,14 @@ def process_param_value(param, value):
|
||||
if new_value != _value:
|
||||
if param.MASK_INPUT is False:
|
||||
msg = output_messages.INFO_CHANGED_VALUE
|
||||
print msg % (_value, new_value)
|
||||
print(msg % (_value, new_value))
|
||||
_value = new_value
|
||||
else:
|
||||
logging.debug("Processor returned the original "
|
||||
"value: %s" % _value)
|
||||
except processors.ParamProcessingError as ex:
|
||||
print ("Value processing of parameter %s "
|
||||
"failed.\n%s" % (param.CONF_NAME, ex))
|
||||
print("Value processing of parameter %s "
|
||||
"failed.\n%s" % (param.CONF_NAME, ex))
|
||||
raise
|
||||
return _value
|
||||
|
||||
@ -541,8 +556,8 @@ def _getConditionValue(matchMember):
|
||||
|
||||
def _displaySummary():
|
||||
|
||||
print output_messages.INFO_DSPLY_PARAMS
|
||||
print "=" * (len(output_messages.INFO_DSPLY_PARAMS) - 1)
|
||||
print(output_messages.INFO_DSPLY_PARAMS)
|
||||
print("=" * (len(output_messages.INFO_DSPLY_PARAMS) - 1))
|
||||
logging.info("*** User input summary ***")
|
||||
for group in controller.getAllGroups():
|
||||
for param in group.parameters.itervalues():
|
||||
@ -553,11 +568,11 @@ def _displaySummary():
|
||||
# Only call mask on a value if the param has MASK_INPUT set to True
|
||||
if maskParam:
|
||||
logging.info("%s: %s" % (cmdOption, mask(controller.CONF[param.CONF_NAME])))
|
||||
print "%s:" % (cmdOption) + " " * l + mask(controller.CONF[param.CONF_NAME])
|
||||
print("%s:" % (cmdOption) + " " * l + mask(controller.CONF[param.CONF_NAME]))
|
||||
else:
|
||||
# Otherwise, log & display it as it is
|
||||
logging.info("%s: %s" % (cmdOption, str(controller.CONF[param.CONF_NAME])))
|
||||
print "%s:" % (cmdOption) + " " * l + str(controller.CONF[param.CONF_NAME])
|
||||
print("%s:" % (cmdOption) + " " * l + str(controller.CONF[param.CONF_NAME]))
|
||||
logging.info("*** User input summary ***")
|
||||
answer = _askYesNo(output_messages.INFO_USE_PARAMS)
|
||||
if not answer:
|
||||
@ -573,7 +588,7 @@ def _displaySummary():
|
||||
del controller.CONF[param.CONF_NAME]
|
||||
if param.CONF_NAME in commandLineValues:
|
||||
del commandLineValues[param.CONF_NAME]
|
||||
print ""
|
||||
print("")
|
||||
logging.debug("calling handleParams in interactive mode")
|
||||
return _handleParams(None)
|
||||
else:
|
||||
@ -582,9 +597,9 @@ def _displaySummary():
|
||||
|
||||
def _printAdditionalMessages():
|
||||
if len(controller.MESSAGES) > 0:
|
||||
print "\n", output_messages.INFO_ADDTIONAL_MSG
|
||||
print("\n", output_messages.INFO_ADDTIONAL_MSG)
|
||||
for msg in controller.MESSAGES:
|
||||
print output_messages.INFO_ADDTIONAL_MSG_BULLET % (msg)
|
||||
print(output_messages.INFO_ADDTIONAL_MSG_BULLET % (msg))
|
||||
|
||||
|
||||
def _addFinalInfoMsg(logFile):
|
||||
@ -612,7 +627,7 @@ def runSequences():
|
||||
|
||||
|
||||
def _main(options, configFile=None, logFile=None):
|
||||
print output_messages.INFO_HEADER
|
||||
print(output_messages.INFO_HEADER)
|
||||
print("")
|
||||
print(output_messages.INFO_LOG_FILE_PATH % logFile)
|
||||
|
||||
@ -632,7 +647,7 @@ def _main(options, configFile=None, logFile=None):
|
||||
logging.debug(mask(controller.CONF))
|
||||
|
||||
# Start configuration stage
|
||||
print "\n", output_messages.INFO_INSTALL
|
||||
print("\n", output_messages.INFO_INSTALL)
|
||||
|
||||
# Initialize Sequences
|
||||
initPluginsSequences()
|
||||
@ -645,7 +660,7 @@ def _main(options, configFile=None, logFile=None):
|
||||
|
||||
# Print info
|
||||
_addFinalInfoMsg(logFile)
|
||||
print output_messages.INFO_INSTALL_SUCCESS
|
||||
print(output_messages.INFO_INSTALL_SUCCESS)
|
||||
|
||||
|
||||
def remove_remote_var_dirs(options, config, messages):
|
||||
@ -703,7 +718,7 @@ def generateAnswerFile(outputFile, overrides={}):
|
||||
# the mode -rw-------
|
||||
if os.path.exists(outputFile):
|
||||
os.remove(outputFile)
|
||||
fd = os.open(outputFile, os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0600)
|
||||
fd = os.open(outputFile, os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0o600)
|
||||
|
||||
with os.fdopen(fd, "w") as ans_file:
|
||||
ans_file.write("[general]%s" % os.linesep)
|
||||
@ -829,17 +844,17 @@ def printOptions():
|
||||
|
||||
# For each group, create a group option
|
||||
for group in controller.getAllGroups():
|
||||
print "%s" % group.DESCRIPTION
|
||||
print "-" * len(group.DESCRIPTION)
|
||||
print
|
||||
print("%s" % group.DESCRIPTION)
|
||||
print("-" * len(group.DESCRIPTION))
|
||||
print()
|
||||
|
||||
for param in group.parameters.itervalues():
|
||||
cmdOption = param.CONF_NAME
|
||||
paramUsage = param.USAGE
|
||||
optionsList = param.OPTION_LIST or ""
|
||||
print "%s" % (("**%s**" % str(cmdOption)).ljust(30))
|
||||
print " %s %s" % (paramUsage, optionsList)
|
||||
print
|
||||
print("%s" % (("**%s**" % str(cmdOption)).ljust(30)))
|
||||
print(" %s %s" % (paramUsage, optionsList))
|
||||
print()
|
||||
|
||||
|
||||
def plugin_compare(x, y):
|
||||
@ -1006,9 +1021,9 @@ def main():
|
||||
optParser.error(str(ex))
|
||||
except Exception as e:
|
||||
logging.error(traceback.format_exc())
|
||||
print
|
||||
print utils.color_text("ERROR : " + str(e), 'red')
|
||||
print output_messages.ERR_CHECK_LOG_FILE_FOR_MORE_INFO % (logFile)
|
||||
print()
|
||||
print(utils.color_text("ERROR : " + str(e), 'red'))
|
||||
print(output_messages.ERR_CHECK_LOG_FILE_FOR_MORE_INFO % (logFile))
|
||||
sys.exit(1)
|
||||
|
||||
finally:
|
||||
|
@ -1,3 +1,16 @@
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
"""
|
||||
Controller class is a SINGLETON which handles all groups, params, sequences,
|
||||
steps and replaces the CONF dictionary.
|
||||
|
@ -1,13 +1,35 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from .datastructures import SortedDict
|
||||
from .decorators import retry
|
||||
from .network import get_localhost_ip, host2ip, force_ip, device_from_ip
|
||||
from .shell import ScriptRunner, execute
|
||||
from .shortcuts import (host_iter, hosts, get_current_user,
|
||||
get_current_username, split_hosts)
|
||||
from .strings import (COLORS, color_text, mask_string, state_format,
|
||||
state_message)
|
||||
from .network import get_localhost_ip
|
||||
from .network import host2ip
|
||||
from .network import force_ip
|
||||
from .network import device_from_ip
|
||||
from .shell import execute
|
||||
from .shell import ScriptRunner
|
||||
from .shortcuts import host_iter
|
||||
from .shortcuts import hosts
|
||||
from .shortcuts import get_current_user
|
||||
from .shortcuts import get_current_username
|
||||
from .shortcuts import split_hosts
|
||||
from .strings import COLORS
|
||||
from .strings import color_text
|
||||
from .strings import mask_string
|
||||
from .strings import state_format
|
||||
from .strings import state_message
|
||||
|
||||
|
||||
__all__ = ('SortedDict',
|
||||
|
@ -1,4 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import copy
|
||||
from types import GeneratorType
|
||||
|
@ -1,4 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import time
|
||||
|
||||
|
@ -1,10 +1,23 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import re
|
||||
import socket
|
||||
|
||||
from ..exceptions import NetworkError
|
||||
from .shell import execute, ScriptRunner
|
||||
from .shell import execute
|
||||
from .shell import ScriptRunner
|
||||
|
||||
|
||||
def get_localhost_ip():
|
||||
|
@ -1,4 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import re
|
||||
import os
|
||||
@ -6,8 +18,9 @@ import types
|
||||
import logging
|
||||
import subprocess
|
||||
|
||||
from ..exceptions import (ExecuteRuntimeError, ScriptRuntimeError,
|
||||
NetworkError)
|
||||
from ..exceptions import ExecuteRuntimeError
|
||||
from ..exceptions import NetworkError
|
||||
from ..exceptions import ScriptRuntimeError
|
||||
from .strings import mask_string
|
||||
|
||||
|
||||
|
@ -1,4 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import grp
|
||||
import os
|
||||
|
@ -1,4 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import re
|
||||
|
||||
|
@ -1,4 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
"""
|
||||
Contains all core validation functions.
|
||||
|
@ -1,4 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from ..installer import utils
|
||||
|
||||
|
@ -1,3 +1,15 @@
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import os
|
||||
import yaml
|
||||
@ -61,10 +73,10 @@ class ManifestFiles(object):
|
||||
if not self.global_data:
|
||||
with open(os.path.join(PUPPET_TEMPLATE_DIR, "global.pp")) as gfp:
|
||||
self.global_data = gfp.read() % controller.CONF
|
||||
os.mkdir(basedefs.PUPPET_MANIFEST_DIR, 0700)
|
||||
os.mkdir(basedefs.PUPPET_MANIFEST_DIR, 0o700)
|
||||
for fname, data in self.data.items():
|
||||
path = os.path.join(basedefs.PUPPET_MANIFEST_DIR, fname)
|
||||
fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0600)
|
||||
fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0o600)
|
||||
with os.fdopen(fd, 'w') as fp:
|
||||
fp.write(self.global_data + data)
|
||||
manifestfiles = ManifestFiles()
|
||||
@ -82,7 +94,7 @@ def appendManifestFile(manifest_name, data, marker=''):
|
||||
|
||||
|
||||
def generateHieraDataFile():
|
||||
os.mkdir(basedefs.HIERADATA_DIR, 0700)
|
||||
os.mkdir(basedefs.HIERADATA_DIR, 0o700)
|
||||
with open(HIERA_DEFAULTS_YAML, 'w') as outfile:
|
||||
outfile.write(yaml.dump(controller.CONF,
|
||||
explicit_start=True,
|
||||
|
@ -1,4 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import logging
|
||||
import os
|
||||
|
@ -1,4 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
"""
|
||||
Installs and configures AMQP
|
||||
@ -9,10 +21,9 @@ from packstack.installer import processors
|
||||
from packstack.installer import utils
|
||||
|
||||
from packstack.modules.common import filtered_hosts
|
||||
from packstack.modules.ospluginutils import (getManifestTemplate,
|
||||
appendManifestFile,
|
||||
createFirewallResources)
|
||||
|
||||
from packstack.modules.ospluginutils import appendManifestFile
|
||||
from packstack.modules.ospluginutils import createFirewallResources
|
||||
from packstack.modules.ospluginutils import getManifestTemplate
|
||||
|
||||
# ------------- AMQP Packstack Plugin Initialization --------------
|
||||
|
||||
|
@ -1,4 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
"""
|
||||
Installs and configures Ceilometer
|
||||
@ -11,10 +23,9 @@ from packstack.installer import validators
|
||||
from packstack.installer import processors
|
||||
from packstack.installer.utils import split_hosts
|
||||
from packstack.modules.shortcuts import get_mq
|
||||
from packstack.modules.ospluginutils import (getManifestTemplate,
|
||||
appendManifestFile,
|
||||
createFirewallResources)
|
||||
|
||||
from packstack.modules.ospluginutils import appendManifestFile
|
||||
from packstack.modules.ospluginutils import createFirewallResources
|
||||
from packstack.modules.ospluginutils import getManifestTemplate
|
||||
|
||||
# ------------- Ceilometer Packstack Plugin Initialization --------------
|
||||
|
||||
|
@ -1,4 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
"""
|
||||
Installs and configures Cinder
|
||||
@ -15,10 +27,9 @@ from packstack.installer import utils
|
||||
|
||||
|
||||
from packstack.modules.shortcuts import get_mq
|
||||
from packstack.modules.ospluginutils import (getManifestTemplate,
|
||||
appendManifestFile,
|
||||
createFirewallResources)
|
||||
|
||||
from packstack.modules.ospluginutils import appendManifestFile
|
||||
from packstack.modules.ospluginutils import createFirewallResources
|
||||
from packstack.modules.ospluginutils import getManifestTemplate
|
||||
|
||||
# ------------------ Cinder Packstack Plugin initialization ------------------
|
||||
|
||||
|
@ -1,4 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
"""
|
||||
Installs and configures OpenStack Horizon
|
||||
@ -11,9 +23,8 @@ from packstack.installer import validators
|
||||
from packstack.installer import exceptions
|
||||
from packstack.installer import utils
|
||||
|
||||
from packstack.modules.ospluginutils import (getManifestTemplate,
|
||||
appendManifestFile)
|
||||
|
||||
from packstack.modules.ospluginutils import appendManifestFile
|
||||
from packstack.modules.ospluginutils import getManifestTemplate
|
||||
|
||||
# ------------- Horizon Packstack Plugin Initialization --------------
|
||||
|
||||
|
@ -1,4 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
"""
|
||||
Installs and configures Glance
|
||||
@ -9,9 +21,9 @@ from packstack.installer import processors
|
||||
from packstack.installer import utils
|
||||
|
||||
from packstack.modules.shortcuts import get_mq
|
||||
from packstack.modules.ospluginutils import (getManifestTemplate,
|
||||
appendManifestFile,
|
||||
createFirewallResources)
|
||||
from packstack.modules.ospluginutils import appendManifestFile
|
||||
from packstack.modules.ospluginutils import createFirewallResources
|
||||
from packstack.modules.ospluginutils import getManifestTemplate
|
||||
|
||||
# ------------- Glance Packstack Plugin Initialization --------------
|
||||
|
||||
|
@ -1,4 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
"""
|
||||
Installs and configures Heat
|
||||
@ -11,10 +23,9 @@ from packstack.installer import validators
|
||||
from packstack.installer import processors
|
||||
|
||||
from packstack.modules.shortcuts import get_mq
|
||||
from packstack.modules.ospluginutils import (getManifestTemplate,
|
||||
appendManifestFile,
|
||||
createFirewallResources)
|
||||
|
||||
from packstack.modules.ospluginutils import appendManifestFile
|
||||
from packstack.modules.ospluginutils import createFirewallResources
|
||||
from packstack.modules.ospluginutils import getManifestTemplate
|
||||
|
||||
# ------------- Heat Packstack Plugin Initialization --------------
|
||||
|
||||
|
@ -1,15 +1,29 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
"""
|
||||
Installs and configures Ironic
|
||||
"""
|
||||
|
||||
from packstack.installer import utils, validators, processors
|
||||
from packstack.installer import utils
|
||||
from packstack.installer import validators
|
||||
from packstack.installer import processors
|
||||
|
||||
from packstack.modules.shortcuts import get_mq
|
||||
from packstack.modules.ospluginutils import (getManifestTemplate,
|
||||
appendManifestFile,
|
||||
createFirewallResources)
|
||||
from packstack.modules.ospluginutils import appendManifestFile
|
||||
from packstack.modules.ospluginutils import createFirewallResources
|
||||
from packstack.modules.ospluginutils import getManifestTemplate
|
||||
|
||||
# ------------------ Ironic Packstack Plugin initialization ------------------
|
||||
|
||||
|
@ -1,4 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
"""
|
||||
Installs and configures Keystone
|
||||
@ -10,10 +22,9 @@ from packstack.installer import validators
|
||||
from packstack.installer import processors
|
||||
from packstack.installer import utils
|
||||
|
||||
from packstack.modules.ospluginutils import (getManifestTemplate,
|
||||
appendManifestFile,
|
||||
createFirewallResources)
|
||||
|
||||
from packstack.modules.ospluginutils import appendManifestFile
|
||||
from packstack.modules.ospluginutils import createFirewallResources
|
||||
from packstack.modules.ospluginutils import getManifestTemplate
|
||||
|
||||
# ------------- Keystone Packstack Plugin Initialization --------------
|
||||
|
||||
|
@ -1,4 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
"""
|
||||
Installs and configures MariaDB
|
||||
@ -9,10 +21,9 @@ from packstack.installer import processors
|
||||
from packstack.installer import utils
|
||||
from packstack.modules.common import filtered_hosts
|
||||
|
||||
from packstack.modules.ospluginutils import (getManifestTemplate,
|
||||
appendManifestFile,
|
||||
createFirewallResources)
|
||||
|
||||
from packstack.modules.ospluginutils import appendManifestFile
|
||||
from packstack.modules.ospluginutils import createFirewallResources
|
||||
from packstack.modules.ospluginutils import getManifestTemplate
|
||||
|
||||
# ------------- MariaDB Packstack Plugin Initialization --------------
|
||||
|
||||
|
@ -1,4 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
"""
|
||||
Installs and configures Nagios
|
||||
@ -9,10 +21,9 @@ from packstack.installer import processors
|
||||
from packstack.installer import utils
|
||||
|
||||
from packstack.modules.common import filtered_hosts
|
||||
from packstack.modules.ospluginutils import (getManifestTemplate,
|
||||
appendManifestFile,
|
||||
createFirewallResources)
|
||||
|
||||
from packstack.modules.ospluginutils import appendManifestFile
|
||||
from packstack.modules.ospluginutils import createFirewallResources
|
||||
from packstack.modules.ospluginutils import getManifestTemplate
|
||||
|
||||
# ------------- Nagios Packstack Plugin Initialization --------------
|
||||
|
||||
|
@ -1,4 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
"""
|
||||
Installs and configures Neutron
|
||||
@ -12,10 +24,9 @@ from packstack.installer.utils import split_hosts
|
||||
|
||||
from packstack.modules.common import filtered_hosts
|
||||
from packstack.modules.shortcuts import get_mq
|
||||
from packstack.modules.ospluginutils import (getManifestTemplate,
|
||||
appendManifestFile,
|
||||
createFirewallResources)
|
||||
|
||||
from packstack.modules.ospluginutils import appendManifestFile
|
||||
from packstack.modules.ospluginutils import createFirewallResources
|
||||
from packstack.modules.ospluginutils import getManifestTemplate
|
||||
|
||||
# ------------- Neutron Packstack Plugin Initialization --------------
|
||||
|
||||
|
@ -1,4 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
"""
|
||||
Installs and configures Nova
|
||||
@ -8,14 +20,18 @@ import os
|
||||
import platform
|
||||
import socket
|
||||
|
||||
from packstack.installer import basedefs, processors, utils, validators
|
||||
from packstack.installer import basedefs
|
||||
from packstack.installer import processors
|
||||
from packstack.installer import utils
|
||||
from packstack.installer import validators
|
||||
from packstack.installer.exceptions import ScriptRuntimeError
|
||||
|
||||
from packstack.modules.shortcuts import get_mq
|
||||
from packstack.modules.ospluginutils import (NovaConfig, getManifestTemplate,
|
||||
appendManifestFile, manifestfiles,
|
||||
createFirewallResources)
|
||||
|
||||
from packstack.modules.ospluginutils import appendManifestFile
|
||||
from packstack.modules.ospluginutils import createFirewallResources
|
||||
from packstack.modules.ospluginutils import getManifestTemplate
|
||||
from packstack.modules.ospluginutils import manifestfiles
|
||||
from packstack.modules.ospluginutils import NovaConfig
|
||||
|
||||
# ------------- Nova Packstack Plugin Initialization --------------
|
||||
|
||||
@ -426,8 +442,7 @@ def create_api_manifest(config, messages):
|
||||
if config['CONFIG_NEUTRON_INSTALL'] != 'y':
|
||||
config['CONFIG_NEUTRON_METADATA_PW_UNQUOTED'] = 'undef'
|
||||
else:
|
||||
config['CONFIG_NEUTRON_METADATA_PW_UNQUOTED'] = \
|
||||
"%s" % config['CONFIG_NEUTRON_METADATA_PW']
|
||||
config['CONFIG_NEUTRON_METADATA_PW_UNQUOTED'] = "%s" % config['CONFIG_NEUTRON_METADATA_PW']
|
||||
manifestfile = "%s_api_nova.pp" % config['CONFIG_CONTROLLER_HOST']
|
||||
manifestdata = getManifestTemplate("nova_api")
|
||||
|
||||
|
@ -1,4 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
"""
|
||||
Installs and configures an OpenStack Client
|
||||
@ -8,9 +20,8 @@ import os
|
||||
|
||||
from packstack.installer import utils
|
||||
|
||||
from packstack.modules.ospluginutils import (getManifestTemplate,
|
||||
appendManifestFile)
|
||||
|
||||
from packstack.modules.ospluginutils import appendManifestFile
|
||||
from packstack.modules.ospluginutils import getManifestTemplate
|
||||
|
||||
# ------------- OpenStack Client Packstack Plugin Initialization --------------
|
||||
|
||||
|
@ -1,4 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
"""
|
||||
Plugin responsible for post-installation configuration
|
||||
@ -7,9 +19,8 @@ Plugin responsible for post-installation configuration
|
||||
from packstack.installer import utils
|
||||
|
||||
from packstack.modules.common import filtered_hosts
|
||||
from packstack.modules.ospluginutils import (getManifestTemplate,
|
||||
appendManifestFile)
|
||||
|
||||
from packstack.modules.ospluginutils import appendManifestFile
|
||||
from packstack.modules.ospluginutils import getManifestTemplate
|
||||
|
||||
# ------------- Postscript Packstack Plugin Initialization --------------
|
||||
|
||||
|
@ -1,4 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
"""
|
||||
Plugin responsible for setting OpenStack global options
|
||||
@ -9,13 +21,16 @@ import os
|
||||
import re
|
||||
import uuid
|
||||
|
||||
from packstack.installer import (basedefs, exceptions, processors, utils,
|
||||
validators)
|
||||
|
||||
from packstack.modules.common import filtered_hosts, is_all_in_one
|
||||
from packstack.modules.ospluginutils import (getManifestTemplate,
|
||||
appendManifestFile)
|
||||
from packstack.installer import basedefs
|
||||
from packstack.installer import exceptions
|
||||
from packstack.installer import processors
|
||||
from packstack.installer import utils
|
||||
from packstack.installer import validators
|
||||
|
||||
from packstack.modules.common import filtered_hosts
|
||||
from packstack.modules.common import is_all_in_one
|
||||
from packstack.modules.ospluginutils import appendManifestFile
|
||||
from packstack.modules.ospluginutils import getManifestTemplate
|
||||
|
||||
# ------------- Prescript Packstack Plugin Initialization --------------
|
||||
|
||||
|
@ -1,4 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
"""
|
||||
Installs and configures Provisioning for demo usage and testing
|
||||
@ -9,9 +21,8 @@ from packstack.installer import validators
|
||||
from packstack.installer import processors
|
||||
|
||||
from packstack.modules.common import is_all_in_one
|
||||
from packstack.modules.ospluginutils import (appendManifestFile,
|
||||
getManifestTemplate)
|
||||
|
||||
from packstack.modules.ospluginutils import appendManifestFile
|
||||
from packstack.modules.ospluginutils import getManifestTemplate
|
||||
|
||||
# ------------- Provision Packstack Plugin Initialization --------------
|
||||
|
||||
@ -307,7 +318,7 @@ def create_storage_manifest(config, messages):
|
||||
|
||||
def create_tempest_manifest(config, messages):
|
||||
using_neutron(config)
|
||||
manifest_file = '%s_provision_tempest.pp' % \
|
||||
config['CONFIG_CONTROLLER_HOST']
|
||||
manifest_file = ('%s_provision_tempest.pp' %
|
||||
config['CONFIG_CONTROLLER_HOST'])
|
||||
manifest_data = getManifestTemplate("provision_tempest")
|
||||
appendManifestFile(manifest_file, manifest_data)
|
||||
|
@ -1,4 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
"""
|
||||
Installs and configures Puppet
|
||||
@ -11,12 +23,14 @@ import time
|
||||
|
||||
from packstack.installer import utils
|
||||
from packstack.installer import basedefs
|
||||
from packstack.installer.exceptions import ScriptRuntimeError, PuppetError
|
||||
from packstack.installer.exceptions import PuppetError
|
||||
from packstack.installer.exceptions import ScriptRuntimeError
|
||||
|
||||
from packstack.modules.common import filtered_hosts
|
||||
from packstack.modules.ospluginutils import (manifestfiles,
|
||||
generateHieraDataFile)
|
||||
from packstack.modules.puppet import scan_logfile, validate_logfile
|
||||
from packstack.modules.ospluginutils import generateHieraDataFile
|
||||
from packstack.modules.ospluginutils import manifestfiles
|
||||
from packstack.modules.puppet import validate_logfile
|
||||
from packstack.modules.puppet import scan_logfile
|
||||
|
||||
|
||||
# ------------- Puppet Packstack Plugin Initialization --------------
|
||||
@ -245,7 +259,7 @@ def apply_puppet_manifest(config, messages):
|
||||
continue
|
||||
|
||||
host_dir = config['HOST_DETAILS'][hostname]['tmpdir']
|
||||
print "Applying %s" % manifest
|
||||
print("Applying %s" % manifest)
|
||||
server = utils.ScriptRunner(hostname)
|
||||
|
||||
man_path = os.path.join(config['HOST_DETAILS'][hostname]['tmpdir'],
|
||||
|
@ -1,4 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
"""
|
||||
Installs and configures Sahara
|
||||
@ -8,9 +20,9 @@ from packstack.installer import utils
|
||||
from packstack.installer import validators
|
||||
from packstack.installer import processors
|
||||
from packstack.modules.shortcuts import get_mq
|
||||
from packstack.modules.ospluginutils import (getManifestTemplate,
|
||||
appendManifestFile,
|
||||
createFirewallResources)
|
||||
from packstack.modules.ospluginutils import appendManifestFile
|
||||
from packstack.modules.ospluginutils import createFirewallResources
|
||||
from packstack.modules.ospluginutils import getManifestTemplate
|
||||
|
||||
# ------------------ Sahara installer initialization ------------------
|
||||
|
||||
|
@ -1,4 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
"""
|
||||
Plugin responsible for Server Preparation.
|
||||
@ -13,8 +25,8 @@ from packstack.installer import exceptions
|
||||
from packstack.installer import utils
|
||||
from packstack.installer import validators
|
||||
|
||||
from packstack.modules.common import filtered_hosts, is_all_in_one
|
||||
|
||||
from packstack.modules.common import filtered_hosts
|
||||
from packstack.modules.common import is_all_in_one
|
||||
|
||||
# ------------ Server Preparation Packstack Plugin Initialization -------------
|
||||
|
||||
|
@ -1,4 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
"""
|
||||
Installs and configures Swift
|
||||
@ -15,10 +27,10 @@ from packstack.installer.exceptions import ParamValidationError
|
||||
from packstack.installer import utils
|
||||
from packstack.installer.utils import split_hosts
|
||||
|
||||
from packstack.modules.ospluginutils import (getManifestTemplate,
|
||||
appendManifestFile, manifestfiles,
|
||||
createFirewallResources)
|
||||
|
||||
from packstack.modules.ospluginutils import appendManifestFile
|
||||
from packstack.modules.ospluginutils import createFirewallResources
|
||||
from packstack.modules.ospluginutils import getManifestTemplate
|
||||
from packstack.modules.ospluginutils import manifestfiles
|
||||
|
||||
# ------------- Swift Packstack Plugin Initialization --------------
|
||||
|
||||
|
@ -1,4 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
"""
|
||||
Installs and configures Trove
|
||||
@ -8,10 +20,9 @@ from packstack.installer import utils
|
||||
from packstack.installer import validators
|
||||
from packstack.installer import processors
|
||||
from packstack.modules.shortcuts import get_mq
|
||||
from packstack.modules.ospluginutils import (getManifestTemplate,
|
||||
appendManifestFile,
|
||||
createFirewallResources)
|
||||
|
||||
from packstack.modules.ospluginutils import appendManifestFile
|
||||
from packstack.modules.ospluginutils import createFirewallResources
|
||||
from packstack.modules.ospluginutils import getManifestTemplate
|
||||
|
||||
# ------------------ Trove Packstack Plugin initialization ------------------
|
||||
|
||||
|
@ -1,5 +1,17 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import contextlib
|
||||
import inspect
|
||||
@ -14,7 +26,7 @@ import unittest
|
||||
|
||||
def execute(cmd_string, check_error=True, return_code=0, input=None,
|
||||
block=True, error_msg='Error executing cmd'):
|
||||
print cmd_string
|
||||
print(cmd_string)
|
||||
cmd = cmd_string.split(' ')
|
||||
proc = subprocess.Popen(cmd,
|
||||
stdin=subprocess.PIPE,
|
||||
|
@ -1,4 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import os
|
||||
import pkg_resources
|
||||
|
22
setup.py
22
setup.py
@ -1,11 +1,25 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
|
||||
from setuptools import setup, find_packages, Command
|
||||
from setuptools import setup
|
||||
from setuptools import find_packages
|
||||
from setuptools import Command
|
||||
|
||||
from packstack import version
|
||||
|
||||
@ -42,11 +56,11 @@ class InstallModulesCommand(Command):
|
||||
# install third-party modules from openstack-puppet-modules repo
|
||||
if not os.path.exists(self.destination):
|
||||
try:
|
||||
os.makedirs(basedir, 0755)
|
||||
os.makedirs(basedir, 0o755)
|
||||
except OSError:
|
||||
# base directory exists
|
||||
pass
|
||||
print 'Cloning %(repo)s to %(destination)s' % locals()
|
||||
print('Cloning %(repo)s to %(destination)s' % locals())
|
||||
cmd = ('cd %(basedir)s; git clone %(repo)s %(repodir)s; '
|
||||
'cd %(repodir)s; git checkout %(branch)s; ' % locals())
|
||||
proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE,
|
||||
@ -63,7 +77,7 @@ class InstallModulesCommand(Command):
|
||||
continue
|
||||
|
||||
dest = os.path.join(self.destination, module)
|
||||
print 'Copying module %(module)s to %(dest)s' % locals()
|
||||
print('Copying module %(module)s to %(dest)s' % locals())
|
||||
shutil.rmtree(dest, ignore_errors=True)
|
||||
shutil.copytree(source, dest)
|
||||
|
||||
|
@ -82,11 +82,10 @@ class SshTarballTransferMixinTestCase(PackstackTestCaseMixin, TestCase):
|
||||
tarball = tarfile.open(pack_path)
|
||||
tarball.extractall(path=self.tempdir)
|
||||
# check content of files
|
||||
for path, content in \
|
||||
[('resources/res1.txt', 'resource one'),
|
||||
('resources/resdir/res2.txt', 'resource two'),
|
||||
('recipes/rec1.pp', 'recipe one'),
|
||||
('recipes/rec2.pp', 'recipe two')]:
|
||||
for path, content in [('resources/res1.txt', 'resource one'),
|
||||
('resources/resdir/res2.txt', 'resource two'),
|
||||
('recipes/rec1.pp', 'recipe one'),
|
||||
('recipes/rec2.pp', 'recipe two')]:
|
||||
with open(os.path.join(self.tempdir, path)) as f:
|
||||
fcont = f.read()
|
||||
self.assertEqual(fcont, content)
|
||||
|
@ -21,10 +21,13 @@ import subprocess
|
||||
import sys
|
||||
from unittest import TestCase
|
||||
|
||||
from packstack.modules import ospluginutils, puppet
|
||||
from packstack.installer import run_setup, basedefs
|
||||
from packstack.modules import ospluginutils
|
||||
from packstack.modules import puppet
|
||||
from packstack.installer import basedefs
|
||||
from packstack.installer import run_setup
|
||||
|
||||
from ..test_base import PackstackTestCaseMixin, FakePopen
|
||||
from ..test_base import FakePopen
|
||||
from ..test_base import PackstackTestCaseMixin
|
||||
|
||||
|
||||
def makefile(path, content):
|
||||
|
@ -48,8 +48,8 @@ class StepTestCase(PackstackTestCaseMixin, TestCase):
|
||||
contents = sys.stdout.getvalue()
|
||||
|
||||
state = '[ %s ]\n' % utils.color_text('DONE', 'green')
|
||||
if not contents.startswith('Running test') or \
|
||||
not contents.endswith(state):
|
||||
if(not contents.startswith('Running test') or
|
||||
not contents.endswith(state)):
|
||||
raise AssertionError('Step run test failed: %s' % contents)
|
||||
|
||||
|
||||
|
@ -23,7 +23,8 @@ import shutil
|
||||
import tempfile
|
||||
from unittest import TestCase
|
||||
|
||||
from ..test_base import PackstackTestCaseMixin, FakePopen
|
||||
from ..test_base import FakePopen
|
||||
from ..test_base import PackstackTestCaseMixin
|
||||
from packstack.installer.utils import *
|
||||
from packstack.installer.utils.strings import STR_MASK
|
||||
from packstack.installer.exceptions import ExecuteRuntimeError
|
||||
|
2
tox.ini
2
tox.ini
@ -33,6 +33,6 @@ commands = python setup.py build_sphinx
|
||||
# E123, E125 skipped as they are invalid PEP-8.
|
||||
#
|
||||
# All other checks should be enabled in the future.
|
||||
ignore = E123,E125,H803,F403,F821,F811,F841,E501,H302,H303,H304,H301,H306,H405,H404,H904,H201,H305,H307,H501,H102,H233,H101,H233,H232
|
||||
ignore = E123,E125,H803,F403,F821,F811,F841,E501,H302,H303,H304,H306,H405,H404,H305,H307,H501,H201,H101
|
||||
show-source = True
|
||||
exclude=.venv,.git,.tox
|
||||
|
Loading…
x
Reference in New Issue
Block a user