def _get_amqp_manager():
    return AMQPManager(
        host=config.instance.amqp_management_host,
        username=config.instance.amqp_username,
        password=config.instance.amqp_password,
        verify=config.instance.amqp_ca_path
    )
示例#2
0
 def _get_amqp_manager(self):
     return AMQPManager(
         host=instance.amqp_management_host,
         username=instance.amqp_username,
         password=instance.amqp_password,
         verify=instance.amqp_ca_path
     )
def setup_amqp_manager():
    amqp_manager = AMQPManager(
        host=config.instance.amqp_management_host or "localhost",
        username=config.instance.amqp_username or "cloudify",
        password=config.instance.amqp_password or "c10udify",
        verify=config.instance.amqp_ca_path or DEFAULT_CA_CERT,
    )
    return amqp_manager
示例#4
0
def _get_amqp_manager(script_config):
    with tempfile.NamedTemporaryFile(delete=False, mode='wb') as f:
        f.write(script_config['rabbitmq_ca_cert'])
    broker = script_config['rabbitmq_brokers'][0]
    atexit.register(os.unlink, f.name)
    return AMQPManager(host=broker['management_host'],
                       username=broker['username'],
                       password=broker['password'],
                       verify=f.name)
示例#5
0
def setup_amqp_manager():
    global amqp_manager
    if not amqp_manager:
        conf_file_str = read_manager_file('/opt/manager/cloudify-rest.conf')
        config = yaml.load(conf_file_str)
        amqp_manager = AMQPManager(host=config['amqp_host'],
                                   username=config['amqp_username'],
                                   password=config['amqp_password'])
    return amqp_manager
示例#6
0
#
# 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 os import environ
from manager_rest.config import instance
from manager_rest.amqp_manager import AMQPManager
from manager_rest.flask_utils import setup_flask_app


environ['MANAGER_REST_CONFIG_PATH'] = '/opt/manager/cloudify-rest.conf'
app = setup_flask_app()

with app.app_context():
    instance.load_configuration()
    amqp_manager = AMQPManager(
        host=instance.amqp_host,
        username=instance.amqp_username,
        password=instance.amqp_password
    )
    amqp_manager.sync_metadata()
示例#7
0
#
# 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 os import environ
from manager_rest.config import instance
from manager_rest.amqp_manager import AMQPManager
from manager_rest.flask_utils import setup_flask_app
from manager_rest.constants import SECURITY_FILE_LOCATION

environ['MANAGER_REST_CONFIG_PATH'] = '/opt/manager/cloudify-rest.conf'
environ['MANAGER_REST_SECURITY_CONFIG_PATH'] = SECURITY_FILE_LOCATION
app = setup_flask_app()

with app.app_context():
    instance.load_configuration()
    amqp_manager = AMQPManager(host=instance.amqp_management_host,
                               username=instance.amqp_username,
                               password=instance.amqp_password,
                               verify=instance.amqp_ca_path)
    amqp_manager.sync_metadata()
def _get_amqp_manager(config):
    return AMQPManager(host=config['amqp_host'],
                       username=config['amqp_username'],
                       password=config['amqp_password'])