Fabric and password svn

Assuming I can't start something like this with Fabric:

run("svn update --password 'password' .")

How to get to Fabric password for remote interactive command line?

The problem is that repo is checked as svn + ssh, and I don't have the http / https / svn option

+7
python svn fabric
source share
6 answers

Try SSHkey. It allows you to connect to the server without a password. In this case, you will need to install sshkey between your remote server and the repo.

On a remote server: create a key pair

  $ ssh-keygen -t dsa 

Leave the password blank! This will create 2 files

  • ~ / .ssh / id_dsa (private key)
  • ~ / .ssh / id_dsa.pub (public key)

Then add the contents to id_dsa.pub in ~ / .ssh / authorized_keys on the repo server.

Your remote server will be able to update the source tree without any required password.

+7
source share

If you just want to hide your password from the log, you can use something like this:

 from fabric.state import output def xrun(command, hidden='', *args, **kwargs): old_state = output.running output.running = False print '[%s] run: %s' % (env.host_string, command) run(command + hidden, *args, **kwargs) output.running = command xrun('svn update', '--password "your password"') 
+3
source share

We had a problem like this and actually proposed a new feature for Fabric, but the developer we spoke to suggested this instead.

 import getpass password = getpass.getpass('Enter SVN Password: ') run("svn update --password '%s'" % password) 

This will give you a password when the time comes to create this team.

I believe that your password will be displayed in the trend log, however, the best option would be to force SVN to request a password and enter the password into it.

 run('echo %s | svn update --password' % password) 

I do not use SVN, although I'm afraid I'm not sure if this is possible. I hope someone there can help!

+2
source share

My standard answer for automating interactive command lines is to "use Expect", but you are using Python, so I will clarify this a bit to "use Pexpect ".

You may need to think a bit about integrating Pexpect into Fabric, or maybe you will just go back to Pexpect just for that particular case. But that is definitely the way I go.

+2
source share

You may also need to provide a user? If not, you might be better off removing the export of your repo and creating tar (locally) to load + deploy to the server. If you run svn commands locally, you can get a request for your username and / or password.

0
source share

You should take a look at Fabric env documentation . It says that you should do something like this:

 from fabric.api import env env.user = 'your_user' env.password = 'your_password' 

Hope this helps!

0
source share

All Articles