spacepaste

  1.  
  2. def _publish(self, host, cmd, *args):
  3. """Dispatch to salt master."""
  4. if self.c_dir is not None:
  5. opts = salt.config.minion_config(
  6. os.path.join(self.c_dir, 'minion')
  7. )
  8. else:
  9. opts = salt.config.minion_config('/etc/salt.tds/minion')
  10. caller = salt.client.Caller(mopts=opts)
  11. host_re = '%s.*' % host # To allow FQDN matching
  12. # Set timeout high because... RedHat
  13. result = caller.sminion.functions['publish.full_data'](
  14. host_re, cmd, args, timeout=120
  15. )
  16. if not result:
  17. return (False, 'No data returned from host %s' % host)
  18. # We're assuming only one key is being returned currently
  19. host_result = result.values()[0]['ret']
  20. success = host_result.endswith('successful')
  21. return (success, host_result)
  22.