Esempio n. 1
0
    def run(self, state):
        all_hosts = set(
            map(lambda sname: cfg.get(self.config_url, sname)['name'],
                state.hosts))

        for group in state.groups:
            all_hosts |= set(cfg.get(self.config_url, group)['hosts'])

        for name in all_hosts:
            host.Host(state, cfg.get(self.config_url, name))
Esempio n. 2
0
    def run(self, state):
        for spec in self.ndds:
            cmdline = ['python', '/usr/local/bin/ndd.py', '-p', self.ndd_port,
                       '-i', spec.input_, '-o', spec.output]
            if spec.source:
                remote_source = cfg.get(self.config_url, spec.source)['name']
                source = '{}@{}'.format(self.get_login(), remote_source)
            else:
                cmdline.extend(['--local'])
                remote_source = None
                source = self.local_addr
            cmdline.extend(['-s', source])

            if spec.args:
                cmdline.extend(['-{}'.format(spec.args)])

            for host in sorted(state.active_hosts,
                               key=lambda host: host.props.get('switch')):
                if remote_source and host.name == remote_source:
                    continue
                cmdline.extend(
                    ['-d', '{}@{}'.format(self.get_login(), str(host.name))])

            rv, _ = proc.run_process(cmdline, state.log)
            if rv != 0:
                for host in list(state.active_hosts):
                    host.fail(self, 'failed to run ndd.py')
Esempio n. 3
0
 def run_single(self, host):
     amt_host = host.props.get('amt')
     if amt_host is None:
         host.fail(self, 'host props do not have "amt" attribute')
     else:
         host.amt_host = cfg.get(self.config_url, amt_host)['name']