diff --git a/README.md b/README.md index cf16306e..20c5b3b5 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,7 @@ solar resource create keystone_db_user resources/mariadb_user/ user_name=keyston solar connect node1 mariadb_service 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 keystone_db keystone_db_user diff --git a/solar/solar/cli/main.py b/solar/solar/cli/main.py index e7231ecb..c6b6f227 100644 --- a/solar/solar/cli/main.py +++ b/solar/solar/cli/main.py @@ -107,17 +107,19 @@ def init_cli_connect(): @click.argument('receiver') @click.argument('mapping', default='') def connect(mapping, receiver, emitter): - mapping_parsed = {} - - click.echo('Connect {} to {}'.format(emitter, receiver)) + mapping_parsed = None emitter = sresource.load(emitter) receiver = sresource.load(receiver) - try: - mapping_parsed.update(json.loads(mapping)) - except ValueError: - for m in mapping.split(): - k, v = m.split('->') - mapping_parsed.update({k: v}) + click.echo('Connect {} to {}'.format(emitter, receiver)) + + if mapping: + mapping_parsed = {} + try: + 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) show_emitter_connections(emitter)