Licenses added

This commit is contained in:
Stan Lagun
2013-04-04 18:10:25 +04:00
parent f30a833cca
commit c8887c6b66
16 changed files with 966 additions and 790 deletions

View File

@@ -1,20 +1,17 @@
#!/usr/bin/env python # Copyright (c) 2013 Mirantis Inc.
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack LLC.
# All Rights Reserved.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may # Licensed under the Apache License, Version 2.0 (the "License");
# not use this file except in compliance with the License. You may obtain # you may not use this file except in compliance with the License.
# a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # distributed under the License is distributed on an "AS IS" BASIS,
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# License for the specific language governing permissions and limitations # implied.
# under the License. # See the License for the specific language governing permissions and
# limitations under the License.
import sys import sys

View File

@@ -1,3 +1,18 @@
# 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 datetime import datetime
import glob import glob
import sys import sys

View File

@@ -1,3 +1,18 @@
# 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 base64 import base64
import xml_code_engine import xml_code_engine
@@ -29,7 +44,8 @@ def delete_cf_stack(engine, context, body, **kwargs):
name='cf', command='Delete', callback=callback) name='cf', command='Delete', callback=callback)
def prepare_user_data(context, hostname, service, unit, template='Default', **kwargs): def prepare_user_data(context, hostname, service, unit,
template='Default', **kwargs):
settings = config.CONF.rabbitmq settings = config.CONF.rabbitmq
with open('data/init.ps1') as init_script_file: with open('data/init.ps1') as init_script_file:
@@ -59,7 +75,6 @@ def prepare_user_data(context, hostname, service, unit, template='Default', **kw
counter = 0 counter = 0
def int2base(x, base): def int2base(x, base):
digs = string.digits + string.lowercase digs = string.digits + string.lowercase
if x < 0: sign = -1 if x < 0: sign = -1

View File

@@ -1 +1,16 @@
# 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 command import command

View File

@@ -1,7 +1,23 @@
# 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 anyjson import anyjson
import eventlet import eventlet
import types
import jsonpath import jsonpath
from conductor.openstack.common import log as logging from conductor.openstack.common import log as logging
import conductor.helpers import conductor.helpers
from command import CommandBase from command import CommandBase
@@ -9,7 +25,6 @@ import conductor.config
from heatclient.client import Client from heatclient.client import Client
import heatclient.exc import heatclient.exc
from keystoneclient.v2_0 import client as ksclient from keystoneclient.v2_0 import client as ksclient
import types
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@@ -28,11 +43,15 @@ class HeatExecutor(CommandBase):
scoped_token = auth_data.id scoped_token = auth_data.id
heat_url = jsonpath.jsonpath(auth_data.serviceCatalog, heat_url = jsonpath.jsonpath(
auth_data.serviceCatalog,
"$[?(@.name == 'heat')].endpoints[0].publicURL")[0] "$[?(@.name == 'heat')].endpoints[0].publicURL")[0]
self._heat_client = Client('1', heat_url, self._heat_client = Client(
token_only=True, token=scoped_token) '1',
heat_url,
token_only=True,
token=scoped_token)
def execute(self, command, callback, **kwargs): def execute(self, command, callback, **kwargs):
log.debug('Got command {0} on stack {1}'.format(command, self._stack)) log.debug('Got command {0} on stack {1}'.format(command, self._stack))

View File

@@ -1,3 +1,19 @@
# 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.
class CommandBase(object): class CommandBase(object):
def execute(self, **kwargs): def execute(self, **kwargs):
pass pass

View File

@@ -1,14 +1,29 @@
# 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 command import command
import cloud_formation import cloud_formation
import windows_agent import windows_agent
class CommandDispatcher(command.CommandBase): class CommandDispatcher(command.CommandBase):
def __init__(self, environment_id, rmqclient, token, tenant_id): def __init__(self, environment, rmqclient, token, tenant_id):
self._command_map = { self._command_map = {
'cf': cloud_formation.HeatExecutor(environment_id, token, tenant_id), 'cf': cloud_formation.HeatExecutor(environment, token, tenant_id),
'agent': windows_agent.WindowsAgentExecutor( 'agent': windows_agent.WindowsAgentExecutor(
environment_id, rmqclient) environment, rmqclient)
} }
def execute(self, name, **kwargs): def execute(self, name, **kwargs):

View File

@@ -1,6 +1,3 @@
#!/usr/bin/env python
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack LLC. # Copyright 2011 OpenStack LLC.
# All Rights Reserved. # All Rights Reserved.
# #

View File

@@ -1,3 +1,19 @@
# 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.
class Context(object): class Context(object):
def __init__(self, parent=None): def __init__(self, parent=None):
self._parent = parent self._parent = parent

View File

@@ -1,3 +1,18 @@
# 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 types import types

View File

@@ -1,3 +1,18 @@
# 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.
from eventlet import patcher from eventlet import patcher
puka = patcher.import_patched('puka') puka = patcher.import_patched('puka')
#import puka #import puka
@@ -97,7 +112,6 @@ class Subscription(object):
"Subscription object must be used within 'with' block") "Subscription object must be used within 'with' block")
self._ack_last() self._ack_last()
self._lastMessage = self._client.wait(self._promise, timeout=timeout) self._lastMessage = self._client.wait(self._promise, timeout=timeout)
#print self._lastMessage
msg = Message() msg = Message()
msg.body = anyjson.loads(self._lastMessage['body']) msg.body = anyjson.loads(self._lastMessage['body'])
msg.id = self._lastMessage['headers'].get('message_id') msg.id = self._lastMessage['headers'].get('message_id')

