You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to do a put with Fabric but am getting Errno 21. Code and result below. This is running on a Centos Linux install, Python 2.7 and Fabric 2.4.
Hi,
I am trying to do a put with Fabric but am getting Errno 21. Code and result below. This is running on a Centos Linux install, Python 2.7 and Fabric 2.4.
Test.py
from fabric import Connection, Config
hostname = '10.10.10.10'
password = 'testing'
username = 'test'
sudo_user = 'root'
sudo_password = 'testing'
Create a parameters dictionary
ssh_env_params = {'password':password}
Create a config object
config = Config(
overrides={
'sudo': {
'user': sudo_user,
'password': sudo_password}})
Create a Connection object
ssh_connection = Connection(hostname,
user=username,
config=config,
connect_kwargs=ssh_env_params)
try:
# Run the conneciton object
print "running command on connection"
result = ssh_connection.put('/tmp/example/level1/level2', '/tmp/')
print "result.return_code = " + str(result.return_code)
except IOError as error:
print "Caught IOError"
print error
Result
[user]$ python test.py
running command on connection
Caught IOError
[Errno 21] Is a directory: '/tmp/example/level1/level2'
The text was updated successfully, but these errors were encountered: