Can i use salt-ssh execute cp.push
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 5.6k
- Avg merge
- 2d 44m
- Merged PRs (30d)
- 80
Description
Description of Issue/Question
I have tried salt '192.168.3.76' cp.push /etc/fstab to copy minion file to master, it works well, however, it comes to a situation where salt-minion doesn't exist, so I try to run the following cmd:
salt-ssh '192.168.3.76' cp.push /etc/fstab, it turns out error.(the following msg is error log)
[DEBUG ] Reading configuration from /etc/salt/master
[DEBUG ] Configuration file path: /etc/salt/master
[WARNING ] Insecure logging configuration detected! Sensitive data may be logged.
[DEBUG ] LazyLoaded flat.targets
[DEBUG ] LazyLoaded jinja.render
[DEBUG ] LazyLoaded yaml.render
[DEBUG ] compile template: /etc/salt/roster
[DEBUG ] Jinja search path: ['/var/cache/salt/master/files/base']
[PROFILE ] Time (in seconds) to render '/etc/salt/roster' using 'jinja' renderer: 0.00202894210815
[DEBUG ] Rendered data from file: /etc/salt/roster:
192.168.3.76:
host: 192.168.3.76
user: test
192.168.3.181:
host: 192.168.3.181
user: test
[DEBUG ] Results of YAML rendering:
OrderedDict([('192.168.3.76', OrderedDict([('host', '192.168.3.76'), ('user', 'test')])), ('192.168.3.181', OrderedDict([('host', '192.168.3.181'), ('user', 'test')]))])
[PROFILE ] Time (in seconds) to render '/etc/salt/roster' using 'yaml' renderer: 0.00104212760925
[DEBUG ] Matched minions: {'192.168.3.76': OrderedDict([('host', '192.168.3.76'), ('user', 'test')])}
[DEBUG ] LazyLoaded roots.envs
[DEBUG ] Could not LazyLoad roots.init
[DEBUG ] Updating roots fileserver cache
[DEBUG ] LazyLoaded local_cache.prep_jid
[DEBUG ] Adding minions for job 20160809130254625919: ['192.168.3.76']
[DEBUG ] Could not LazyLoad cp.push
[DEBUG ] Performing shimmed, blocking command as follows:
cp.push /etc/fstab
[DEBUG ] Executed SHIM command. Command logged to TRACE
[DEBUG ] Child Forked! PID: 6095 STDOUT_FD: 10 STDERR_FD: 13
[DEBUG ] VT: Salt-SSH SHIM Terminal Command executed. Logged to TRACE
[DEBUG ] RETCODE 192.168.3.76: 1
[DEBUG ] LazyLoaded nested.output
192.168.3.76:
----------
retcode:
1
stderr:
Traceback (most recent call last):
File "/var/tmp/.test_3ef1f9_salt/salt-call", line 15, in
salt_call()
File "/var/tmp/.test_3ef1f9_salt/py2/salt/scripts.py", line 345, in salt_call
client.run()
File "/var/tmp/.test_3ef1f9_salt/py2/salt/cli/call.py", line 58, in run
caller.run()
File "/var/tmp/.test_3ef1f9_salt/py2/salt/cli/caller.py", line 134, in run
ret = self.call()
File "/var/tmp/.test_3ef1f9_salt/py2/salt/cli/caller.py", line 197, in call
ret['return'] = func(_args, *_kwargs)
File "/var/tmp/.test_3ef1f9_salt/py2/salt/modules/cp.py", line 728, in push
auth = _auth()
File "/var/tmp/.test_3ef1f9_salt/py2/salt/modules/cp.py", line 35, in _auth
context['auth'] = salt.crypt.SAuth(opts)
File "/var/tmp/.test_3ef1f9_salt/py2/salt/crypt.py", line 940, in new
key = cls.__key(opts)
File "/var/tmp/.test_3ef1f9_salt/py2/salt/crypt.py", line 954, in __key
opts['master_uri'], # master ID
KeyError: 'master_uri'
stdout:
Setup
(Please provide relevant configs and/or SLS files (Be sure to remove sensitive info).)
Steps to Reproduce Issue
(Include debug logs if possible and relevant.)
Versions Report
(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with salt/modules/cp.py at push and follow the _auth call into salt/crypt.py, especially SAuth.__key, using the reported salt-ssh cp.push command as the reproduction. Compare the salt-ssh execution options with the path that supplies master_uri. Done means the command's behavior for a host without salt-minion is resolved and covered by an appropriate test or documented as unsupported.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli, infrastructure
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100