View File

@@ -1,3 +1,18 @@
# 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 xml_code_engine import xml_code_engine
import rabbitmq import rabbitmq

View File

@@ -1,5 +1,3 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack Foundation # Copyright 2012 OpenStack Foundation
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may # Licensed under the Apache License, Version 2.0 (the "License"); you may

View File

@@ -1,3 +1,18 @@
# 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 xml_code_engine import xml_code_engine
from openstack.common import log as logging from openstack.common import log as logging

View File

@@ -1,3 +1,18 @@
# 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 jsonpath import jsonpath
import types import types
import re import re
@@ -124,9 +139,6 @@ class Workflow(object):
def _rule_func(match, context, body, engine, limit=0, name=None, **kwargs): def _rule_func(match, context, body, engine, limit=0, name=None, **kwargs):
position = context['__dataSource_currentPosition'] or [] position = context['__dataSource_currentPosition'] or []
# data = context['__dataSource_currentObj']
# if data is None:
# data = context['/dataSource']
position, match = Workflow._get_relative_position(match, context) position, match = Workflow._get_relative_position(match, context)
data = Workflow._get_path(context['/dataSource'], position) data = Workflow._get_path(context['/dataSource'], position)
match = re.sub(r'@\.([\w.]+)', match = re.sub(r'@\.([\w.]+)',

View File

@@ -1,4 +1,18 @@
#from lxml import etree # 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 xml.etree.ElementTree as etree import xml.etree.ElementTree as etree
import types import types
@@ -121,15 +135,3 @@ XmlCodeEngine.register_function(_function_func, "function")
XmlCodeEngine.register_function(_null_func, "null") XmlCodeEngine.register_function(_null_func, "null")
XmlCodeEngine.register_function(_true_func, "true") XmlCodeEngine.register_function(_true_func, "true")
XmlCodeEngine.register_function(_false_func, "false") XmlCodeEngine.register_function(_false_func, "false")
def xprint(context, body, **kwargs):
print "------------------------ start ------------------------"
for arg in kwargs:
print "%s = %s" % (arg, kwargs[arg])
print 'context = ', context
print 'body = %s (%s)' % (body, body.text)
print "------------------------- end -------------------------"
XmlCodeEngine.register_function(xprint, "print")