コード例 #1
0
import socket
import ssl
from deploy_common import CA

# The number of seconds to wait for the environment to setup.
seconds = 900
# Get the directory in this way to load the files from the tests directory.
path = os.path.abspath(os.path.dirname(__file__))

ca = CA()

# Create a dictionary for the rabbitmq configuration.
rabbitmq_configuration = {
    'ssl_enabled': True,
    'ssl_key': ca.get_key(),
    'ssl_cert': ca.get_cert(),
    'ssl_port': 5671
}

d = amulet.Deployment(series='trusty')
# Add the rabbitmq-server charm to the deployment.
d.add('rabbitmq-server')
# Configure options on the rabbitmq-server.
d.configure('rabbitmq-server', rabbitmq_configuration)
# Expose the server so we can connect.
d.expose('rabbitmq-server')

try:
    # Execute the deployer with the current mapping.
    d.setup(timeout=seconds)
except amulet.helpers.TimeoutError:
コード例 #2
0
import amulet
import os
import socket
import ssl
from deploy_common import CA

# The number of seconds to wait for the environment to setup.
seconds = 2700
# Get the directory in this way to load the files from the tests directory.
path = os.path.abspath(os.path.dirname(__file__))

ca = CA()

privateKey = ca.get_key()
certificate = ca.get_cert()

# Create a dictionary of all the configuration values.
rabbit_configuration = {
    "management_plugin": True,
    "ssl_enabled": True,
    "ssl_port": 5999,
    "ssl_key": privateKey,
    "ssl_cert": certificate,
}

d = amulet.Deployment(series="trusty")
# Add the rabbitmq-server charm to the deployment.
d.add("rabbitmq-server")
# Configure all the options on rabbitmq-server.
d.configure("rabbitmq-server", rabbit_configuration)