Move the savanna subdir to sahara

Rename the subdirectory and replace all instances
of "import savanna" with "import sahara" and all
instances of "from savanna" with "from sahara".

* Replaced mock patches like mock.patch('savanna...
* Updated config generator script
* Renamed entry points in setup.cfg
* Hacking checks also fixed
* Manual renaming in alembic scripts to force work migrations
* Fix doc building
* Renamed itests directories
* Some changes in gitignore
* Removed locale dir after rebase

Co-Authored-By: Alexander Ignatov <aignatov@mirantis.com>

Change-Id: Ia77252c24046c3e7283c0a7b96d11636020b949c
Partially implements: blueprint savanna-renaming-service
This commit is contained in:
Trevor McKay 2014-03-17 14:23:00 -04:00 committed by Alexander Ignatov
parent 01be22a21e
commit dc9f70e3fd
11 changed files with 162 additions and 28 deletions

11
.gitignore vendored
View File

@ -35,15 +35,18 @@ etc/local.cfg
etc/savanna/*.conf etc/savanna/*.conf
etc/savanna/*.topology etc/savanna/*.topology
etc/savanna.conf etc/savanna.conf
etc/sahara/*.conf
etc/sahara/*.topology
etc/sahara.conf
ChangeLog ChangeLog
savanna/tests/integration/configs/itest.conf sahara/tests/integration/configs/itest.conf
cscope.out cscope.out
tools/lintstack.head.py tools/lintstack.head.py
tools/pylint_exceptions tools/pylint_exceptions
savanna/tests/cover sahara/tests/cover
savanna/tests/coverage.xml sahara/tests/coverage.xml
cover cover
htmlcov htmlcov
savanna/openstack/common/db/savanna.sqlite sahara/openstack/common/db/sahara.sqlite
.testrepository .testrepository
AUTHORS AUTHORS

0
sahara/__init__.py Normal file
View File

View File

0
sahara/tests/__init__.py Normal file
View File

View File

64
sahara/tests/unit/base.py Normal file
View File

@ -0,0 +1,64 @@
# 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 tempfile
import unittest2
from sahara import context
from sahara.db import api as db_api
from sahara import main
from sahara.openstack.common.db.sqlalchemy import session
class SaharaTestCase(unittest2.TestCase):
def setUp(self):
super(SaharaTestCase, self).setUp()
self.maxDiff = None
self.setup_context()
def setup_context(self, username="test_user", tenant_id="tenant_1",
token="test_auth_token", tenant_name='test_tenant',
**kwargs):
self.addCleanup(context.set_ctx,
context.ctx() if context.has_ctx() else None)
context.set_ctx(context.Context(
username=username, tenant_id=tenant_id,
token=token, service_catalog={},
tenant_name=tenant_name, **kwargs))
def override_config(self, name, override, group=None):
main.CONF.set_override(name, override, group)
self.addCleanup(main.CONF.clear_override, name, group)
class SaharaWithDbTestCase(SaharaTestCase):
def setUp(self):
super(SaharaWithDbTestCase, self).setUp()
self.setup_db()
def setup_db(self):
self.db_fd, self.db_path = tempfile.mkstemp()
session.set_defaults('sqlite:///' + self.db_path, self.db_path)
db_api.setup_db()
self.addCleanup(self._drop_db)
def _drop_db(self):
db_api.drop_db()
os.close(self.db_fd)
os.unlink(self.db_path)

View File

0
sahara/utils/__init__.py Normal file
View File

67
sahara/utils/patches.py Normal file
View File

@ -0,0 +1,67 @@
# 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.
def patch_minidom_writexml():
"""Patch for xml.dom.minidom toprettyxml bug with whitespaces around text
(This patch will be applied for all Python versions < 2.7.3)
Issue: http://bugs.python.org/issue4147
Patch: http://hg.python.org/cpython/rev/cb6614e3438b/
Description: http://ronrothman.com/public/leftbraned/xml-dom-minidom-\
toprettyxml-and-silly-whitespace/#best-solution
"""
import sys
if sys.version_info >= (2, 7, 3):
return
import xml.dom.minidom as md
def writexml(self, writer, indent="", addindent="", newl=""):
# indent = current indentation
# addindent = indentation to add to higher levels
# newl = newline string
writer.write(indent + "<" + self.tagName)
attrs = self._get_attributes()
a_names = attrs.keys()
a_names.sort()
for a_name in a_names:
writer.write(" %s=\"" % a_name)
md._write_data(writer, attrs[a_name].value)
writer.write("\"")
if self.childNodes:
writer.write(">")
if (len(self.childNodes) == 1
and self.childNodes[0].nodeType == md.Node.TEXT_NODE):
self.childNodes[0].writexml(writer, '', '', '')
else:
writer.write(newl)
for node in self.childNodes:
node.writexml(writer, indent + addindent, addindent, newl)
writer.write(indent)
writer.write("</%s>%s" % (self.tagName, newl))
else:
writer.write("/>%s" % (newl))
md.Element.writexml = writexml
def writexml(self, writer, indent="", addindent="", newl=""):
md._write_data(writer, "%s%s%s" % (indent, self.data, newl))
md.Text.writexml = writexml

View File

@ -1,7 +1,7 @@
[metadata] [metadata]
name = savanna name = sahara
version = 2014.1 version = 2014.1
summary = Savanna project summary = Sahara project
description-file = README.rst description-file = README.rst
license = Apache Software License license = Apache Software License
classifiers = classifiers =
@ -15,41 +15,41 @@ classifiers =
Operating System :: POSIX :: Linux Operating System :: POSIX :: Linux
author = OpenStack author = OpenStack
author-email = openstack-dev@lists.openstack.org author-email = openstack-dev@lists.openstack.org
home-page = https://savanna.readthedocs.org home-page = http://docs.openstack.org/developer/sahara/
[global] [global]
setup-hooks = pbr.hooks.setup_hook setup-hooks = pbr.hooks.setup_hook
[files] [files]
packages = packages =
savanna sahara
data_files = data_files =
share/savanna = etc/savanna/* share/savanna = etc/savanna/*
[entry_points] [entry_points]
console_scripts = console_scripts =
savanna-api = savanna.cli.savanna_api:main savanna-api = sahara.cli.savanna_api:main
savanna-db-manage = savanna.db.migration.cli:main savanna-db-manage = sahara.db.migration.cli:main
_savanna-subprocess = savanna.cli.savanna_subprocess:main _savanna-subprocess = sahara.cli.savanna_subprocess:main
# TODO(slukjanov): remove this code (temp to migrate to the new name) # TODO(slukjanov): remove this code (temp to migrate to the new name)
sahara-api = savanna.cli.savanna_api:main sahara-api = sahara.cli.savanna_api:main
sahara-db-manage = savanna.db.migration.cli:main sahara-db-manage = sahara.db.migration.cli:main
savanna.cluster.plugins = savanna.cluster.plugins =
vanilla = savanna.plugins.vanilla.plugin:VanillaProvider vanilla = sahara.plugins.vanilla.plugin:VanillaProvider
hdp = savanna.plugins.hdp.ambariplugin:AmbariPlugin hdp = sahara.plugins.hdp.ambariplugin:AmbariPlugin
idh = savanna.plugins.intel.plugin:IDHProvider idh = sahara.plugins.intel.plugin:IDHProvider
savanna.infrastructure.engine = savanna.infrastructure.engine =
savanna = savanna.service.direct_engine:DirectEngine savanna = sahara.service.direct_engine:DirectEngine
direct = savanna.service.direct_engine:DirectEngine direct = sahara.service.direct_engine:DirectEngine
heat = savanna.service.heat_engine:HeatEngine heat = sahara.service.heat_engine:HeatEngine
savanna.remote = savanna.remote =
ssh = savanna.utils.ssh_remote:SshRemoteDriver ssh = sahara.utils.ssh_remote:SshRemoteDriver
agent = savanna.utils.agent_remote:AgentRemoteDriver agent = sahara.utils.agent_remote:AgentRemoteDriver
[build_sphinx] [build_sphinx]
all_files = 1 all_files = 1
@ -59,13 +59,13 @@ source-dir = doc/source
[extract_messages] [extract_messages]
keywords = _ gettext ngettext l_ lazy_gettext keywords = _ gettext ngettext l_ lazy_gettext
mapping_file = babel.cfg mapping_file = babel.cfg
output_file = savanna/locale/sahara.pot output_file = sahara/locale/savanna.pot
[compile_catalog] [compile_catalog]
directory = savanna/locale directory = sahara/locale
domain = sahara domain = sahara
[update_catalog] [update_catalog]
domain = sahara domain = sahara
output_dir = savanna/locale output_dir = sahara/locale
input_file = savanna/locale/sahara.pot input_file = sahara/locale/sahara.pot

View File

@ -8,7 +8,7 @@ usedevelop = True
install_command = pip install -U {opts} {packages} install_command = pip install -U {opts} {packages}
setenv = setenv =
VIRTUAL_ENV={envdir} VIRTUAL_ENV={envdir}
DISCOVER_DIRECTORY=savanna/tests/unit DISCOVER_DIRECTORY=sahara/tests/unit
deps = deps =
-r{toxinidir}/requirements.txt -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt -r{toxinidir}/test-requirements.txt
@ -17,7 +17,7 @@ commands = python setup.py test --slowest --testr-args="{posargs}"
[testenv:integration] [testenv:integration]
setenv = setenv =
VIRTUAL_ENV={envdir} VIRTUAL_ENV={envdir}
DISCOVER_DIRECTORY=savanna/tests/integration DISCOVER_DIRECTORY=sahara/tests/integration
commands = python setup.py test --slowest --testr-args="{posargs}" commands = python setup.py test --slowest --testr-args="{posargs}"
[testenv:cover] [testenv:cover]
@ -50,4 +50,4 @@ builtins = _
exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,tools exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,tools
[hacking] [hacking]
local-check-factory = savanna.utils.hacking.checks.factory local-check-factory = sahara.utils.hacking.checks.factory