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

View File

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