If mapping is not provided pass None to connect
This commit is contained in:
@@ -72,13 +72,13 @@ Some very simple cluster setup:
|
|||||||
cd /vagrant
|
cd /vagrant
|
||||||
|
|
||||||
solar resource create nodes templates/nodes.yaml '{"count": 2}'
|
solar resource create nodes templates/nodes.yaml '{"count": 2}'
|
||||||
solar resource create mariadb_service resources/mariadb_service '{"image": "mariadb", "root_password": "mariadb", "port": 3306, "ip": "db_host"}'
|
solar resource create mariadb_service resources/mariadb_service '{"image": "mariadb", "root_password": "mariadb", "port": 3306}'
|
||||||
solar resource create keystone_db resources/mariadb_db/ '{"db_name": "keystone_db", "login_user": "root"}'
|
solar resource create keystone_db resources/mariadb_db/ '{"db_name": "keystone_db", "login_user": "root"}'
|
||||||
solar resource create keystone_db_user resources/mariadb_user/ user_name=keystone user_password=keystone # another valid format
|
solar resource create keystone_db_user resources/mariadb_user/ user_name=keystone user_password=keystone # another valid format
|
||||||
|
|
||||||
solar connect node1 mariadb_service
|
solar connect node1 mariadb_service
|
||||||
solar connect node1 keystone_db
|
solar connect node1 keystone_db
|
||||||
solar connect mariadb_service keystone_db '{"root_password": "login_password", "port": "login_port"}'
|
solar connect mariadb_service keystone_db '{"root_password": "login_password", "port": "login_port", "ip": "db_host"}'
|
||||||
# solar connect mariadb_service keystone_db_user 'root_password->login_password port->login_port' # another valid format
|
# solar connect mariadb_service keystone_db_user 'root_password->login_password port->login_port' # another valid format
|
||||||
solar connect keystone_db keystone_db_user
|
solar connect keystone_db keystone_db_user
|
||||||
|
|
||||||
|
|||||||
@@ -107,17 +107,19 @@ def init_cli_connect():
|
|||||||
@click.argument('receiver')
|
@click.argument('receiver')
|
||||||
@click.argument('mapping', default='')
|
@click.argument('mapping', default='')
|
||||||
def connect(mapping, receiver, emitter):
|
def connect(mapping, receiver, emitter):
|
||||||
mapping_parsed = {}
|
mapping_parsed = None
|
||||||
|
|
||||||
click.echo('Connect {} to {}'.format(emitter, receiver))
|
|
||||||
emitter = sresource.load(emitter)
|
emitter = sresource.load(emitter)
|
||||||
receiver = sresource.load(receiver)
|
receiver = sresource.load(receiver)
|
||||||
try:
|
click.echo('Connect {} to {}'.format(emitter, receiver))
|
||||||
mapping_parsed.update(json.loads(mapping))
|
|
||||||
except ValueError:
|
if mapping:
|
||||||
for m in mapping.split():
|
mapping_parsed = {}
|
||||||
k, v = m.split('->')
|
try:
|
||||||
mapping_parsed.update({k: v})
|
mapping_parsed.update(json.loads(mapping))
|
||||||
|
except ValueError:
|
||||||
|
for m in mapping.split():
|
||||||
|
k, v = m.split('->')
|
||||||
|
mapping_parsed.update({k: v})
|
||||||
signals.connect(emitter, receiver, mapping=mapping_parsed)
|
signals.connect(emitter, receiver, mapping=mapping_parsed)
|
||||||
|
|
||||||
show_emitter_connections(emitter)
|
show_emitter_connections(emitter)
|
||||||
|
|||||||
Reference in New Issue
Block a user