saltstack/salt — pull request #7443 by russellballestrini (2013-09-25 05:00:09+00:00)
Title: Include additional arguments and options to the hg command line

I need to supply an identity file to hg for SSH authentication. Using an identity file from the CLI is semi hacky so instead of building in the hacks prematurely, I thought it would be better to open up the "opts" parameter in the state itself so I may put the hack into my salt-state tree instead of the salt sourcecode. This allows the salt maintainers to come up with a better method of distributing private SSH keys.

modules.hg.py clone function already supports the following:

salt-call hg.clone /tmp/myrepo ssh://hg@bitbucket.org/myuser/myrepo opts='--ssh "ssh -i /tmp/id_rsa_private_bitbucket"' user=appuser

This pull request allows me to specify this in my state formula like so:

ssh://hg@bitbucket.org/myuser/myrepo:
hg.latest:
- target: /tmp/myrepo
- rev: tip
- user: appuser
- runas: appuser
- opts: --ssh 'ssh -i /tmp/id_rsa_private_bitbucket'

This isn't the only usecase, this is just my use case.

modified: hg.py