From 84d0d235156c31421a75271d59749b7a9347953f Mon Sep 17 00:00:00 2001 From: Stan Lagun Date: Thu, 25 Apr 2013 09:37:25 +0400 Subject: [PATCH] KEERO-314 - Fix all occurrences of old names (keero, glazier) in conductor + CRLF->LF --- README.rst | 8 +- data/init.ps1 | 10 +- data/templates/cf/Windows.template | 2 +- data/workflows/AD.xml | 434 +++++++++++++------------- data/workflows/Common.xml | 36 +-- data/workflows/IIS.xml | 128 ++++---- doc/source/conf.py | 2 +- doc/source/index.rst | 22 +- etc/conductor.conf | 6 +- tests/conductor/test_heat_commands.py | 342 ++++++++++---------- tests/conductor/test_workflow.py | 198 ++++++------ 11 files changed, 594 insertions(+), 594 deletions(-) diff --git a/README.rst b/README.rst index 38cfa96..3bd1a3b 100644 --- a/README.rst +++ b/README.rst @@ -1,8 +1,8 @@ -Glazier Conductor README +Murano Conductor README ======================== -Conductor is an Glazier orchestration engine that transforms object model sent by -REST API service into a series of Heat and Glazier-Agent commands +Conductor is an Murano orchestration engine that transforms object model sent by +REST API service into a series of Heat and Murano-Agent commands SEE ALSO -------- -* `Keero `__ +* `Murano `__ diff --git a/data/init.ps1 b/data/init.ps1 index 0e6cb21..321a7c2 100644 --- a/data/init.ps1 +++ b/data/init.ps1 @@ -1,7 +1,7 @@ #ps1 $WindowsAgentConfigBase64 = '%WINDOWS_AGENT_CONFIG_BASE64%' -$WindowsAgentConfigFile = "C:\Keero\Agent\WindowsAgent.exe.config" +$WindowsAgentConfigFile = "C:\Murano\Agent\WindowsAgent.exe.config" $NewComputerName = '%INTERNAL_HOSTNAME%' @@ -9,12 +9,12 @@ $RestartRequired = $false Import-Module CoreFunctions -Write-Log "Updating Keero Windows Agent." -Stop-Service "Keero Agent" +Write-Log "Updating Murano Windows Agent." +Stop-Service "Murano Agent" Backup-File $WindowsAgentConfigFile Remove-Item $WindowsAgentConfigFile -Force ConvertFrom-Base64String -Base64String $WindowsAgentConfigBase64 -Path $WindowsAgentConfigFile -Exec sc.exe 'config','"Keero Agent"','start=','delayed-auto' +Exec sc.exe 'config','"Murano Agent"','start=','delayed-auto' Write-Log "Service has been updated." Write-Log "Renaming computer ..." @@ -29,5 +29,5 @@ if ( $RestartRequired ) { Restart-Computer -Force } else { - Start-Service 'Keero Agent' + Start-Service 'Murano Agent' } diff --git a/data/templates/cf/Windows.template b/data/templates/cf/Windows.template index e14069f..7fa8850 100644 --- a/data/templates/cf/Windows.template +++ b/data/templates/cf/Windows.template @@ -7,7 +7,7 @@ "KeyName" : { "Description" : "Name of an existing Amazon EC2 key pair for RDP access", "Type" : "String", - "Default" : "keero_key" + "Default" : "murano-keys" }, "InstanceType" : { "Description" : "Amazon EC2 instance type", diff --git a/data/workflows/AD.xml b/data/workflows/AD.xml index 0433e4d..7932a8f 100644 --- a/data/workflows/AD.xml +++ b/data/workflows/AD.xml @@ -1,218 +1,218 @@ - - - - - Creating instance - - - - - - - - - keero-keys - m1.medium - ws-2012-full - - - - - - Instance - - - - - - - - - - - - - - - - - - - Creating Primary Domain Controller on unit - - - - - - - - - - - - - - - - - - - - - - /$.services.activeDirectories[?(@.domain == ' - - - - - - - - - - - - - - Unit - - - - - - - - - - - - - - - - - - - - - - - - - - - Domain + + + + + + + + + + + + + + + + + created + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Primary Domain Controller created + + + + + + + + + + + + + + + + ' and @.state.primaryDcIp)] + + + + + + + + + + + + + + + has joined domain + Creating Secondary Domain Controller on unit + + + + + + + Secondary Domain Controller created + + + created + + + + \ No newline at end of file diff --git a/data/workflows/Common.xml b/data/workflows/Common.xml index 01d1325..5d57517 100644 --- a/data/workflows/Common.xml +++ b/data/workflows/Common.xml @@ -1,19 +1,19 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data/workflows/IIS.xml b/data/workflows/IIS.xml index 136358b..493b8ae 100644 --- a/data/workflows/IIS.xml +++ b/data/workflows/IIS.xml @@ -1,65 +1,65 @@ - - - - - Creating instance - - - - - - - - - keero-keys - m1.medium - ws-2012-full - - - - - - Instance - Creating IIS Web Server on unit - - - - IIS + + + + + + + + + + + + + + + + + created + + + + + + + + + + + + + + + + + has started + + + + \ No newline at end of file diff --git a/doc/source/conf.py b/doc/source/conf.py index e9b38f9..ade30ff 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -218,7 +218,7 @@ htmlhelp_basename = 'conductordoc' # documentclass [howto/manual]). latex_documents = [ ('index', 'Conductor.tex', u'Conductor Documentation', - u'Keero Team', 'manual'), + u'Murano Team', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of diff --git a/doc/source/index.rst b/doc/source/index.rst index ea1b15b..e03a24c 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -15,11 +15,11 @@ under the License. ======================================================= -Welcome to Conductor, the Glazier orchestration engine! +Welcome to Conductor, the Murano orchestration engine! ======================================================= -Conductor is an Glazier orchestration engine that transforms object model sent by -REST API service into a series of Heat and Glazier-Agent commands +Conductor is an Murano orchestration engine that transforms object model sent by +REST API service into a series of Heat and Murano-Agent commands This document describes Conductor for contributors of the project. @@ -31,20 +31,20 @@ Installation Guide Install ------- - Check out sources to some directory (/glazier): + Check out sources to some directory (/murano): - smelikyan@work:~/git clone ssh://@gerrit.mirantis.com:29418/keero/keero.git + smelikyan@work:~/git clone https://github.com/Mirantis/murano-conductor.git Install Conductor: - smelikyan@work:~/cd glazier/conductor && sudo python setup.py install + smelikyan@work:~/cd murano/conductor && sudo python setup.py install Configure --------- Open configuration file for editing: - smelikyan@work:~/cd glazier/conductor/etc && nano conductor.conf + smelikyan@work:~/cd murano/conductor/etc && nano conductor.conf Configure according to you environment: [DEFAULT] @@ -59,14 +59,14 @@ Configure # this must be IP or hostname accessible from instances (VMs) host = YOUR.REAL.IP.HERE port = 5672 - virtual_host = glazier - login = glazier - password = glazier + virtual_host = murano + login = murano + password = murano Run ---- Run Conductor and supply valid configuration file: -smelikyan@work:~/cd glazier/conductor && conductor --config-file=./glazier/conductor/etc/conductor.conf +smelikyan@work:~/cd murano/conductor && conductor --config-file=./murano/conductor/etc/conductor.conf diff --git a/etc/conductor.conf b/etc/conductor.conf index 60f3202..6ae6d3b 100644 --- a/etc/conductor.conf +++ b/etc/conductor.conf @@ -9,6 +9,6 @@ auth_url = http://172.18.124.101:5000/v2.0 [rabbitmq] host = 172.18.124.101 port = 5672 -virtual_host = keero -login = keero -password = keero \ No newline at end of file +virtual_host = murano +login = murano +password = murano \ No newline at end of file diff --git a/tests/conductor/test_heat_commands.py b/tests/conductor/test_heat_commands.py index 7a59898..9e4777f 100644 --- a/tests/conductor/test_heat_commands.py +++ b/tests/conductor/test_heat_commands.py @@ -1,171 +1,171 @@ -# 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 json -import unittest - -import mock -import mockfs -import heatclient.exc - -from conductor.commands.cloud_formation import HeatExecutor - - -class TestHeatExecutor(unittest.TestCase): - - def setUp(self): - self.mfs = mockfs.replace_builtins() - template = { - "$name": { - "$key": "$value" - } - } - self.mfs.add_entries({ - './data/templates/cf/test.template': json.dumps(template)}) - - def tearDown(self): - mockfs.restore_builtins() - - def _init(self, config_mock, ksclient_mock): - config_mock.heat.auth_url = 'http://invalid.url' - - auth_data = ksclient_mock().tokens.authenticate() - auth_data.id = '123456' - auth_data.serviceCatalog = [{ - 'name': 'heat', - 'endpoints': [{'publicURL': 'http://invalid.heat.url'}] - }] - - - - @mock.patch('heatclient.v1.client.Client') - @mock.patch('keystoneclient.v2_0.client.Client') - @mock.patch('conductor.config.CONF') - def test_create_stack(self, config_mock, ksclient_mock, heat_mock): - self._init(config_mock, ksclient_mock) - executor = HeatExecutor('stack', 'token', 'tenant_id') - callback = mock.MagicMock() - - executor.execute( - template='test', - command='CreateOrUpdate', - mappings={ - 'name': 'testName', - 'key': 'testKey', - 'value': 'testValue'}, - arguments={ - 'arg1': 'arg1Value', - 'arg2': 'arg2Value'}, - callback=callback) - - - heat_mock().stacks.get().stack_status = 'CREATE_COMPLETE' - heat_mock().stacks.template = mock.MagicMock( - side_effect=heatclient.exc.HTTPNotFound) - - self.assertTrue(executor.has_pending_commands()) - result = executor.execute_pending() - self.assertTrue(result) - heat_mock().stacks.create.assert_called_with( - stack_name='stack', - parameters={ - 'arg1': 'arg1Value', - 'arg2': 'arg2Value'}, - template={ - "testName": { - "testKey": "testValue" - } - }) - callback.assert_called_with(True) - - @mock.patch('heatclient.v1.client.Client') - @mock.patch('keystoneclient.v2_0.client.Client') - @mock.patch('conductor.config.CONF') - def test_update_stack(self, config_mock, ksclient_mock, heat_mock): - self._init(config_mock, ksclient_mock) - executor = HeatExecutor('stack', 'token', 'tenant_id') - callback = mock.MagicMock() - - executor.execute( - template='test', - command='CreateOrUpdate', - mappings={ - 'name': 'testName', - 'key': 'testKey', - 'value': 'testValue'}, - arguments={ - 'arg1': 'arg1Value', - 'arg2': 'arg2Value'}, - callback=callback) - - get_mock = heat_mock().stacks.get() - get_mock.stack_name = 'stack' - get_mock.id = 'stack' - get_mock.parameters = {} - get_mock.stack_status = '' - get_mock._status_index = 0 - - def side_effect(*args, **kwargs): - if get_mock._status_index < 2: - get_mock.stack_status = 'IN_PROGRESS' - else: - get_mock.stack_status = 'UPDATE_COMPLETE' - get_mock._status_index += 1 - return get_mock - - - heat_mock().stacks.get = mock.MagicMock(side_effect=side_effect) - - heat_mock().stacks.template = mock.MagicMock( - return_value={'instance': {}}) - - self.assertTrue(executor.has_pending_commands()) - result = executor.execute_pending() - self.assertTrue(result) - heat_mock().stacks.update.assert_called_with( - stack_id='stack', - parameters={ - 'arg1': 'arg1Value', - 'arg2': 'arg2Value'}, - template={ - 'instance': {}, - "testName": { - "testKey": "testValue" - } - }) - callback.assert_called_with(True) - - @mock.patch('heatclient.v1.client.Client') - @mock.patch('keystoneclient.v2_0.client.Client') - @mock.patch('conductor.config.CONF') - def test_delete_stack(self, config_mock, ksclient_mock, heat_mock): - self._init(config_mock, ksclient_mock) - executor = HeatExecutor('stack', 'token', 'tenant_id') - callback = mock.MagicMock() - - executor.execute( - template='test', - command='Delete', - callback=callback) - - - heat_mock().stacks.get = mock.MagicMock( - side_effect=heatclient.exc.HTTPNotFound) - - self.assertTrue(executor.has_pending_commands()) - result = executor.execute_pending() - self.assertTrue(result) - heat_mock().stacks.delete.assert_called_with(stack_id='stack') - callback.assert_called_with(True) +# 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 json +import unittest + +import mock +import mockfs +import heatclient.exc + +from conductor.commands.cloud_formation import HeatExecutor + + +class TestHeatExecutor(unittest.TestCase): + + def setUp(self): + self.mfs = mockfs.replace_builtins() + template = { + "$name": { + "$key": "$value" + } + } + self.mfs.add_entries({ + './data/templates/cf/test.template': json.dumps(template)}) + + def tearDown(self): + mockfs.restore_builtins() + + def _init(self, config_mock, ksclient_mock): + config_mock.heat.auth_url = 'http://invalid.url' + + auth_data = ksclient_mock().tokens.authenticate() + auth_data.id = '123456' + auth_data.serviceCatalog = [{ + 'name': 'heat', + 'endpoints': [{'publicURL': 'http://invalid.heat.url'}] + }] + + + + @mock.patch('heatclient.v1.client.Client') + @mock.patch('keystoneclient.v2_0.client.Client') + @mock.patch('conductor.config.CONF') + def test_create_stack(self, config_mock, ksclient_mock, heat_mock): + self._init(config_mock, ksclient_mock) + executor = HeatExecutor('stack', 'token', 'tenant_id') + callback = mock.MagicMock() + + executor.execute( + template='test', + command='CreateOrUpdate', + mappings={ + 'name': 'testName', + 'key': 'testKey', + 'value': 'testValue'}, + arguments={ + 'arg1': 'arg1Value', + 'arg2': 'arg2Value'}, + callback=callback) + + + heat_mock().stacks.get().stack_status = 'CREATE_COMPLETE' + heat_mock().stacks.template = mock.MagicMock( + side_effect=heatclient.exc.HTTPNotFound) + + self.assertTrue(executor.has_pending_commands()) + result = executor.execute_pending() + self.assertTrue(result) + heat_mock().stacks.create.assert_called_with( + stack_name='stack', + parameters={ + 'arg1': 'arg1Value', + 'arg2': 'arg2Value'}, + template={ + "testName": { + "testKey": "testValue" + } + }) + callback.assert_called_with(True) + + @mock.patch('heatclient.v1.client.Client') + @mock.patch('keystoneclient.v2_0.client.Client') + @mock.patch('conductor.config.CONF') + def test_update_stack(self, config_mock, ksclient_mock, heat_mock): + self._init(config_mock, ksclient_mock) + executor = HeatExecutor('stack', 'token', 'tenant_id') + callback = mock.MagicMock() + + executor.execute( + template='test', + command='CreateOrUpdate', + mappings={ + 'name': 'testName', + 'key': 'testKey', + 'value': 'testValue'}, + arguments={ + 'arg1': 'arg1Value', + 'arg2': 'arg2Value'}, + callback=callback) + + get_mock = heat_mock().stacks.get() + get_mock.stack_name = 'stack' + get_mock.id = 'stack' + get_mock.parameters = {} + get_mock.stack_status = '' + get_mock._status_index = 0 + + def side_effect(*args, **kwargs): + if get_mock._status_index < 2: + get_mock.stack_status = 'IN_PROGRESS' + else: + get_mock.stack_status = 'UPDATE_COMPLETE' + get_mock._status_index += 1 + return get_mock + + + heat_mock().stacks.get = mock.MagicMock(side_effect=side_effect) + + heat_mock().stacks.template = mock.MagicMock( + return_value={'instance': {}}) + + self.assertTrue(executor.has_pending_commands()) + result = executor.execute_pending() + self.assertTrue(result) + heat_mock().stacks.update.assert_called_with( + stack_id='stack', + parameters={ + 'arg1': 'arg1Value', + 'arg2': 'arg2Value'}, + template={ + 'instance': {}, + "testName": { + "testKey": "testValue" + } + }) + callback.assert_called_with(True) + + @mock.patch('heatclient.v1.client.Client') + @mock.patch('keystoneclient.v2_0.client.Client') + @mock.patch('conductor.config.CONF') + def test_delete_stack(self, config_mock, ksclient_mock, heat_mock): + self._init(config_mock, ksclient_mock) + executor = HeatExecutor('stack', 'token', 'tenant_id') + callback = mock.MagicMock() + + executor.execute( + template='test', + command='Delete', + callback=callback) + + + heat_mock().stacks.get = mock.MagicMock( + side_effect=heatclient.exc.HTTPNotFound) + + self.assertTrue(executor.has_pending_commands()) + result = executor.execute_pending() + self.assertTrue(result) + heat_mock().stacks.delete.assert_called_with(stack_id='stack') + callback.assert_called_with(True) diff --git a/tests/conductor/test_workflow.py b/tests/conductor/test_workflow.py index bab4753..fec8557 100644 --- a/tests/conductor/test_workflow.py +++ b/tests/conductor/test_workflow.py @@ -1,99 +1,99 @@ -# 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 json -import os -import unittest - -import deep -import mock -import mockfs - -from conductor.workflow import Workflow - - -def load_sample(name): - with mockfs.storage.original_open(os.path.join( - os.path.dirname(__file__), - 'sample_data', - name)) as sample_file: - return sample_file.read() - - -class TestWorkflow(unittest.TestCase): - def setUp(self): - self.mfs = mockfs.replace_builtins() - self.model = json.loads(load_sample('objectModel1.json')) - self.original_model = json.loads(load_sample('objectModel1.json')) - - def tearDown(self): - mockfs.restore_builtins() - - def _execute_workflow(self, xml): - self.mfs.add_entries({'test': xml}) - stub = mock.MagicMock() - stub.side_effect = RuntimeError - workflow = Workflow('test', self.model, stub, stub, stub) - workflow.execute() - - def test_empty_workflow_leaves_object_model_unchanged(self): - xml = '' - self._execute_workflow(xml) - self.assertIsNone(deep.diff(self.original_model, self.model)) - - def test_modifying_object_model_from_workflow(self): - xml = ''' - - - value - - - ''' - self.assertNotIn( - 'state', - self.model['services']['activeDirectories'][0]) - - self._execute_workflow(xml) - - self.assertEqual( - self.model['services']['activeDirectories'][0]['state']['invalid'], - 'value') - - self.assertIsNotNone(deep.diff(self.original_model, self.model)) - del self.model['services']['activeDirectories'][0]['state'] - self.assertIsNone(deep.diff(self.original_model, self.model)) - - def test_selecting_properties_from_object_model_within_workflow(self): - xml = ''' - - - - Domain - - - - ''' - - self._execute_workflow(xml) - self.assertEqual( - self.model['services']['activeDirectories'][0]['test'], - 'Domain acme.loc with primary DC dc01') - +# 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 json +import os +import unittest + +import deep +import mock +import mockfs + +from conductor.workflow import Workflow + + +def load_sample(name): + with mockfs.storage.original_open(os.path.join( + os.path.dirname(__file__), + 'sample_data', + name)) as sample_file: + return sample_file.read() + + +class TestWorkflow(unittest.TestCase): + def setUp(self): + self.mfs = mockfs.replace_builtins() + self.model = json.loads(load_sample('objectModel1.json')) + self.original_model = json.loads(load_sample('objectModel1.json')) + + def tearDown(self): + mockfs.restore_builtins() + + def _execute_workflow(self, xml): + self.mfs.add_entries({'test': xml}) + stub = mock.MagicMock() + stub.side_effect = RuntimeError + workflow = Workflow('test', self.model, stub, stub, stub) + workflow.execute() + + def test_empty_workflow_leaves_object_model_unchanged(self): + xml = '' + self._execute_workflow(xml) + self.assertIsNone(deep.diff(self.original_model, self.model)) + + def test_modifying_object_model_from_workflow(self): + xml = ''' + + + value + + + ''' + self.assertNotIn( + 'state', + self.model['services']['activeDirectories'][0]) + + self._execute_workflow(xml) + + self.assertEqual( + self.model['services']['activeDirectories'][0]['state']['invalid'], + 'value') + + self.assertIsNotNone(deep.diff(self.original_model, self.model)) + del self.model['services']['activeDirectories'][0]['state'] + self.assertIsNone(deep.diff(self.original_model, self.model)) + + def test_selecting_properties_from_object_model_within_workflow(self): + xml = ''' + + + + Domain + + + + ''' + + self._execute_workflow(xml) + self.assertEqual( + self.model['services']['activeDirectories'][0]['test'], + 'Domain acme.loc with primary DC dc01') +