Change remote_file to use transports

This commit is contained in:
Dmitry Shulyak 2015-10-13 11:44:44 +03:00
parent 129dd9ba5e
commit 413f9f14f4
3 changed files with 21 additions and 15 deletions

View File

@ -35,20 +35,22 @@ NETWORK_METADATA = yaml.load("""
def deploy():
db.clear()
resources = vr.create('nodes', 'templates/nodes.yaml', {'count': 1})
first_node = next(x for x in resources if x.name.startswith('node'))
ssh = next(x for x in resources if x.name.startswith('ssh'))
resources = vr.create('nodes', 'templates/nodes.yaml', {'count': 2})
first_node, second_node = [x for x in resources if x.name.startswith('node')]
first_transp = next(x for x in resources if x.name.startswith('transport'))
library = vr.create('library1', 'resources/fuel_library', {})[0]
first_node.connect(library)
keys = vr.create('ceph_key', 'resources/ceph_keys', {})[0]
first_node.connect(keys)
remote_file = vr.create('ceph_key2', 'resources/remote_file',
{'dest': '/var/lib/astute/'})[0]
first_node.connect(keys)
second_node.connect(remote_file)
keys.connect(remote_file, {'ip': 'remote_ip', 'path': 'remote_path'})
ssh.connect(remote_file,
{'ssh_key': 'remote_key', 'ssh_user': 'remote_user'})
first_node.connect(remote_file)
first_transp.connect(remote_file, {'transports': 'remote'})
ceph_mon = vr.create('ceph_mon1', 'resources/ceph_mon',
{'storage': STORAGE,

View File

@ -1,3 +1,10 @@
mkdir -p {{remote_path}}
mkdir -p {{dest}}
scp -i {{remote_key}} -r {{remote_user}}@{{remote_ip}}:/{{remote_path}} {{dest}}
{% for transport in remote %}
{% if transport.name == 'ssh' %}
scp -i {{transport.key}} -r {{transport.user}}@{{remote_ip}}:/{{remote_path}} {{dest}}
exit 0
{% endif %}
{% endfor %}
echo 'No suitable transport.'
exit 2

View File

@ -5,18 +5,15 @@ input:
ip:
schema: str!
value:
remote:
schema: {}
value:
remote_ip:
schema: str!
value:
remote_user:
schema: {}
value:
remote_path:
schema: str!
value:
remote_key:
schema: str!
value:
dest:
schema: str!
value: