1

I have a salt master and just one salt minion with the Id saltMinion2. I installed the rpm salt-master-2014.1.10-4.el6.noarch on the master and salt-minion-2014.1.10-4.el6.noarch on the minion and both machines are CentOS6.5. Master is able to test.ping minion so the set up probably works. I'm running the following command on the master:

salt saltMinion2  cp.get_file  salt://etc/hosts  /minion

I expect the file /etc/hosts on master to appear in the directory /minion on the minion. The file exists in the master and the directory exists in the minion. Running in debug mode I get debug and info messages in both master and minion but no errors, and seems like the command gets executed on the master successfully. The minion directory /minion remains empty after the command completes with minion logging

Returning information for job:<some number>

What am I doing wrong here?

The Governor
  • 153
  • 7
  • I can get it to work by putting the hosts file under /srv/salt on master and changing master config file file_roots directive and using salt://hosts as the path. But this work around doesn't satisfy me. – The Governor Sep 02 '14 at 20:39

1 Answers1

2

As you pointed out in the comment, that file must be exist in the salt master file server (that is specified with the salt:// protocol). You cannot specify the source file as a filesystem path:

$ sudo salt minion-id cp.get_file /etc/hosts /tmp
minion-id:
    Traceback (most recent call last):
      File "/usr/lib/pymodules/python2.7/salt/minion.py", line 722, in _thread_return
        return_data = func(*args, **kwargs)
      File "/usr/lib/pymodules/python2.7/salt/modules/cp.py", line 150, in get_file
        gzip)
      File "/usr/lib/pymodules/python2.7/salt/fileclient.py", line 692, in get_file
        path = self._check_proto(path)
      File "/usr/lib/pymodules/python2.7/salt/fileclient.py", line 58, in _check_proto
        raise MinionError('Unsupported path: {0}'.format(path))
    MinionError: Unsupported path: /etc/hosts

In your case, /srv/salt/etc/hosts does not exist.

quanta
  • 50,327
  • 19
  • 152
  • 213