mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
use transport if not set in state_file
This commit is contained in:
parent
10e309a64f
commit
38963d5a82
1 changed files with 13 additions and 4 deletions
|
@ -13,10 +13,19 @@ class DownloadArtifacts(object):
|
|||
|
||||
def setup_transport(self):
|
||||
config = yaml.load(subprocess.check_output(['bundle', 'exec', 'kitchen', 'diagnose', self.instance]))
|
||||
instance = config['instances'][self.instance]['state_file']
|
||||
transport = paramiko.Transport((instance['hostname'], instance['port']))
|
||||
pkey = paramiko.rsakey.RSAKey(filename=instance['ssh_key'])
|
||||
transport.connect(username=instance['username'], pkey=pkey)
|
||||
state = config['instances'][self.instance]['state_file']
|
||||
tport = config['instances'][self.instance]['transport']
|
||||
transport = paramiko.Transport((
|
||||
state['hostname'],
|
||||
state.get('port', tport.get('port', 22))
|
||||
))
|
||||
pkey = paramiko.rsakey.RSAKey(
|
||||
filename=state.get('ssh_key', tport.get('ssh_key', '~/.ssh/id_rsa'))
|
||||
)
|
||||
transport.connect(
|
||||
username=state.get('username', tport.get('username', 'root')),
|
||||
pkey=pkey
|
||||
)
|
||||
return paramiko.SFTPClient.from_transport(transport)
|
||||
|
||||
def download(self):
|
||||
|
|
Loading…
Add table
Reference in a new issue