Renamed solard to solar_agent, moved transports and examples

This commit is contained in:
Jedrzej Nowak 2015-11-23 17:23:45 +01:00
parent ed283a38c7
commit 9e8009b8cb
10 changed files with 44 additions and 44 deletions

View File

@ -206,26 +206,26 @@ def setup_haproxies():
@click.command()
@click.argument('i', type=int, required=True)
def add_solard(i):
solard_transport = vr.create('solard_transport%s' % i, 'resources/transport_solard',
{'solard_user': 'vagrant',
'solard_password': 'password'})[0]
def add_solar_agent(i):
solar_agent_transport = vr.create('solar_agent_transport%s' % i, 'resources/transport_solar_agent',
{'solar_agent_user': 'vagrant',
'solar_agent_password': 'password'})[0]
transports = resource.load('transports%s' % i)
ssh_transport = resource.load('ssh_transport%s' % i)
transports_for_solard = vr.create('transports_for_solard%s' % i, 'resources/transports')[0]
transports_for_solar_agent = vr.create('transports_for_solar_agent%s' % i, 'resources/transports')[0]
# install solard with ssh
signals.connect(transports_for_solard, solard_transport, {})
# install solar_agent with ssh
signals.connect(transports_for_solar_agent, solar_agent_transport, {})
signals.connect(ssh_transport, transports_for_solard, {'ssh_key': 'transports:key',
signals.connect(ssh_transport, transports_for_solar_agent, {'ssh_key': 'transports:key',
'ssh_user': 'transports:user',
'ssh_port': 'transports:port',
'name': 'transports:name'})
# add solard to transports on this node
signals.connect(solard_transport, transports, {'solard_user': 'transports:user',
'solard_port': 'transports:port',
'solard_password': 'transports:password',
# add solar_agent to transports on this node
signals.connect(solar_agent_transport, transports, {'solar_agent_user': 'transports:user',
'solar_agent_port': 'transports:port',
'solar_agent_password': 'transports:password',
'name': 'transports:name'})
@ -252,7 +252,7 @@ def undeploy():
main.add_command(deploy)
main.add_command(undeploy)
main.add_command(add_haproxies)
main.add_command(add_solard)
main.add_command(add_solar_agent)
if __name__ == '__main__':

View File

@ -17,18 +17,18 @@ def run():
})[0]
transports = vr.create('transports_node1', 'resources/transports')[0]
transports_for_solard = vr.create('transports_for_solard', 'resources/transports')[0]
transports_for_solar_agent = vr.create('transports_for_solar_agent', 'resources/transports')[0]
ssh_transport = vr.create('ssh_transport', 'resources/transport_ssh',
{'ssh_key': '/vagrant/.vagrant/machines/solar-dev1/virtualbox/private_key',
'ssh_user': 'vagrant'})[0]
solard_transport = vr.create('solard_transport', 'resources/transport_solard',
{'solard_user': 'vagrant',
'solard_password': 'password'})[0]
solar_agent_transport = vr.create('solar_agent_transport', 'resources/transport_solar_agent',
{'solar_agent_user': 'vagrant',
'solar_agent_password': 'password'})[0]
transports_for_solard.connect(solard_transport, {})
ssh_transport.connect(transports_for_solard,{'ssh_key': 'transports:key',
transports_for_solar_agent.connect(solar_agent_transport, {})
ssh_transport.connect(transports_for_solar_agent,{'ssh_key': 'transports:key',
'ssh_user': 'transports:user',
'ssh_port': 'transports:port',
'name': 'transports:name'})
@ -40,9 +40,9 @@ def run():
'ssh_user': 'transports:user',
'ssh_port': 'transports:port',
'name': 'transports:name'})
solard_transport.connect(transports, {'solard_user': 'transports:user',
'solard_port': 'transports:port',
'solard_password': 'transports:password',
solar_agent_transport.connect(transports, {'solar_agent_user': 'transports:user',
'solar_agent_port': 'transports:port',
'solar_agent_password': 'transports:password',
'name': 'transports:name'})

View File

@ -17,7 +17,7 @@ import handlers
# from solar.core.transports.ssh import SSHSyncTransport, SSHRunTransport
# from solar.core.transports.rsync import RsyncSyncTransport
# from solar.core.transports.solard_transport import SolardRunTransport, SolardSyncTransport
# from solar.core.transports.solar_agent_transport import SolarAgentRunTransport, SolarAgentSyncTransport
from solar.core.transports.bat import BatRunTransport, BatSyncTransport
@ -25,8 +25,8 @@ _default_transports = {
# 'sync': RsyncSyncTransport,
# 'sync': SSHSyncTransport,
# 'run': SSHRunTransport,
# 'run': SolardRunTransport,
# 'sync': SolardSyncTransport
# 'run': SolarAgentRunTransport,
# 'sync': SolarAgentSyncTransport
'run': BatRunTransport,
'sync': BatSyncTransport
}

View File

@ -24,7 +24,7 @@ from solar import errors
env.warn_only = True
# if we would have something like solard that would render this then
# if we would have something like solar_agent that would render this then
# we would not need to render it there
# for now we redender it locally, sync to remote, run ansible on remote host as local
class AnsibleTemplate(TempFileHandler):

View File

@ -91,7 +91,7 @@ def location_and_transports(emitter, receiver, orig_mapping):
return
if emitter_single.get('is_emit') is False:
# this case is when we connect resource to transport itself
# like adding ssh_transport for solard_transport and we don't want then
# like adding ssh_transport for solar_agent_transport and we don't want then
# transports_id to be messed
# it forbids passing this value around
# log.debug("Disabled %r mapping for %r", single, emitter.name)

View File

@ -2,11 +2,11 @@ from solar.core.transports.base import SyncTransport, RunTransport, SolarTranspo
from solar.core.transports.ssh import SSHSyncTransport, SSHRunTransport
from solar.core.transports.rsync import RsyncSyncTransport
try:
from solar.core.transports.solard_transport import SolardRunTransport, SolardSyncTransport
from solar.core.transports.solar_agent_transport import SolarAgentRunTransport, SolarAgentSyncTransport
except ImportError:
_solard_available = False
_solar_agent_available = False
else:
_solard_available = True
_solar_agent_available = True
try:
from solar.core.transports.torrent import TorrentSyncTransport
@ -29,9 +29,9 @@ KNOWN_RUN_TRANSPORTS = {
if _torrent_available:
KNOWN_SYNC_TRANSPORTS['torrent'] = TorrentSyncTransport
if _solard_available:
KNOWN_SYNC_TRANSPORTS['solard'] = SolardSyncTransport
KNOWN_RUN_TRANSPORTS['solard'] = SolardRunTransport
if _solar_agent_available:
KNOWN_SYNC_TRANSPORTS['solar_agent'] = SolarAgentSyncTransport
KNOWN_RUN_TRANSPORTS['solar_agent'] = SolarAgentRunTransport
class OnAll(object):
@ -87,7 +87,7 @@ class BatTransport(SolarTransport):
class BatSyncTransport(SyncTransport, BatTransport):
preffered_transport_name = None
_order = ('torrent', 'solard', 'rsync', 'ssh')
_order = ('torrent', 'solar_agent', 'rsync', 'ssh')
_bat_transports = KNOWN_SYNC_TRANSPORTS
def __init__(self, *args, **kwargs):
@ -105,7 +105,7 @@ class BatSyncTransport(SyncTransport, BatTransport):
class BatRunTransport(RunTransport, BatTransport):
preffered_transport_name = None
_order = ('solard', 'ssh')
_order = ('solar_agent', 'ssh')
_bat_transports = KNOWN_RUN_TRANSPORTS
def __init__(self, *args, **kwargs):

View File

@ -13,13 +13,13 @@
# under the License.
from solard.client import SolardClient
from solar_agent.client import SolarAgentClient
from solar.core.transports.base import RunTransport, SyncTransport, Executor, SolarRunResult
from solar.core.log import log
class SolardTransport(object):
class SolarAgentTransport(object):
def get_client(self, resource):
transport = self.get_transport_data(resource)
@ -28,18 +28,18 @@ class SolardTransport(object):
port = transport['port']
auth = transport['password']
transport_class = transport.get('transport_class')
client = SolardClient(auth={'user': user, 'auth': auth},
client = SolarAgentClient(auth={'user': user, 'auth': auth},
transport_args=(host, port),
transport_class=transport_class)
return client
class SolardSyncTransport(SyncTransport, SolardTransport):
class SolarAgentSyncTransport(SyncTransport, SolarAgentTransport):
preffered_transport_name = 'solard'
preffered_transport_name = 'solar_agent'
def copy(self, resource, _from, _to, use_sudo=False):
log.debug("Solard copy: %s -> %s", _from, _to)
log.debug("SolarAgent copy: %s -> %s", _from, _to)
client = self.get_client(resource)
executor = lambda transport: client.copy(_from, _to, use_sudo)
@ -49,15 +49,15 @@ class SolardSyncTransport(SyncTransport, SolardTransport):
self.executors.append(executor)
class SolardRunTransport(RunTransport, SolardTransport):
class SolarAgentRunTransport(RunTransport, SolarAgentTransport):
preffered_transport_name = 'solard'
preffered_transport_name = 'solar_agent'
def get_result(self, result):
return SolarRunResult(result)
def run(self, resource, *args, **kwargs):
log.debug("Solard run: %s", args)
log.debug("SolarAgent run: %s", args)
client = self.get_client(resource)
res = client.run(' '.join(args), **kwargs)
return self.get_result(res)