diff --git a/AUTHORS b/AUTHORS index e69de29..1724110 100644 --- a/AUTHORS +++ b/AUTHORS @@ -0,0 +1,2 @@ +efedorova +EkaterinaFedorova \ No newline at end of file diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..3006463 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,101 @@ +commit 28cbd261871038cf1fc4fa67d36c26ae9e9a4747 +Author: efedorova +Date: Mon Oct 14 13:27:09 2013 +0400 + + Fix bug with subfolder copying + + Save path in manifest object in relative way, not in absolute + +commit e98258043d9acbbf8f13d3017eebba9e04066cc9 +Author: efedorova +Date: Mon Oct 14 11:07:48 2013 +0400 + + Add wsgi support. + + Add config file + Fix interacting with consts + Change section names in manifests to correspond data_type + +commit f40fe7372c220fbf6c29acd80186c34a515f9792 +Author: efedorova +Date: Fri Oct 11 13:17:35 2013 +0400 + + Add api versioning + +commit eb3b446a9f0535709c393620680f9c0c005a6eff +Author: efedorova +Date: Thu Oct 10 19:29:15 2013 +0400 + + Unite root_dir with data_type root_dir + +commit 31472fb11b498b99d34b1d48a75643785729f451 +Author: efedorova +Date: Thu Oct 10 18:14:56 2013 +0400 + + All api calls implemented + +commit e1b704c61d76d204ce30c9822c9daa9fcda86c8c +Author: efedorova +Date: Thu Oct 10 14:40:17 2013 +0400 + + Add test.py with api calls + +commit b0c04f614e04f02a36e4435ff8d9e27f42271828 +Author: efedorova +Date: Thu Oct 10 14:33:57 2013 +0400 + + First version of murano Api added + +commit ac04b4e1b74868ebb2b71ef22008e886e3be01fe +Author: efedorova +Date: Wed Oct 9 12:05:20 2013 +0400 + + Update the result archive structure + +commit 63bd68cc2a87e961874eabf240be58912d6ec23a +Author: efedorova +Date: Tue Oct 8 20:09:29 2013 +0400 + + Add initial Archiver + +commit 7266c3b98c5851db00c7207bbdff60bdd9e71350 +Author: efedorova +Date: Tue Oct 8 16:29:06 2013 +0400 + + Fixed typos + + Add full manifest class defenition + +commit 8f18a1b75b68d8c97efd57673b160a9ceda608a3 +Author: efedorova +Date: Tue Oct 8 16:25:07 2013 +0400 + + Add Manifest class + + Add valid fields if all files specified in manifests exists + +commit 77cefffbf829ed8b5de0db24d2d4479ec6ce1223 +Author: efedorova +Date: Tue Oct 8 14:55:48 2013 +0400 + + Add new files + +commit 20fafd31acfe062c1a06eeb299ef38ed27bbbbe7 +Author: efedorova +Date: Tue Oct 8 12:12:37 2013 +0400 + + Update service manifests + + Add parser.py + +commit 3c2b1b65f16b93b7bd3c542844aa4c70f48c3ec3 +Author: efedorova +Date: Mon Oct 7 15:30:11 2013 +0400 + + Initial commit + +commit 87ce33fcf7b03e2722a636e641eb72ea87d9f38d +Author: EkaterinaFedorova +Date: Mon Oct 7 04:10:43 2013 -0700 + + Initial commit \ No newline at end of file diff --git a/MANIFEST.in b/MANIFEST.in index 0b23059..0720919 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,4 @@ -nclude AUTHORS +include AUTHORS include README.rst include ChangeLog include LICENSE diff --git a/babel.cfg b/babel.cfg new file mode 100644 index 0000000..efceab8 --- /dev/null +++ b/babel.cfg @@ -0,0 +1 @@ +[python: **.py] diff --git a/metadata_service/etc/murano-repository.conf b/etc/murano-repository.conf similarity index 100% rename from metadata_service/etc/murano-repository.conf rename to etc/murano-repository.conf diff --git a/metadata_service/tools/build_docs b/metadata_service/tools/build_docs deleted file mode 100755 index 6918edf..0000000 --- a/metadata_service/tools/build_docs +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -e - -tox -edocs diff --git a/metadata_service/tools/conf/README b/metadata_service/tools/conf/README deleted file mode 100644 index 0636fb7..0000000 --- a/metadata_service/tools/conf/README +++ /dev/null @@ -1,9 +0,0 @@ -This generate_sample.sh tool is used to generate etc/savanna/savanna.conf.sample-full - -Run it from the top-level working directory i.e. - - $> ./tools/conf/generate_sample.sh - -Watch out for warnings about modules like libvirt, qpid and zmq not -being found - these warnings are significant because they result -in options not appearing in the generated config file. diff --git a/metadata_service/tools/conf/extract_opts.py b/metadata_service/tools/conf/extract_opts.py deleted file mode 100644 index d3e9238..0000000 --- a/metadata_service/tools/conf/extract_opts.py +++ /dev/null @@ -1,273 +0,0 @@ -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - -# Copyright 2012 SINA Corporation -# All Rights Reserved. -# -# 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. -# -# @author: Zhongyue Luo, SINA Corporation. -# - -# stolen from the OpenStack Nova - -"""Extracts OpenStack config option info from module(s).""" - -import imp -import os -import re -import socket -import sys -import textwrap - -from oslo.config import cfg - -#from nova.openstack.common import importutils - - -STROPT = "StrOpt" -BOOLOPT = "BoolOpt" -INTOPT = "IntOpt" -FLOATOPT = "FloatOpt" -LISTOPT = "ListOpt" -MULTISTROPT = "MultiStrOpt" - -OPT_TYPES = { - STROPT: 'string value', - BOOLOPT: 'boolean value', - INTOPT: 'integer value', - FLOATOPT: 'floating point value', - LISTOPT: 'list value', - MULTISTROPT: 'multi valued', -} - -OPTION_COUNT = 0 -OPTION_REGEX = re.compile(r"(%s)" % "|".join([STROPT, BOOLOPT, INTOPT, - FLOATOPT, LISTOPT, - MULTISTROPT])) - -PY_EXT = ".py" -BASEDIR = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../")) -WORDWRAP_WIDTH = 60 - - -def main(srcfiles): - mods_by_pkg = dict() - for filepath in srcfiles: - pkg_name = filepath.split(os.sep)[1] - mod_str = '.'.join(['.'.join(filepath.split(os.sep)[:-1]), - os.path.basename(filepath).split('.')[0]]) - mods_by_pkg.setdefault(pkg_name, list()).append(mod_str) - # NOTE(lzyeval): place top level modules before packages - pkg_names = filter(lambda x: x.endswith(PY_EXT), mods_by_pkg.keys()) - pkg_names.sort() - ext_names = filter(lambda x: x not in pkg_names, mods_by_pkg.keys()) - ext_names.sort() - pkg_names.extend(ext_names) - - # opts_by_group is a mapping of group name to an options list - # The options list is a list of (module, options) tuples - opts_by_group = {'DEFAULT': []} - - for pkg_name in pkg_names: - mods = mods_by_pkg.get(pkg_name) - mods.sort() - for mod_str in mods: - if mod_str.endswith('.__init__'): - mod_str = mod_str[:mod_str.rfind(".")] - - mod_obj = _import_module(mod_str) - if not mod_obj: - continue - - for group, opts in _list_opts(mod_obj): - opts_by_group.setdefault(group, []).append((mod_str, opts)) - - print_group_opts('DEFAULT', opts_by_group.pop('DEFAULT', [])) - for group, opts in opts_by_group.items(): - print_group_opts(group, opts) - - print "# Total option count: %d" % OPTION_COUNT - - -def _import_module(mod_str): - try: - if mod_str.startswith('bin.'): - imp.load_source(mod_str[4:], os.path.join('bin', mod_str[4:])) - return sys.modules[mod_str[4:]] - else: - __import__(mod_str) - return sys.modules[mod_str] - #return importutils.import_module(mod_str) - except (ValueError, AttributeError), err: - return None - except ImportError, ie: - sys.stderr.write("%s\n" % str(ie)) - return None - except Exception, e: - return None - - -def _guess_groups(opt, mod_obj): - groups = [] - - # is it in the DEFAULT group? - if (opt.dest in cfg.CONF and - not isinstance(cfg.CONF[opt.dest], cfg.CONF.GroupAttr)): - groups.append('DEFAULT') - - # what other groups is it in? - for key, value in cfg.CONF.items(): - if not isinstance(value, cfg.CONF.GroupAttr): - continue - if opt.dest not in value: - continue - groups.append(key) - - if len(groups) == 1: - return groups[0] - - group = None - for g in groups: - if g in mod_obj.__name__: - group = g - break - - if group is None and 'DEFAULT' in groups: - sys.stderr.write("Guessing that " + opt.dest + - " in " + mod_obj.__name__ + - " is in DEFAULT group out of " + - ','.join(groups) + "\n") - return 'DEFAULT' - - if group is None: - sys.stderr.write("Unable to guess what group " + opt.dest + - " in " + mod_obj.__name__ + - " is in out of " + ','.join(groups) + "\n") - sys.exit(1) - - sys.stderr.write("Guessing that " + opt.dest + - " in " + mod_obj.__name__ + - " is in the " + group + - " group out of " + ','.join(groups) + "\n") - return group - - -def _list_opts(obj): - def is_opt(o): - return (isinstance(o, cfg.Opt) and - not isinstance(o, cfg.SubCommandOpt)) - - opts = list() - for attr_str in dir(obj): - attr_obj = getattr(obj, attr_str) - if is_opt(attr_obj): - opts.append(attr_obj) - elif (isinstance(attr_obj, list) and - all(map(lambda x: is_opt(x), attr_obj))): - opts.extend(attr_obj) - - ret = {} - for opt in opts: - ret.setdefault(_guess_groups(opt, obj), []).append(opt) - return ret.items() - - -def print_group_opts(group, opts_by_module): - print "[%s]" % group - print - global OPTION_COUNT - for mod, opts in opts_by_module: - OPTION_COUNT += len(opts) - print '#' - print '# Options defined in %s' % mod - print '#' - print - for opt in opts: - _print_opt(opt) - print - - -def _get_my_ip(): - try: - csock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) - csock.connect(('8.8.8.8', 80)) - (addr, port) = csock.getsockname() - csock.close() - return addr - except socket.error: - return None - - -def _sanitize_default(s): - """Set up a reasonably sensible default for pybasedir, my_ip and host.""" - if s.startswith(BASEDIR): - return s.replace(BASEDIR, '/usr/lib/python/site-packages') - elif BASEDIR in s: - return s.replace(BASEDIR, '') - elif s == _get_my_ip(): - return '10.0.0.1' - elif s == socket.getfqdn(): - return 'savanna' - elif s.strip() != s: - return '"%s"' % s - return s - - -def _print_opt(opt): - opt_name, opt_default, opt_help = opt.dest, opt.default, opt.help - if not opt_help: - sys.stderr.write('WARNING: "%s" is missing help string.\n' % opt_name) - opt_type = None - try: - opt_type = OPTION_REGEX.search(str(type(opt))).group(0) - except (ValueError, AttributeError), err: - sys.stderr.write("%s\n" % str(err)) - sys.exit(1) - opt_help += ' (' + OPT_TYPES[opt_type] + ')' - print '#', "\n# ".join(textwrap.wrap(opt_help, WORDWRAP_WIDTH)) - try: - if opt_default is None: - print '#%s=' % opt_name - elif opt_type == STROPT: - assert(isinstance(opt_default, basestring)) - print '#%s=%s' % (opt_name, _sanitize_default(opt_default)) - elif opt_type == BOOLOPT: - assert(isinstance(opt_default, bool)) - print '#%s=%s' % (opt_name, str(opt_default).lower()) - elif opt_type == INTOPT: - assert(isinstance(opt_default, int) and - not isinstance(opt_default, bool)) - print '#%s=%s' % (opt_name, opt_default) - elif opt_type == FLOATOPT: - assert(isinstance(opt_default, float)) - print '#%s=%s' % (opt_name, opt_default) - elif opt_type == LISTOPT: - assert(isinstance(opt_default, list)) - print '#%s=%s' % (opt_name, ','.join(opt_default)) - elif opt_type == MULTISTROPT: - assert(isinstance(opt_default, list)) - if not opt_default: - opt_default = [''] - for default in opt_default: - print '#%s=%s' % (opt_name, default) - print - except Exception: - sys.stderr.write('Error in option "%s"\n' % opt_name) - sys.exit(1) - - -if __name__ == '__main__': - if len(sys.argv) < 2: - print "usage: python %s [srcfile]...\n" % sys.argv[0] - sys.exit(0) - main(sys.argv[1:]) diff --git a/metadata_service/tools/conf/generate_sample.sh b/metadata_service/tools/conf/generate_sample.sh deleted file mode 100755 index a2e3791..0000000 --- a/metadata_service/tools/conf/generate_sample.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env bash -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - -# Copyright 2012 SINA Corporation -# All Rights Reserved. -# Author: Zhongyue Luo -# -# 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. - -# stolen from the OpenStack Nova - -FILES=$(find savanna -type f -name "*.py" ! -path "savanna/tests/*" -exec \ - grep -l "Opt(" {} \; | sort -u) -BINS=$(echo bin/savanna-*) - -PYTHONPATH=./:${PYTHONPATH} \ - tools/with_venv python $(dirname "$0")/extract_opts.py ${FILES} ${BINS} > \ - etc/savanna/savanna.conf.sample-full - -# Remove compiled files created by imp.import_source() -for bin in ${BINS}; do - [ -f ${bin}c ] && rm ${bin}c -done diff --git a/metadata_service/tools/get_auth_token b/metadata_service/tools/get_auth_token deleted file mode 100755 index d810ea5..0000000 --- a/metadata_service/tools/get_auth_token +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -tox -evenv -- python $(dirname $0)/get_auth_token.py $* diff --git a/metadata_service/tools/get_auth_token.py b/metadata_service/tools/get_auth_token.py deleted file mode 100644 index 7c35187..0000000 --- a/metadata_service/tools/get_auth_token.py +++ /dev/null @@ -1,89 +0,0 @@ -# Copyright (c) 2013 Mirantis Inc. -# -# 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 sys - -from keystoneclient.v2_0 import Client as keystone_client -from oslo.config import cfg - - -possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), - os.pardir, - os.pardir)) -if os.path.exists(os.path.join(possible_topdir, - 'savanna', - '__init__.py')): - sys.path.insert(0, possible_topdir) - -cli_opts = [ - cfg.StrOpt('username', default='', - help='set username'), - cfg.StrOpt('password', default='', - help='set password'), - cfg.StrOpt('tenant', default='', - help='set tenant'), -] - -CONF = cfg.CONF -CONF.import_opt('os_admin_username', 'savanna.main') -CONF.import_opt('os_admin_password', 'savanna.main') -CONF.import_opt('os_admin_tenant_name', 'savanna.main') -CONF.register_cli_opts(cli_opts) - - -def main(): - dev_conf = os.path.join(possible_topdir, - 'etc', - 'savanna', - 'savanna.conf') - config_files = None - if os.path.exists(dev_conf): - config_files = [dev_conf] - - CONF(sys.argv[1:], project='get_auth_token', - default_config_files=config_files) - - user = CONF.username or CONF.os_admin_username - password = CONF.password or CONF.os_admin_password - tenant = CONF.tenant or CONF.os_admin_tenant_name - - protocol = CONF.os_auth_protocol - host = CONF.os_auth_host - port = CONF.os_auth_port - - auth_url = "%s://%s:%s/v2.0/" % (protocol, host, port) - - print "User: %s" % user - print "Password: %s" % password - print "Tenant: %s" % tenant - print "Auth URL: %s" % auth_url - - keystone = keystone_client( - username=user, - password=password, - tenant_name=tenant, - auth_url=auth_url - ) - - result = keystone.authenticate() - - print "Auth succeed: %s" % result - print "Auth token: %s" % keystone.auth_token - print "Tenant [%s] id: %s" % (tenant, keystone.tenant_id) - - -if __name__ == "__main__": - main() diff --git a/metadata_service/tools/install_venv b/metadata_service/tools/install_venv deleted file mode 100755 index 6a4aea2..0000000 --- a/metadata_service/tools/install_venv +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -tox -vvv -evenv -- python --version diff --git a/metadata_service/tools/lintstack.py b/metadata_service/tools/lintstack.py deleted file mode 100755 index 8b70c0d..0000000 --- a/metadata_service/tools/lintstack.py +++ /dev/null @@ -1,200 +0,0 @@ -#!/usr/bin/env python -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - -# Copyright (c) 2012, AT&T Labs, Yun Mao -# All Rights Reserved. -# -# 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. - -# Stolen from OpenStack Nova - -"""pylint error checking.""" - -import cStringIO as StringIO -import json -import re -import sys - -from pylint import lint -from pylint.reporters import text - -# Note(maoy): E1103 is error code related to partial type inference -ignore_codes = ["E1103"] -# Note(maoy): the error message is the pattern of E0202. It should be ignored -# for savanna.tests modules -ignore_messages = ["An attribute affected in savanna.tests"] -# We ignore all errors in openstack.common because it should be checked -# elsewhere. -ignore_modules = ["savanna/openstack/common/"] - -KNOWN_PYLINT_EXCEPTIONS_FILE = "tools/pylint_exceptions" - - -class LintOutput(object): - - _cached_filename = None - _cached_content = None - - def __init__(self, filename, lineno, line_content, code, message, - lintoutput): - self.filename = filename - self.lineno = lineno - self.line_content = line_content - self.code = code - self.message = message - self.lintoutput = lintoutput - - @classmethod - def from_line(cls, line): - m = re.search(r"(\S+):(\d+): \[(\S+)(, \S+)?] (.*)", line) - matched = m.groups() - filename, lineno, code, message = (matched[0], int(matched[1]), - matched[2], matched[-1]) - if cls._cached_filename != filename: - with open(filename) as f: - cls._cached_content = list(f.readlines()) - cls._cached_filename = filename - line_content = cls._cached_content[lineno - 1].rstrip() - return cls(filename, lineno, line_content, code, message, - line.rstrip()) - - @classmethod - def from_msg_to_dict(cls, msg): - """From the output of pylint msg, to a dict, where each key - is a unique error identifier, value is a list of LintOutput - """ - result = {} - for line in msg.splitlines(): - obj = cls.from_line(line) - if obj.is_ignored(): - continue - key = obj.key() - if key not in result: - result[key] = [] - result[key].append(obj) - return result - - def is_ignored(self): - if self.code in ignore_codes: - return True - if any(self.filename.startswith(name) for name in ignore_modules): - return True - if any(msg in self.message for msg in ignore_messages): - return True - return False - - def key(self): - if self.code in ["E1101", "E1103"]: - # These two types of errors are like Foo class has no member bar. - # We discard the source code so that the error will be ignored - # next time another Foo.bar is encountered. - return self.message, "" - return self.message, self.line_content.strip() - - def json(self): - return json.dumps(self.__dict__) - - def review_str(self): - return ("File %(filename)s\nLine %(lineno)d:%(line_content)s\n" - "%(code)s: %(message)s" % self.__dict__) - - -class ErrorKeys(object): - - @classmethod - def print_json(cls, errors, output=sys.stdout): - print >>output, "# automatically generated by tools/lintstack.py" - for i in sorted(errors.keys()): - print >>output, json.dumps(i) - - @classmethod - def from_file(cls, filename): - keys = set() - for line in open(filename): - if line and line[0] != "#": - d = json.loads(line) - keys.add(tuple(d)) - return keys - - -def run_pylint(): - buff = StringIO.StringIO() - reporter = text.ParseableTextReporter(output=buff) - args = ["--include-ids=y", "-E", "savanna"] - lint.Run(args, reporter=reporter, exit=False) - val = buff.getvalue() - buff.close() - return val - - -def generate_error_keys(msg=None): - print "Generating", KNOWN_PYLINT_EXCEPTIONS_FILE - if msg is None: - msg = run_pylint() - errors = LintOutput.from_msg_to_dict(msg) - with open(KNOWN_PYLINT_EXCEPTIONS_FILE, "w") as f: - ErrorKeys.print_json(errors, output=f) - - -def validate(newmsg=None): - print "Loading", KNOWN_PYLINT_EXCEPTIONS_FILE - known = ErrorKeys.from_file(KNOWN_PYLINT_EXCEPTIONS_FILE) - if newmsg is None: - print "Running pylint. Be patient..." - newmsg = run_pylint() - errors = LintOutput.from_msg_to_dict(newmsg) - - print "Unique errors reported by pylint: was %d, now %d." \ - % (len(known), len(errors)) - passed = True - for err_key, err_list in errors.items(): - for err in err_list: - if err_key not in known: - print err.lintoutput - print - passed = False - if passed: - print "Congrats! pylint check passed." - redundant = known - set(errors.keys()) - if redundant: - print "Extra credit: some known pylint exceptions disappeared." - for i in sorted(redundant): - print json.dumps(i) - print "Consider regenerating the exception file if you will." - else: - print ("Please fix the errors above. If you believe they are false" - " positives, run 'tools/lintstack.py generate' to overwrite.") - sys.exit(1) - - -def usage(): - print """Usage: tools/lintstack.py [generate|validate] - To generate pylint_exceptions file: tools/lintstack.py generate - To validate the current commit: tools/lintstack.py - """ - - -def main(): - option = "validate" - if len(sys.argv) > 1: - option = sys.argv[1] - if option == "generate": - generate_error_keys() - elif option == "validate": - validate() - else: - usage() - - -if __name__ == "__main__": - main() diff --git a/metadata_service/tools/lintstack.sh b/metadata_service/tools/lintstack.sh deleted file mode 100755 index f2464b0..0000000 --- a/metadata_service/tools/lintstack.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env bash - -# Copyright (c) 2012-2013, AT&T Labs, Yun Mao -# All Rights Reserved. -# -# 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. - -# Stolen from OpenStack Nova - -# Use lintstack.py to compare pylint errors. -# We run pylint twice, once on HEAD, once on the code before the latest -# commit for review. -set -e -TOOLS_DIR=$(cd $(dirname "$0") && pwd) -# Get the current branch name. -GITHEAD=`git rev-parse --abbrev-ref HEAD` -if [[ "$GITHEAD" == "HEAD" ]]; then - # In detached head mode, get revision number instead - GITHEAD=`git rev-parse HEAD` - echo "Currently we are at commit $GITHEAD" -else - echo "Currently we are at branch $GITHEAD" -fi - -cp -f $TOOLS_DIR/lintstack.py $TOOLS_DIR/lintstack.head.py - -if git rev-parse HEAD^2 2>/dev/null; then - # The HEAD is a Merge commit. Here, the patch to review is - # HEAD^2, the master branch is at HEAD^1, and the patch was - # written based on HEAD^2~1. - PREV_COMMIT=`git rev-parse HEAD^2~1` - git checkout HEAD~1 - # The git merge is necessary for reviews with a series of patches. - # If not, this is a no-op so won't hurt either. - git merge $PREV_COMMIT -else - # The HEAD is not a merge commit. This won't happen on gerrit. - # Most likely you are running against your own patch locally. - # We assume the patch to examine is HEAD, and we compare it against - # HEAD~1 - git checkout HEAD~1 -fi - -# First generate tools/pylint_exceptions from HEAD~1 -$TOOLS_DIR/lintstack.head.py generate -# Then use that as a reference to compare against HEAD -git checkout $GITHEAD -$TOOLS_DIR/lintstack.head.py -echo "Check passed. FYI: the pylint exceptions are:" -cat $TOOLS_DIR/pylint_exceptions - diff --git a/metadata_service/tools/run_fast_checks b/metadata_service/tools/run_fast_checks deleted file mode 100755 index 14686b2..0000000 --- a/metadata_service/tools/run_fast_checks +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -tools/run_pep8 diff --git a/metadata_service/tools/run_itests b/metadata_service/tools/run_itests deleted file mode 100755 index 1084533..0000000 --- a/metadata_service/tools/run_itests +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -tox -e integration \ No newline at end of file diff --git a/metadata_service/tools/run_pep8 b/metadata_service/tools/run_pep8 deleted file mode 100755 index 256ec83..0000000 --- a/metadata_service/tools/run_pep8 +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -tox -epep8 diff --git a/metadata_service/tools/run_pylint b/metadata_service/tools/run_pylint deleted file mode 100755 index c69b8d1..0000000 --- a/metadata_service/tools/run_pylint +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -tox -epylint diff --git a/metadata_service/tools/run_tests b/metadata_service/tools/run_tests deleted file mode 100755 index ac5e6bf..0000000 --- a/metadata_service/tools/run_tests +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -tox -epy27 diff --git a/metadata_service/__init__.py b/muranorepository/__init__.py similarity index 100% rename from metadata_service/__init__.py rename to muranorepository/__init__.py diff --git a/metadata_service/cmd/__init__.py b/muranorepository/cmd/__init__.py similarity index 100% rename from metadata_service/cmd/__init__.py rename to muranorepository/cmd/__init__.py diff --git a/metadata_service/cmd/run.py b/muranorepository/cmd/run.py similarity index 77% rename from metadata_service/cmd/run.py rename to muranorepository/cmd/run.py index 59ac9bb..761c9de 100644 --- a/metadata_service/cmd/run.py +++ b/muranorepository/cmd/run.py @@ -24,16 +24,17 @@ from oslo.config import cfg # so that it will override what happens to be installed in # /usr/(local/)lib/python... possible_topdir = os.path.normpath(os.path.join(os.path.abspath(__file__), - os.pardir, os.pardir)) - + os.pardir, + os.pardir, + os.pardir)) if os.path.exists(os.path.join(possible_topdir, - 'metadata_service', + 'muranorepository', '__init__.py')): sys.path.insert(0, possible_topdir) -from metadata_service import config -import metadata_service.main as server -from metadata_service.openstack.common import log +from muranorepository import config +import muranorepository.main as server +from muranorepository.openstack.common import log LOG = log.getLogger(__name__) @@ -42,14 +43,14 @@ LOG = log.getLogger(__name__) def main(): dev_conf = os.path.join(possible_topdir, 'etc', - 'murano-repository.conf') + 'muranorepository.conf') config_files = None if os.path.exists(dev_conf): config_files = [dev_conf] config.parse_configs(sys.argv[1:], config_files) - log.setup('metadata-service') + log.setup('muranorepository') app = server.make_app() diff --git a/metadata_service/config.py b/muranorepository/config.py similarity index 92% rename from metadata_service/config.py rename to muranorepository/config.py index 2b60529..d0dd507 100644 --- a/metadata_service/config.py +++ b/muranorepository/config.py @@ -13,12 +13,12 @@ # See the License for the specific language governing permissions and # limitations under the License. from oslo.config import cfg -from metadata_service.openstack.common import log -from metadata_service.consts import * +from muranorepository.openstack.common import log +from muranorepository.consts import * server_opts = [ cfg.StrOpt('host', default='127.0.0.1'), - cfg.IntOpt('port', default='5000'), + cfg.IntOpt('port', default=5000), ] type_dirs_opts = [cfg.StrOpt(x) for x in DATA_TYPES] diff --git a/metadata_service/consts.py b/muranorepository/consts.py similarity index 100% rename from metadata_service/consts.py rename to muranorepository/consts.py diff --git a/metadata_service/main.py b/muranorepository/main.py similarity index 100% rename from metadata_service/main.py rename to muranorepository/main.py diff --git a/metadata_service/manifest.py b/muranorepository/manifest.py similarity index 100% rename from metadata_service/manifest.py rename to muranorepository/manifest.py diff --git a/metadata_service/openstack/__init__.py b/muranorepository/openstack/__init__.py similarity index 100% rename from metadata_service/openstack/__init__.py rename to muranorepository/openstack/__init__.py diff --git a/metadata_service/openstack/common/__init__.py b/muranorepository/openstack/common/__init__.py similarity index 100% rename from metadata_service/openstack/common/__init__.py rename to muranorepository/openstack/common/__init__.py diff --git a/metadata_service/openstack/common/cfgfilter.py b/muranorepository/openstack/common/cfgfilter.py similarity index 100% rename from metadata_service/openstack/common/cfgfilter.py rename to muranorepository/openstack/common/cfgfilter.py diff --git a/metadata_service/openstack/common/context.py b/muranorepository/openstack/common/context.py similarity index 98% rename from metadata_service/openstack/common/context.py rename to muranorepository/openstack/common/context.py index 0ab0a65..59a0ce7 100644 --- a/metadata_service/openstack/common/context.py +++ b/muranorepository/openstack/common/context.py @@ -24,7 +24,7 @@ context or provide additional information in their specific WSGI pipeline. import itertools -from metadata_service.openstack.common import uuidutils +from muranorepository.openstack.common import uuidutils def generate_request_id(): diff --git a/metadata_service/openstack/common/crypto/__init__.py b/muranorepository/openstack/common/crypto/__init__.py similarity index 100% rename from metadata_service/openstack/common/crypto/__init__.py rename to muranorepository/openstack/common/crypto/__init__.py diff --git a/metadata_service/openstack/common/crypto/utils.py b/muranorepository/openstack/common/crypto/utils.py similarity index 98% rename from metadata_service/openstack/common/crypto/utils.py rename to muranorepository/openstack/common/crypto/utils.py index 30d91ee..0aeebf8 100644 --- a/metadata_service/openstack/common/crypto/utils.py +++ b/muranorepository/openstack/common/crypto/utils.py @@ -19,8 +19,8 @@ import base64 from Crypto.Hash import HMAC from Crypto import Random -from metadata_service.openstack.common.gettextutils import _ # noqa -from metadata_service.openstack.common import importutils +from muranorepository.openstack.common.gettextutils import _ # noqa +from muranorepository.openstack.common import importutils class CryptoutilsException(Exception): diff --git a/metadata_service/openstack/common/eventlet_backdoor.py b/muranorepository/openstack/common/eventlet_backdoor.py similarity index 97% rename from metadata_service/openstack/common/eventlet_backdoor.py rename to muranorepository/openstack/common/eventlet_backdoor.py index 70a1e49..c64b9d0 100644 --- a/metadata_service/openstack/common/eventlet_backdoor.py +++ b/muranorepository/openstack/common/eventlet_backdoor.py @@ -31,8 +31,8 @@ import eventlet.backdoor import greenlet from oslo.config import cfg -from metadata_service.openstack.common.gettextutils import _ # noqa -from metadata_service.openstack.common import log as logging +from muranorepository.openstack.common.gettextutils import _ # noqa +from muranorepository.openstack.common import log as logging help_for_backdoor_port = ( "Acceptable values are 0, , and :, where 0 results " diff --git a/metadata_service/openstack/common/exception.py b/muranorepository/openstack/common/exception.py similarity index 98% rename from metadata_service/openstack/common/exception.py rename to muranorepository/openstack/common/exception.py index e59cce8..80b2c63 100644 --- a/metadata_service/openstack/common/exception.py +++ b/muranorepository/openstack/common/exception.py @@ -21,7 +21,7 @@ Exceptions common to OpenStack projects import logging -from metadata_service.openstack.common.gettextutils import _ # noqa +from muranorepository.openstack.common.gettextutils import _ # noqa _FATAL_EXCEPTION_FORMAT_ERRORS = False diff --git a/metadata_service/openstack/common/excutils.py b/muranorepository/openstack/common/excutils.py similarity index 98% rename from metadata_service/openstack/common/excutils.py rename to muranorepository/openstack/common/excutils.py index 30737d1..508c42f 100644 --- a/metadata_service/openstack/common/excutils.py +++ b/muranorepository/openstack/common/excutils.py @@ -26,7 +26,7 @@ import traceback import six -from metadata_service.openstack.common.gettextutils import _ # noqa +from muranorepository.openstack.common.gettextutils import _ # noqa class save_and_reraise_exception(object): diff --git a/metadata_service/openstack/common/fileutils.py b/muranorepository/openstack/common/fileutils.py similarity index 94% rename from metadata_service/openstack/common/fileutils.py rename to muranorepository/openstack/common/fileutils.py index 6898582..e954450 100644 --- a/metadata_service/openstack/common/fileutils.py +++ b/muranorepository/openstack/common/fileutils.py @@ -20,9 +20,9 @@ import contextlib import errno import os -from metadata_service.openstack.common import excutils -from metadata_service.openstack.common.gettextutils import _ # noqa -from metadata_service.openstack.common import log as logging +from muranorepository.openstack.common import excutils +from muranorepository.openstack.common.gettextutils import _ # noqa +from muranorepository.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/metadata_service/openstack/common/gettextutils.py b/muranorepository/openstack/common/gettextutils.py similarity index 99% rename from metadata_service/openstack/common/gettextutils.py rename to muranorepository/openstack/common/gettextutils.py index 0b3669f..930a212 100644 --- a/metadata_service/openstack/common/gettextutils.py +++ b/muranorepository/openstack/common/gettextutils.py @@ -21,7 +21,7 @@ gettext for openstack-common modules. Usual usage in an openstack.common module: - from metadata_service.openstack.common.gettextutils import _ + from muranorepository.openstack.common.gettextutils import _ """ import copy diff --git a/metadata_service/openstack/common/importutils.py b/muranorepository/openstack/common/importutils.py similarity index 100% rename from metadata_service/openstack/common/importutils.py rename to muranorepository/openstack/common/importutils.py diff --git a/metadata_service/openstack/common/jsonutils.py b/muranorepository/openstack/common/jsonutils.py similarity index 97% rename from metadata_service/openstack/common/jsonutils.py rename to muranorepository/openstack/common/jsonutils.py index 503131e..09b7a5c 100644 --- a/metadata_service/openstack/common/jsonutils.py +++ b/muranorepository/openstack/common/jsonutils.py @@ -46,9 +46,9 @@ except ImportError: import six -from metadata_service.openstack.common import gettextutils -from metadata_service.openstack.common import importutils -from metadata_service.openstack.common import timeutils +from muranorepository.openstack.common import gettextutils +from muranorepository.openstack.common import importutils +from muranorepository.openstack.common import timeutils netaddr = importutils.try_import("netaddr") diff --git a/metadata_service/openstack/common/local.py b/muranorepository/openstack/common/local.py similarity index 100% rename from metadata_service/openstack/common/local.py rename to muranorepository/openstack/common/local.py diff --git a/metadata_service/openstack/common/lockutils.py b/muranorepository/openstack/common/lockutils.py similarity index 97% rename from metadata_service/openstack/common/lockutils.py rename to muranorepository/openstack/common/lockutils.py index a4a4308..525dae7 100644 --- a/metadata_service/openstack/common/lockutils.py +++ b/muranorepository/openstack/common/lockutils.py @@ -26,10 +26,10 @@ import weakref from oslo.config import cfg -from metadata_service.openstack.common import fileutils -from metadata_service.openstack.common.gettextutils import _ # noqa -from metadata_service.openstack.common import local -from metadata_service.openstack.common import log as logging +from muranorepository.openstack.common import fileutils +from muranorepository.openstack.common.gettextutils import _ # noqa +from muranorepository.openstack.common import local +from muranorepository.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/metadata_service/openstack/common/log.py b/muranorepository/openstack/common/log.py similarity index 98% rename from metadata_service/openstack/common/log.py rename to muranorepository/openstack/common/log.py index cf39b3b..e9f3f4b 100644 --- a/metadata_service/openstack/common/log.py +++ b/muranorepository/openstack/common/log.py @@ -41,10 +41,10 @@ import traceback from oslo.config import cfg from six import moves -from metadata_service.openstack.common.gettextutils import _ # noqa -from metadata_service.openstack.common import importutils -from metadata_service.openstack.common import jsonutils -from metadata_service.openstack.common import local +from muranorepository.openstack.common.gettextutils import _ # noqa +from muranorepository.openstack.common import importutils +from muranorepository.openstack.common import jsonutils +from muranorepository.openstack.common import local _DEFAULT_LOG_DATE_FORMAT = "%Y-%m-%d %H:%M:%S" @@ -425,7 +425,7 @@ def _setup_logging_from_conf(): if CONF.publish_errors: handler = importutils.import_object( - "metadata_service.openstack.common.log_handler.PublishErrorsHandler", + "muranorepository.openstack.common.log_handler.PublishErrorsHandler", logging.ERROR) log_root.addHandler(handler) diff --git a/metadata_service/openstack/common/loopingcall.py b/muranorepository/openstack/common/loopingcall.py similarity index 96% rename from metadata_service/openstack/common/loopingcall.py rename to muranorepository/openstack/common/loopingcall.py index 593f1b6..9c91558 100644 --- a/metadata_service/openstack/common/loopingcall.py +++ b/muranorepository/openstack/common/loopingcall.py @@ -22,9 +22,9 @@ import sys from eventlet import event from eventlet import greenthread -from metadata_service.openstack.common.gettextutils import _ # noqa -from metadata_service.openstack.common import log as logging -from metadata_service.openstack.common import timeutils +from muranorepository.openstack.common.gettextutils import _ # noqa +from muranorepository.openstack.common import log as logging +from muranorepository.openstack.common import timeutils LOG = logging.getLogger(__name__) diff --git a/metadata_service/openstack/common/middleware/__init__.py b/muranorepository/openstack/common/middleware/__init__.py similarity index 100% rename from metadata_service/openstack/common/middleware/__init__.py rename to muranorepository/openstack/common/middleware/__init__.py diff --git a/metadata_service/openstack/common/middleware/base.py b/muranorepository/openstack/common/middleware/base.py similarity index 100% rename from metadata_service/openstack/common/middleware/base.py rename to muranorepository/openstack/common/middleware/base.py diff --git a/metadata_service/openstack/common/middleware/debug.py b/muranorepository/openstack/common/middleware/debug.py similarity index 96% rename from metadata_service/openstack/common/middleware/debug.py rename to muranorepository/openstack/common/middleware/debug.py index 5add480..9511500 100644 --- a/metadata_service/openstack/common/middleware/debug.py +++ b/muranorepository/openstack/common/middleware/debug.py @@ -20,7 +20,7 @@ import sys import webob.dec -from metadata_service.openstack.common.middleware import base +from muranorepository.openstack.common.middleware import base class Debug(base.Middleware): diff --git a/metadata_service/openstack/common/network_utils.py b/muranorepository/openstack/common/network_utils.py similarity index 100% rename from metadata_service/openstack/common/network_utils.py rename to muranorepository/openstack/common/network_utils.py diff --git a/metadata_service/openstack/common/notifier/__init__.py b/muranorepository/openstack/common/notifier/__init__.py similarity index 100% rename from metadata_service/openstack/common/notifier/__init__.py rename to muranorepository/openstack/common/notifier/__init__.py diff --git a/metadata_service/openstack/common/notifier/api.py b/muranorepository/openstack/common/notifier/api.py similarity index 93% rename from metadata_service/openstack/common/notifier/api.py rename to muranorepository/openstack/common/notifier/api.py index b6fe051..51cc95b 100644 --- a/metadata_service/openstack/common/notifier/api.py +++ b/muranorepository/openstack/common/notifier/api.py @@ -18,12 +18,12 @@ import uuid from oslo.config import cfg -from metadata_service.openstack.common import context -from metadata_service.openstack.common.gettextutils import _ # noqa -from metadata_service.openstack.common import importutils -from metadata_service.openstack.common import jsonutils -from metadata_service.openstack.common import log as logging -from metadata_service.openstack.common import timeutils +from muranorepository.openstack.common import context +from muranorepository.openstack.common.gettextutils import _ # noqa +from muranorepository.openstack.common import importutils +from muranorepository.openstack.common import jsonutils +from muranorepository.openstack.common import log as logging +from muranorepository.openstack.common import timeutils LOG = logging.getLogger(__name__) diff --git a/metadata_service/openstack/common/notifier/log_notifier.py b/muranorepository/openstack/common/notifier/log_notifier.py similarity index 86% rename from metadata_service/openstack/common/notifier/log_notifier.py rename to muranorepository/openstack/common/notifier/log_notifier.py index 856fa06..d4e6085 100644 --- a/metadata_service/openstack/common/notifier/log_notifier.py +++ b/muranorepository/openstack/common/notifier/log_notifier.py @@ -15,8 +15,8 @@ from oslo.config import cfg -from metadata_service.openstack.common import jsonutils -from metadata_service.openstack.common import log as logging +from muranorepository.openstack.common import jsonutils +from muranorepository.openstack.common import log as logging CONF = cfg.CONF @@ -32,6 +32,6 @@ def notify(_context, message): CONF.default_notification_level) priority = priority.lower() logger = logging.getLogger( - 'metadata_service.openstack.common.notification.%s' % + 'muranorepository.openstack.common.notification.%s' % message['event_type']) getattr(logger, priority)(jsonutils.dumps(message)) diff --git a/metadata_service/openstack/common/notifier/no_op_notifier.py b/muranorepository/openstack/common/notifier/no_op_notifier.py similarity index 100% rename from metadata_service/openstack/common/notifier/no_op_notifier.py rename to muranorepository/openstack/common/notifier/no_op_notifier.py diff --git a/metadata_service/openstack/common/notifier/rpc_notifier.py b/muranorepository/openstack/common/notifier/rpc_notifier.py similarity index 86% rename from metadata_service/openstack/common/notifier/rpc_notifier.py rename to muranorepository/openstack/common/notifier/rpc_notifier.py index 62de085..8bf116f 100644 --- a/metadata_service/openstack/common/notifier/rpc_notifier.py +++ b/muranorepository/openstack/common/notifier/rpc_notifier.py @@ -15,10 +15,10 @@ from oslo.config import cfg -from metadata_service.openstack.common import context as req_context -from metadata_service.openstack.common.gettextutils import _ # noqa -from metadata_service.openstack.common import log as logging -from metadata_service.openstack.common import rpc +from muranorepository.openstack.common import context as req_context +from muranorepository.openstack.common.gettextutils import _ # noqa +from muranorepository.openstack.common import log as logging +from muranorepository.openstack.common import rpc LOG = logging.getLogger(__name__) diff --git a/metadata_service/openstack/common/notifier/rpc_notifier2.py b/muranorepository/openstack/common/notifier/rpc_notifier2.py similarity index 88% rename from metadata_service/openstack/common/notifier/rpc_notifier2.py rename to muranorepository/openstack/common/notifier/rpc_notifier2.py index a2ddf39..be5b4c0 100644 --- a/metadata_service/openstack/common/notifier/rpc_notifier2.py +++ b/muranorepository/openstack/common/notifier/rpc_notifier2.py @@ -17,10 +17,10 @@ from oslo.config import cfg -from metadata_service.openstack.common import context as req_context -from metadata_service.openstack.common.gettextutils import _ # noqa -from metadata_service.openstack.common import log as logging -from metadata_service.openstack.common import rpc +from muranorepository.openstack.common import context as req_context +from muranorepository.openstack.common.gettextutils import _ # noqa +from muranorepository.openstack.common import log as logging +from muranorepository.openstack.common import rpc LOG = logging.getLogger(__name__) diff --git a/metadata_service/openstack/common/notifier/test_notifier.py b/muranorepository/openstack/common/notifier/test_notifier.py similarity index 100% rename from metadata_service/openstack/common/notifier/test_notifier.py rename to muranorepository/openstack/common/notifier/test_notifier.py diff --git a/metadata_service/openstack/common/periodic_task.py b/muranorepository/openstack/common/periodic_task.py similarity index 97% rename from metadata_service/openstack/common/periodic_task.py rename to muranorepository/openstack/common/periodic_task.py index df482ef..7a990b8 100644 --- a/metadata_service/openstack/common/periodic_task.py +++ b/muranorepository/openstack/common/periodic_task.py @@ -18,9 +18,9 @@ import time from oslo.config import cfg -from metadata_service.openstack.common.gettextutils import _ # noqa -from metadata_service.openstack.common import log as logging -from metadata_service.openstack.common import timeutils +from muranorepository.openstack.common.gettextutils import _ # noqa +from muranorepository.openstack.common import log as logging +from muranorepository.openstack.common import timeutils periodic_opts = [ diff --git a/metadata_service/openstack/common/processutils.py b/muranorepository/openstack/common/processutils.py similarity index 98% rename from metadata_service/openstack/common/processutils.py rename to muranorepository/openstack/common/processutils.py index b7b5673..b86fe3b 100644 --- a/metadata_service/openstack/common/processutils.py +++ b/muranorepository/openstack/common/processutils.py @@ -28,8 +28,8 @@ import signal from eventlet.green import subprocess from eventlet import greenthread -from metadata_service.openstack.common.gettextutils import _ # noqa -from metadata_service.openstack.common import log as logging +from muranorepository.openstack.common.gettextutils import _ # noqa +from muranorepository.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/metadata_service/openstack/common/rpc/__init__.py b/muranorepository/openstack/common/rpc/__init__.py similarity index 97% rename from metadata_service/openstack/common/rpc/__init__.py rename to muranorepository/openstack/common/rpc/__init__.py index d50af54..cae41ff 100644 --- a/metadata_service/openstack/common/rpc/__init__.py +++ b/muranorepository/openstack/common/rpc/__init__.py @@ -21,7 +21,7 @@ A remote procedure call (rpc) abstraction. For some wrappers that add message versioning to rpc, see: - rpc.dimetadata_servicespatcher + rpc.dimuranorepositoryspatcher rpc.proxy """ @@ -29,10 +29,10 @@ import inspect from oslo.config import cfg -from metadata_service.openstack.common.gettextutils import _ # noqa -from metadata_service.openstack.common import importutils -from metadata_service.openstack.common import local -from metadata_service.openstack.common import log as logging +from muranorepository.openstack.common.gettextutils import _ # noqa +from muranorepository.openstack.common import importutils +from muranorepository.openstack.common import local +from muranorepository.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/metadata_service/openstack/common/rpc/amqp.py b/muranorepository/openstack/common/rpc/amqp.py similarity index 98% rename from metadata_service/openstack/common/rpc/amqp.py rename to muranorepository/openstack/common/rpc/amqp.py index 6621c1b..368629b 100644 --- a/metadata_service/openstack/common/rpc/amqp.py +++ b/muranorepository/openstack/common/rpc/amqp.py @@ -36,11 +36,11 @@ from eventlet import queue from eventlet import semaphore from oslo.config import cfg -from metadata_service.openstack.common import excutils -from metadata_service.openstack.common.gettextutils import _ # noqa -from metadata_service.openstack.common import local -from metadata_service.openstack.common import log as logging -from metadata_service.openstack.common.rpc import common as rpc_common +from muranorepository.openstack.common import excutils +from muranorepository.openstack.common.gettextutils import _ # noqa +from muranorepository.openstack.common import local +from muranorepository.openstack.common import log as logging +from muranorepository.openstack.common.rpc import common as rpc_common amqp_opts = [ diff --git a/metadata_service/openstack/common/rpc/common.py b/muranorepository/openstack/common/rpc/common.py similarity index 98% rename from metadata_service/openstack/common/rpc/common.py rename to muranorepository/openstack/common/rpc/common.py index 3cefc3b..d63a3e1 100644 --- a/metadata_service/openstack/common/rpc/common.py +++ b/muranorepository/openstack/common/rpc/common.py @@ -24,11 +24,11 @@ import traceback from oslo.config import cfg import six -from metadata_service.openstack.common.gettextutils import _ # noqa -from metadata_service.openstack.common import importutils -from metadata_service.openstack.common import jsonutils -from metadata_service.openstack.common import local -from metadata_service.openstack.common import log as logging +from muranorepository.openstack.common.gettextutils import _ # noqa +from muranorepository.openstack.common import importutils +from muranorepository.openstack.common import jsonutils +from muranorepository.openstack.common import local +from muranorepository.openstack.common import log as logging CONF = cfg.CONF diff --git a/metadata_service/openstack/common/rpc/dispatcher.py b/muranorepository/openstack/common/rpc/dispatcher.py similarity index 98% rename from metadata_service/openstack/common/rpc/dispatcher.py rename to muranorepository/openstack/common/rpc/dispatcher.py index 91e64cc..346f118 100644 --- a/metadata_service/openstack/common/rpc/dispatcher.py +++ b/muranorepository/openstack/common/rpc/dispatcher.py @@ -83,8 +83,8 @@ On the client side, the same changes should be made as in example 1. The minimum version that supports the new parameter should be specified. """ -from metadata_service.openstack.common.rpc import common as rpc_common -from metadata_service.openstack.common.rpc import serializer as rpc_serializer +from muranorepository.openstack.common.rpc import common as rpc_common +from muranorepository.openstack.common.rpc import serializer as rpc_serializer class RpcDispatcher(object): diff --git a/metadata_service/openstack/common/rpc/impl_fake.py b/muranorepository/openstack/common/rpc/impl_fake.py similarity index 98% rename from metadata_service/openstack/common/rpc/impl_fake.py rename to muranorepository/openstack/common/rpc/impl_fake.py index b103315..e08d385 100644 --- a/metadata_service/openstack/common/rpc/impl_fake.py +++ b/muranorepository/openstack/common/rpc/impl_fake.py @@ -27,7 +27,7 @@ import time import eventlet -from metadata_service.openstack.common.rpc import common as rpc_common +from muranorepository.openstack.common.rpc import common as rpc_common CONSUMERS = {} diff --git a/metadata_service/openstack/common/rpc/impl_kombu.py b/muranorepository/openstack/common/rpc/impl_kombu.py similarity index 98% rename from metadata_service/openstack/common/rpc/impl_kombu.py rename to muranorepository/openstack/common/rpc/impl_kombu.py index 4526d1f..60285b0 100644 --- a/metadata_service/openstack/common/rpc/impl_kombu.py +++ b/muranorepository/openstack/common/rpc/impl_kombu.py @@ -29,12 +29,12 @@ import kombu.entity import kombu.messaging from oslo.config import cfg -from metadata_service.openstack.common import excutils -from metadata_service.openstack.common.gettextutils import _ # noqa -from metadata_service.openstack.common import network_utils -from metadata_service.openstack.common.rpc import amqp as rpc_amqp -from metadata_service.openstack.common.rpc import common as rpc_common -from metadata_service.openstack.common import sslutils +from muranorepository.openstack.common import excutils +from muranorepository.openstack.common.gettextutils import _ # noqa +from muranorepository.openstack.common import network_utils +from muranorepository.openstack.common.rpc import amqp as rpc_amqp +from muranorepository.openstack.common.rpc import common as rpc_common +from muranorepository.openstack.common import sslutils kombu_opts = [ cfg.StrOpt('kombu_ssl_version', diff --git a/metadata_service/openstack/common/rpc/impl_qpid.py b/muranorepository/openstack/common/rpc/impl_qpid.py similarity index 98% rename from metadata_service/openstack/common/rpc/impl_qpid.py rename to muranorepository/openstack/common/rpc/impl_qpid.py index 7a2b722..67f13d4 100644 --- a/metadata_service/openstack/common/rpc/impl_qpid.py +++ b/muranorepository/openstack/common/rpc/impl_qpid.py @@ -24,13 +24,13 @@ import eventlet import greenlet from oslo.config import cfg -from metadata_service.openstack.common import excutils -from metadata_service.openstack.common.gettextutils import _ # noqa -from metadata_service.openstack.common import importutils -from metadata_service.openstack.common import jsonutils -from metadata_service.openstack.common import log as logging -from metadata_service.openstack.common.rpc import amqp as rpc_amqp -from metadata_service.openstack.common.rpc import common as rpc_common +from muranorepository.openstack.common import excutils +from muranorepository.openstack.common.gettextutils import _ # noqa +from muranorepository.openstack.common import importutils +from muranorepository.openstack.common import jsonutils +from muranorepository.openstack.common import log as logging +from muranorepository.openstack.common.rpc import amqp as rpc_amqp +from muranorepository.openstack.common.rpc import common as rpc_common qpid_codec = importutils.try_import("qpid.codec010") qpid_messaging = importutils.try_import("qpid.messaging") diff --git a/metadata_service/openstack/common/rpc/impl_zmq.py b/muranorepository/openstack/common/rpc/impl_zmq.py similarity index 98% rename from metadata_service/openstack/common/rpc/impl_zmq.py rename to muranorepository/openstack/common/rpc/impl_zmq.py index 8b80fe5..f8fc2b2 100644 --- a/metadata_service/openstack/common/rpc/impl_zmq.py +++ b/muranorepository/openstack/common/rpc/impl_zmq.py @@ -26,11 +26,11 @@ import eventlet import greenlet from oslo.config import cfg -from metadata_service.openstack.common import excutils -from metadata_service.openstack.common.gettextutils import _ # noqa -from metadata_service.openstack.common import importutils -from metadata_service.openstack.common import jsonutils -from metadata_service.openstack.common.rpc import common as rpc_common +from muranorepository.openstack.common import excutils +from muranorepository.openstack.common.gettextutils import _ # noqa +from muranorepository.openstack.common import importutils +from muranorepository.openstack.common import jsonutils +from muranorepository.openstack.common.rpc import common as rpc_common zmq = importutils.try_import('eventlet.green.zmq') @@ -51,7 +51,7 @@ zmq_opts = [ # The module.Class to use for matchmaking. cfg.StrOpt( 'rpc_zmq_matchmaker', - default=('metadata_service.openstack.common.rpc.' + default=('muranorepository.openstack.common.rpc.' 'matchmaker.MatchMakerLocalhost'), help='MatchMaker driver', ), diff --git a/metadata_service/openstack/common/rpc/matchmaker.py b/muranorepository/openstack/common/rpc/matchmaker.py similarity index 98% rename from metadata_service/openstack/common/rpc/matchmaker.py rename to muranorepository/openstack/common/rpc/matchmaker.py index 663f02d..938f6c2 100644 --- a/metadata_service/openstack/common/rpc/matchmaker.py +++ b/muranorepository/openstack/common/rpc/matchmaker.py @@ -23,8 +23,8 @@ import contextlib import eventlet from oslo.config import cfg -from metadata_service.openstack.common.gettextutils import _ # noqa -from metadata_service.openstack.common import log as logging +from muranorepository.openstack.common.gettextutils import _ # noqa +from muranorepository.openstack.common import log as logging matchmaker_opts = [ diff --git a/metadata_service/openstack/common/rpc/matchmaker_redis.py b/muranorepository/openstack/common/rpc/matchmaker_redis.py similarity index 96% rename from metadata_service/openstack/common/rpc/matchmaker_redis.py rename to muranorepository/openstack/common/rpc/matchmaker_redis.py index 4d523b4..c99d27f 100644 --- a/metadata_service/openstack/common/rpc/matchmaker_redis.py +++ b/muranorepository/openstack/common/rpc/matchmaker_redis.py @@ -20,9 +20,9 @@ return keys for direct exchanges, per (approximate) AMQP parlance. from oslo.config import cfg -from metadata_service.openstack.common import importutils -from metadata_service.openstack.common import log as logging -from metadata_service.openstack.common.rpc import matchmaker as mm_common +from muranorepository.openstack.common import importutils +from muranorepository.openstack.common import log as logging +from muranorepository.openstack.common.rpc import matchmaker as mm_common redis = importutils.try_import('redis') diff --git a/metadata_service/openstack/common/rpc/matchmaker_ring.py b/muranorepository/openstack/common/rpc/matchmaker_ring.py similarity index 94% rename from metadata_service/openstack/common/rpc/matchmaker_ring.py rename to muranorepository/openstack/common/rpc/matchmaker_ring.py index 80aee49..d5732a2 100644 --- a/metadata_service/openstack/common/rpc/matchmaker_ring.py +++ b/muranorepository/openstack/common/rpc/matchmaker_ring.py @@ -23,9 +23,9 @@ import json from oslo.config import cfg -from metadata_service.openstack.common.gettextutils import _ # noqa -from metadata_service.openstack.common import log as logging -from metadata_service.openstack.common.rpc import matchmaker as mm +from muranorepository.openstack.common.gettextutils import _ # noqa +from muranorepository.openstack.common import log as logging +from muranorepository.openstack.common.rpc import matchmaker as mm matchmaker_opts = [ diff --git a/metadata_service/openstack/common/rpc/proxy.py b/muranorepository/openstack/common/rpc/proxy.py similarity index 98% rename from metadata_service/openstack/common/rpc/proxy.py rename to muranorepository/openstack/common/rpc/proxy.py index ba9086d..2dd0352 100644 --- a/metadata_service/openstack/common/rpc/proxy.py +++ b/muranorepository/openstack/common/rpc/proxy.py @@ -22,9 +22,9 @@ For more information about rpc API version numbers, see: """ -from metadata_service.openstack.common import rpc -from metadata_service.openstack.common.rpc import common as rpc_common -from metadata_service.openstack.common.rpc import serializer as rpc_serializer +from muranorepository.openstack.common import rpc +from muranorepository.openstack.common.rpc import common as rpc_common +from muranorepository.openstack.common.rpc import serializer as rpc_serializer class RpcProxy(object): diff --git a/metadata_service/openstack/common/rpc/securemessage.py b/muranorepository/openstack/common/rpc/securemessage.py similarity index 98% rename from metadata_service/openstack/common/rpc/securemessage.py rename to muranorepository/openstack/common/rpc/securemessage.py index 94e8e9d..073deeb 100644 --- a/metadata_service/openstack/common/rpc/securemessage.py +++ b/muranorepository/openstack/common/rpc/securemessage.py @@ -24,9 +24,9 @@ import requests from oslo.config import cfg -from metadata_service.openstack.common.crypto import utils as cryptoutils -from metadata_service.openstack.common import jsonutils -from metadata_service.openstack.common import log as logging +from muranorepository.openstack.common.crypto import utils as cryptoutils +from muranorepository.openstack.common import jsonutils +from muranorepository.openstack.common import log as logging secure_message_opts = [ cfg.BoolOpt('enabled', default=True, diff --git a/metadata_service/openstack/common/rpc/serializer.py b/muranorepository/openstack/common/rpc/serializer.py similarity index 100% rename from metadata_service/openstack/common/rpc/serializer.py rename to muranorepository/openstack/common/rpc/serializer.py diff --git a/metadata_service/openstack/common/rpc/service.py b/muranorepository/openstack/common/rpc/service.py similarity index 89% rename from metadata_service/openstack/common/rpc/service.py rename to muranorepository/openstack/common/rpc/service.py index 0e01f52..1038029 100644 --- a/metadata_service/openstack/common/rpc/service.py +++ b/muranorepository/openstack/common/rpc/service.py @@ -17,11 +17,11 @@ # License for the specific language governing permissions and limitations # under the License. -from metadata_service.openstack.common.gettextutils import _ # noqa -from metadata_service.openstack.common import log as logging -from metadata_service.openstack.common import rpc -from metadata_service.openstack.common.rpc import dispatcher as rpc_dispatcher -from metadata_service.openstack.common import service +from muranorepository.openstack.common.gettextutils import _ # noqa +from muranorepository.openstack.common import log as logging +from muranorepository.openstack.common import rpc +from muranorepository.openstack.common.rpc import dispatcher as rpc_dispatcher +from muranorepository.openstack.common import service LOG = logging.getLogger(__name__) diff --git a/metadata_service/openstack/common/rpc/zmq_receiver.py b/muranorepository/openstack/common/rpc/zmq_receiver.py similarity index 86% rename from metadata_service/openstack/common/rpc/zmq_receiver.py rename to muranorepository/openstack/common/rpc/zmq_receiver.py index 4749115..abd4aa3 100644 --- a/metadata_service/openstack/common/rpc/zmq_receiver.py +++ b/muranorepository/openstack/common/rpc/zmq_receiver.py @@ -22,9 +22,9 @@ import sys from oslo.config import cfg -from metadata_service.openstack.common import log as logging -from metadata_service.openstack.common import rpc -from metadata_service.openstack.common.rpc import impl_zmq +from muranorepository.openstack.common import log as logging +from muranorepository.openstack.common import rpc +from muranorepository.openstack.common.rpc import impl_zmq CONF = cfg.CONF CONF.register_opts(rpc.rpc_opts) diff --git a/metadata_service/openstack/common/service.py b/muranorepository/openstack/common/service.py similarity index 97% rename from metadata_service/openstack/common/service.py rename to muranorepository/openstack/common/service.py index a04b6d0..8921faa 100644 --- a/metadata_service/openstack/common/service.py +++ b/muranorepository/openstack/common/service.py @@ -31,14 +31,14 @@ from eventlet import event import logging as std_logging from oslo.config import cfg -from metadata_service.openstack.common import eventlet_backdoor -from metadata_service.openstack.common.gettextutils import _ # noqa -from metadata_service.openstack.common import importutils -from metadata_service.openstack.common import log as logging -from metadata_service.openstack.common import threadgroup +from muranorepository.openstack.common import eventlet_backdoor +from muranorepository.openstack.common.gettextutils import _ # noqa +from muranorepository.openstack.common import importutils +from muranorepository.openstack.common import log as logging +from muranorepository.openstack.common import threadgroup -rpc = importutils.try_import('metadata_service.openstack.common.rpc') +rpc = importutils.try_import('muranorepository.openstack.common.rpc') CONF = cfg.CONF LOG = logging.getLogger(__name__) diff --git a/metadata_service/openstack/common/sslutils.py b/muranorepository/openstack/common/sslutils.py similarity index 97% rename from metadata_service/openstack/common/sslutils.py rename to muranorepository/openstack/common/sslutils.py index ac4d3de..296aab9 100644 --- a/metadata_service/openstack/common/sslutils.py +++ b/muranorepository/openstack/common/sslutils.py @@ -19,7 +19,7 @@ import ssl from oslo.config import cfg -from metadata_service.openstack.common.gettextutils import _ # noqa +from muranorepository.openstack.common.gettextutils import _ # noqa ssl_opts = [ diff --git a/metadata_service/openstack/common/test.py b/muranorepository/openstack/common/test.py similarity index 96% rename from metadata_service/openstack/common/test.py rename to muranorepository/openstack/common/test.py index ced6641..955f10b 100644 --- a/metadata_service/openstack/common/test.py +++ b/muranorepository/openstack/common/test.py @@ -29,7 +29,7 @@ class BaseTestCase(testtools.TestCase): super(BaseTestCase, self).setUp() self._set_timeout() self._fake_output() - self.useFixture(fixtures.FakeLogger('metadata_service.openstack.common')) + self.useFixture(fixtures.FakeLogger('muranorepository.openstack.common')) self.useFixture(fixtures.NestedTempfile()) def _set_timeout(self): diff --git a/metadata_service/openstack/common/threadgroup.py b/muranorepository/openstack/common/threadgroup.py similarity index 96% rename from metadata_service/openstack/common/threadgroup.py rename to muranorepository/openstack/common/threadgroup.py index b6225bc..3744948 100644 --- a/metadata_service/openstack/common/threadgroup.py +++ b/muranorepository/openstack/common/threadgroup.py @@ -18,8 +18,8 @@ import eventlet from eventlet import greenpool from eventlet import greenthread -from metadata_service.openstack.common import log as logging -from metadata_service.openstack.common import loopingcall +from muranorepository.openstack.common import log as logging +from muranorepository.openstack.common import loopingcall LOG = logging.getLogger(__name__) diff --git a/metadata_service/openstack/common/timeutils.py b/muranorepository/openstack/common/timeutils.py similarity index 100% rename from metadata_service/openstack/common/timeutils.py rename to muranorepository/openstack/common/timeutils.py diff --git a/metadata_service/openstack/common/uuidutils.py b/muranorepository/openstack/common/uuidutils.py similarity index 100% rename from metadata_service/openstack/common/uuidutils.py rename to muranorepository/openstack/common/uuidutils.py diff --git a/metadata_service/openstack/common/wsgi.py b/muranorepository/openstack/common/wsgi.py similarity index 96% rename from metadata_service/openstack/common/wsgi.py rename to muranorepository/openstack/common/wsgi.py index 52b8196..df4899a 100644 --- a/metadata_service/openstack/common/wsgi.py +++ b/muranorepository/openstack/common/wsgi.py @@ -24,11 +24,11 @@ import datetime from xml.dom import minidom from xml.parsers import expat -from metadata_service.openstack.common import exception -from metadata_service.openstack.common.gettextutils import _ -from metadata_service.openstack.common import jsonutils -from metadata_service.openstack.common import log as logging -from metadata_service.openstack.common import xmlutils +from muranorepository.openstack.common import exception +from muranorepository.openstack.common.gettextutils import _ +from muranorepository.openstack.common import jsonutils +from muranorepository.openstack.common import log as logging +from muranorepository.openstack.common import xmlutils LOG = logging.getLogger(__name__) diff --git a/metadata_service/openstack/common/xmlutils.py b/muranorepository/openstack/common/xmlutils.py similarity index 100% rename from metadata_service/openstack/common/xmlutils.py rename to muranorepository/openstack/common/xmlutils.py diff --git a/metadata_service/openstack/commons.py b/muranorepository/openstack/commons.py similarity index 100% rename from metadata_service/openstack/commons.py rename to muranorepository/openstack/commons.py diff --git a/metadata_service/utils/__init__.py b/muranorepository/utils/__init__.py similarity index 100% rename from metadata_service/utils/__init__.py rename to muranorepository/utils/__init__.py diff --git a/metadata_service/utils/archiver.py b/muranorepository/utils/archiver.py similarity index 98% rename from metadata_service/utils/archiver.py rename to muranorepository/utils/archiver.py index ff6ceae..76d0e8a 100644 --- a/metadata_service/utils/archiver.py +++ b/muranorepository/utils/archiver.py @@ -17,7 +17,7 @@ import tempfile import shutil import logging as log from oslo.config import cfg -from metadata_service.consts import DATA_TYPES +from muranorepository.consts import DATA_TYPES OUTPUT_CONF = cfg.CONF.output CONF = cfg.CONF diff --git a/metadata_service/utils/parser.py b/muranorepository/utils/parser.py similarity index 95% rename from metadata_service/utils/parser.py rename to muranorepository/utils/parser.py index 9d8f9c9..c9ea2a9 100644 --- a/metadata_service/utils/parser.py +++ b/muranorepository/utils/parser.py @@ -16,8 +16,8 @@ import os import yaml from oslo.config import cfg import logging as log -from metadata_service.manifest import Manifest -from metadata_service.consts import DATA_TYPES, MANIFEST +from muranorepository.utils.manifest import Manifest +from muranorepository.consts import DATA_TYPES, MANIFEST CONF = cfg.CONF @@ -45,7 +45,7 @@ class ManifestParser(object): exc)) continue - #check for existence files specified in manifests + #check files specified in manifests for existence for key, value in service_manifest_data.iteritems(): valid_file_info = True if key in DATA_TYPES: diff --git a/requirements.txt b/requirements.txt index 66776be..6b1f5c6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,11 @@ -flask -flask-restfull -eventlet +d2to1>=0.2.10,<0.3 +pbr>=0.5.21,<1.0 +eventlet>=0.13.0 +Flask>=0.10,<1.0 +oslo.config>=1.2.0 +PyYAML + +#openstack-common requires +iso8601>=0.1.4 +kombu>=2.4.8 +Babel>=1.3 \ No newline at end of file diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..c3ecfbe --- /dev/null +++ b/setup.cfg @@ -0,0 +1,63 @@ +# Copyright (c) 2013 Mirantis, Inc. +# +# 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. + +[metadata] +name = muranorepository +version = 0.1 +summary = Murano Metadata Repository +description-file = README.rst +license = Apache Software License +classifiers = + Programming Language :: Python + Programming Language :: Python :: 2 + Programming Language :: Python :: 2.7 + Environment :: OpenStack + Intended Audience :: Information Technology + Intended Audience :: System Administrators + License :: OSI Approved :: Apache Software License + Operating System :: POSIX :: Linux +author = Mirantis, Inc. +author-email = openstack-dev@lists.openstack.org +home-page = https://launchpad.net/murano + +[global] +setup-hooks = pbr.hooks.setup_hook + +[files] +packages = + muranorepository + + +[entry_points] +console_scripts = + murano-repository-api = muranorepository.cmd.run:main + +[build_sphinx] +all_files = 1 +build-dir = doc/build +source-dir = doc/source + +[egg_info] +tag_build = +tag_date = 0 +tag_svn_revision = 0 + +[compile_catalog] +directory = murano-repository/locale +domain = murano-repository + +[extract_messages] +keywords = _ gettext ngettext l_ lazy_gettext +mapping_file = babel.cfg +output_file = murano-repository/locale/muranorepository.pot diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..55f2cea --- /dev/null +++ b/setup.py @@ -0,0 +1,25 @@ +#!/usr/bin/python +# +# Copyright (c) 2013 Mirantis, Inc. +# +# 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 setuptools + +setuptools.setup( + setup_requires=[ + 'd2to1>=0.2.10,<0.3', + 'pbr>=0.5,<0.6' + ], + d2to1=True, +) diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 0000000..67d9663 --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,17 @@ +# Fix versions for pep8/pyflakes/flake8/hacking +pep8==1.4.5 +pyflakes>=0.7.2,<0.7.4 +flake8==2.0 +hacking>=0.5.6,<0.8 + +coverage>=3.6 +docutils==0.9.1 +fixtures>=0.3.14 +mock>=1.0 +nose +openstack.nose_plugin>=0.7 +oslo.sphinx +pylint==0.25.2 +sphinx>=1.1.2 +sphinxcontrib-httpdomain +unittest2 diff --git a/tools/config/generate_sample.sh b/tools/config/generate_sample.sh new file mode 100755 index 0000000..4c6d101 --- /dev/null +++ b/tools/config/generate_sample.sh @@ -0,0 +1,69 @@ +#!/usr/bin/env bash + +print_hint() { + echo "Try \`${0##*/} --help' for more information." >&2 +} + +PARSED_OPTIONS=$(getopt -n "${0##*/}" -o hb:p:o: \ + --long help,base-dir:,package-name:,output-dir: -- "$@") + +if [ $? != 0 ] ; then print_hint ; exit 1 ; fi + +eval set -- "$PARSED_OPTIONS" + +while true; do + case "$1" in + -h|--help) + echo "${0##*/} [options]" + echo "" + echo "options:" + echo "-h, --help show brief help" + echo "-b, --base-dir=DIR Project base directory (required)" + echo "-p, --package-name=NAME Project package name" + echo "-o, --output-dir=DIR File output directory" + exit 0 + ;; + -b|--base-dir) + shift + BASEDIR=`echo $1 | sed -e 's/\/*$//g'` + shift + ;; + -p|--package-name) + shift + PACKAGENAME=`echo $1` + shift + ;; + -o|--output-dir) + shift + OUTPUTDIR=`echo $1 | sed -e 's/\/*$//g'` + shift + ;; + --) + break + ;; + esac +done + +if [ -z $BASEDIR ] || ! [ -d $BASEDIR ] +then + echo "${0##*/}: missing project base directory" >&2 ; print_hint ; exit 1 +fi + +PACKAGENAME=${PACKAGENAME:-${BASEDIR##*/}} + +OUTPUTDIR=${OUTPUTDIR:-$BASEDIR/etc} +if ! [ -d $OUTPUTDIR ] +then + echo "${0##*/}: cannot access \`$OUTPUTDIR': No such file or directory" >&2 + exit 1 +fi + +BASEDIRESC=`echo $BASEDIR | sed -e 's/\//\\\\\//g'` +FILES=$(find $BASEDIR/$PACKAGENAME -type f -name "*.py" ! -path "*/tests/*" \ + -exec grep -l "Opt(" {} + | sed -e "s/^$BASEDIRESC\///g" | sort -u) + +export EVENTLET_NO_GREENDNS=yes + +MODULEPATH=murano-repository.openstack.common.config.generator +OUTPUTFILE=$OUTPUTDIR/$PACKAGENAME.conf.sample +python -m $MODULEPATH $FILES > $OUTPUTFILE diff --git a/tools/install_venv.py b/tools/install_venv.py new file mode 100644 index 0000000..0011a8b --- /dev/null +++ b/tools/install_venv.py @@ -0,0 +1,77 @@ +# vim: tabstop=4 shiftwidth=4 softtabstop=4 + +# Copyright 2010 United States Government as represented by the +# Administrator of the National Aeronautics and Space Administration. +# All Rights Reserved. +# +# Copyright 2010 OpenStack Foundation +# Copyright 2013 IBM Corp. +# Copyright (c) 2013 Hewlett-Packard Development Company, L.P. +# +# 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 os +import sys + +import install_venv_common as install_venv # flake8: noqa + + +def print_help(project, venv, root): + help = """ + %(project)s development environment setup is complete. + + %(project)s development uses virtualenv to track and manage Python + dependencies while in development and testing. + + To activate the %(project)s virtualenv for the extent of your current + shell session you can run: + + $ source %(venv)s/bin/activate + + Or, if you prefer, you can run commands in the virtualenv on a case by + case basis by running: + + $ %(root)s/tools/with_venv.sh + """ + print help % dict(project=project, venv=venv, root=root) + + +def main(argv): + root = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) + + if os.environ.get('tools_path'): + root = os.environ['tools_path'] + venv = os.path.join(root, '.venv') + if os.environ.get('venv'): + venv = os.environ['venv'] + + pip_requires = os.path.join(root, 'requirements.txt') + test_requires = os.path.join(root, 'test-requirements.txt') + py_version = "python%s.%s" % (sys.version_info[0], sys.version_info[1]) + setup_cfg = ConfigParser.ConfigParser() + setup_cfg.read('setup.cfg') + project = setup_cfg.get('metadata', 'name') + + install = install_venv.InstallVenv( + root, venv, pip_requires, test_requires, py_version, project) + options = install.parse_args(argv) + install.check_python_version() + install.check_dependencies() + install.create_virtualenv(no_site_packages=options.no_site_packages) + install.install_dependencies() + install.post_process() + print_help(project, venv, root) + +if __name__ == '__main__': + main(sys.argv) diff --git a/tools/install_venv_common.py b/tools/install_venv_common.py new file mode 100644 index 0000000..f428c1e --- /dev/null +++ b/tools/install_venv_common.py @@ -0,0 +1,212 @@ +# vim: tabstop=4 shiftwidth=4 softtabstop=4 + +# Copyright 2013 OpenStack Foundation +# Copyright 2013 IBM Corp. +# +# 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. + +"""Provides methods needed by installation script for OpenStack development +virtual environments. + +Since this script is used to bootstrap a virtualenv from the system's Python +environment, it should be kept strictly compatible with Python 2.6. + +Synced in from openstack-common +""" + +from __future__ import print_function + +import optparse +import os +import subprocess +import sys + + +class InstallVenv(object): + + def __init__(self, root, venv, requirements, + test_requirements, py_version, + project): + self.root = root + self.venv = venv + self.requirements = requirements + self.test_requirements = test_requirements + self.py_version = py_version + self.project = project + + def die(self, message, *args): + print(message % args, file=sys.stderr) + sys.exit(1) + + def check_python_version(self): + if sys.version_info < (2, 6): + self.die("Need Python Version >= 2.6") + + def run_command_with_code(self, cmd, redirect_output=True, + check_exit_code=True): + """Runs a command in an out-of-process shell. + + Returns the output of that command. Working directory is self.root. + """ + if redirect_output: + stdout = subprocess.PIPE + else: + stdout = None + + proc = subprocess.Popen(cmd, cwd=self.root, stdout=stdout) + output = proc.communicate()[0] + if check_exit_code and proc.returncode != 0: + self.die('Command "%s" failed.\n%s', ' '.join(cmd), output) + return (output, proc.returncode) + + def run_command(self, cmd, redirect_output=True, check_exit_code=True): + return self.run_command_with_code(cmd, redirect_output, + check_exit_code)[0] + + def get_distro(self): + if (os.path.exists('/etc/fedora-release') or + os.path.exists('/etc/redhat-release')): + return Fedora( + self.root, self.venv, self.requirements, + self.test_requirements, self.py_version, self.project) + else: + return Distro( + self.root, self.venv, self.requirements, + self.test_requirements, self.py_version, self.project) + + def check_dependencies(self): + self.get_distro().install_virtualenv() + + def create_virtualenv(self, no_site_packages=True): + """Creates the virtual environment and installs PIP. + + Creates the virtual environment and installs PIP only into the + virtual environment. + """ + if not os.path.isdir(self.venv): + print('Creating venv...', end=' ') + if no_site_packages: + self.run_command(['virtualenv', '-q', '--no-site-packages', + self.venv]) + else: + self.run_command(['virtualenv', '-q', self.venv]) + print('done.') + else: + print("venv already exists...") + pass + + def pip_install(self, *args): + self.run_command(['tools/with_venv.sh', + 'pip', 'install', '--upgrade'] + list(args), + redirect_output=False) + + def install_dependencies(self): + print('Installing dependencies with pip (this can take a while)...') + + # First things first, make sure our venv has the latest pip and + # setuptools. + self.pip_install('pip>=1.3') + self.pip_install('setuptools') + + self.pip_install('-r', self.requirements) + self.pip_install('-r', self.test_requirements) + + def post_process(self): + self.get_distro().post_process() + + def parse_args(self, argv): + """Parses command-line arguments.""" + parser = optparse.OptionParser() + parser.add_option('-n', '--no-site-packages', + action='store_true', + help="Do not inherit packages from global Python " + "install") + return parser.parse_args(argv[1:])[0] + + +class Distro(InstallVenv): + + def check_cmd(self, cmd): + return bool(self.run_command(['which', cmd], + check_exit_code=False).strip()) + + def install_virtualenv(self): + if self.check_cmd('virtualenv'): + return + + if self.check_cmd('easy_install'): + print('Installing virtualenv via easy_install...', end=' ') + if self.run_command(['easy_install', 'virtualenv']): + print('Succeeded') + return + else: + print('Failed') + + self.die('ERROR: virtualenv not found.\n\n%s development' + ' requires virtualenv, please install it using your' + ' favorite package management tool' % self.project) + + def post_process(self): + """Any distribution-specific post-processing gets done here. + + In particular, this is useful for applying patches to code inside + the venv. + """ + pass + + +class Fedora(Distro): + """This covers all Fedora-based distributions. + + Includes: Fedora, RHEL, CentOS, Scientific Linux + """ + + def check_pkg(self, pkg): + return self.run_command_with_code(['rpm', '-q', pkg], + check_exit_code=False)[1] == 0 + + def apply_patch(self, originalfile, patchfile): + self.run_command(['patch', '-N', originalfile, patchfile], + check_exit_code=False) + + def install_virtualenv(self): + if self.check_cmd('virtualenv'): + return + + if not self.check_pkg('python-virtualenv'): + self.die("Please install 'python-virtualenv'.") + + super(Fedora, self).install_virtualenv() + + def post_process(self): + """Workaround for a bug in eventlet. + + This currently affects RHEL6.1, but the fix can safely be + applied to all RHEL and Fedora distributions. + + This can be removed when the fix is applied upstream. + + Nova: https://bugs.launchpad.net/nova/+bug/884915 + Upstream: https://bitbucket.org/eventlet/eventlet/issue/89 + RHEL: https://bugzilla.redhat.com/958868 + """ + + # Install "patch" program if it's not there + if not self.check_pkg('patch'): + self.die("Please install 'patch'.") + + # Apply the eventlet patch + self.apply_patch(os.path.join(self.venv, 'lib', self.py_version, + 'site-packages', + 'eventlet/green/subprocess.py'), + 'contrib/redhat-eventlet.patch') diff --git a/tools/with_venv.sh b/tools/with_venv.sh new file mode 100755 index 0000000..c8d2940 --- /dev/null +++ b/tools/with_venv.sh @@ -0,0 +1,4 @@ +#!/bin/bash +TOOLS=`dirname $0` +VENV=$TOOLS/../.venv +source $VENV/bin/activate && $@ diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..b6c0ff6 --- /dev/null +++ b/tox.ini @@ -0,0 +1,58 @@ +[tox] +envlist = py26,py27,pep8,pyflakes + +[testenv] +setenv = VIRTUAL_ENV={envdir} + NOSE_WITH_OPENSTACK=1 + NOSE_OPENSTACK_COLOR=1 + NOSE_OPENSTACK_RED=0.05 + NOSE_OPENSTACK_YELLOW=0.025 + NOSE_OPENSTACK_SHOW_ELAPSED=1 +deps = -r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt +commands = nosetests + +[testenv:pep8] +deps = pep8==1.3.3 +commands = pep8 --repeat --show-source murano-repository setup.py + +[testenv:venv] +commands = {posargs} + +[testenv:cover] +commands = nosetests --cover-erase --cover-package=murano-repository --with-xcoverage + +[tox:jenkins] +downloadcache = ~/cache/pip + +[testenv:jenkins26] +basepython = python2.6 +setenv = NOSE_WITH_XUNIT=1 +deps = file://{toxinidir}/.cache.bundle + +[testenv:jenkins27] +basepython = python2.7 +setenv = NOSE_WITH_XUNIT=1 +deps = file://{toxinidir}/.cache.bundle + +[testenv:jenkinscover] +deps = file://{toxinidir}/.cache.bundle +setenv = NOSE_WITH_XUNIT=1 +commands = nosetests --cover-erase --cover-package=muranoapi --with-xcoverage + +[testenv:jenkinsvenv] +deps = file://{toxinidir}/.cache.bundle +setenv = NOSE_WITH_XUNIT=1 +commands = {posargs} + +[testenv:pyflakes] +deps = flake8 +commands = flake8 + +[flake8] +# H301 one import per line +# H302 import only modules +ignore = H301,H302 +show-source = true +builtins = _ +exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,tools \ No newline at end of file