-
- def _publish(self, host, cmd, *args):
- """Dispatch to salt master."""
-
- if self.c_dir is not None:
- opts = salt.config.minion_config(
- os.path.join(self.c_dir, 'minion')
- )
- else:
- opts = salt.config.minion_config('/etc/salt.tds/minion')
-
- caller = salt.client.Caller(mopts=opts)
- host_re = '%s.*' % host # To allow FQDN matching
-
- # Set timeout high because... RedHat
- result = caller.sminion.functions['publish.full_data'](
- host_re, cmd, args, timeout=120
- )
-
- if not result:
- return (False, 'No data returned from host %s' % host)
-
- # We're assuming only one key is being returned currently
- host_result = result.values()[0]['ret']
- success = host_result.endswith('successful')
-
- return (success, host_result)
-