The docs describe a "snapshot" action, which backs up a database. I have used something similar but I was wondering, once that snapshot does create a file (in my case a postgresql dump) it just sits there on the machine for that particular charm. Is there not some way of passing it back to machine from where you run the "juju run-action ..." command from in the first place? (I'm not sure of the terminology here, so I'm just going to call it the "host")

I'm using python, and I know you can use hookenv.action_set({}) to pass a message back, but what about a whole file? I suppose I could use this to pass the contents of the file back, but it seems a bit hacky.

If I use something like: host_ip, _, machine_ip, __ = os.environ['SSH_CONNECTION'].split(' ') and then try to scp the file using the host_ip information, it wants a password, so isn't really automated.

Does anyone have any suggestions for doing this from within an action please?

share|improve this question
up vote 1 down vote accepted

You could send a shh private key in charm action,

$ juju run-action ssh_pkey=`cat .ssh/somekey`

and add public key to host authorized_keys.

or just set host key in charm config

$ juju config myservice key=`cat .ssh/somekey`
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.