Ejemplo n.º 1
0
    def do_run(self):
        self.context = RsyncContext(
            self.options.source,
            self.options.destination,
            self.options.__dict__,
            sys.stdout,
            sys.stderr
        )
        check_required_command('rsync')
        hosts = self.check_hosts()

        rsync_command = 'rsync %s %s %s' % (
            self.context.options['rsync_options'],
            self.context.source,
            self.context.destination
        )
        color = create_coloring_object(sys.stdout)
        # prompt when production environment
        self.confirm_execution_on_production(
            'Rsync command "%s" will be executed %s hosts. Are you sure? [yes/NO]: '
            % (color.green(rsync_command), color.green(len(hosts)))
        )

        executor = RsyncExecutor(self.context, self.log, hosts)
        return executor.execute(self.context.source, self.context.destination)
Ejemplo n.º 2
0
    def do_run(self):
        self.context = CommandContext(self.options.command, self.options.__dict__, sys.stdout, sys.stderr)
        check_required_command("ssh")
        hosts = self.check_hosts()

        color = create_coloring_object(sys.stdout)
        # prompt when production environment
        self.confirm_execution_on_production(
            'Command "%s" will be executed to %s hosts. Are you sure? [yes/NO]: '
            % (color.green(" ".join(self.context.arguments)), color.green(len(hosts)))
        )

        executor = CommandExecutor(self.context, self.log, hosts)
        return executor.execute(self.context.arguments)
Ejemplo n.º 3
0
    def do_run(self):
        self.context = CommandContext(self.options.command,
                                      self.options.__dict__, sys.stdout,
                                      sys.stderr)
        check_required_command('ssh')
        hosts = self.check_hosts()

        color = create_coloring_object(sys.stdout)
        # prompt when production environment
        self.confirm_execution_on_production(
            'Command "%s" will be executed to %s hosts. Are you sure? [yes/NO]: '
            % (color.green(' '.join(
                self.context.arguments)), color.green(len(hosts))))

        executor = CommandExecutor(self.context, self.log, hosts)
        return executor.execute(self.context.arguments)
Ejemplo n.º 4
0
    def do_run(self):
        self.context = RsyncContext(self.options.source,
                                    self.options.destination,
                                    self.options.__dict__, sys.stdout,
                                    sys.stderr)
        check_required_command('rsync')
        hosts = self.check_hosts()

        rsync_command = 'rsync %s %s %s' % (
            self.context.options['rsync_options'], self.context.source,
            self.context.destination)
        color = create_coloring_object(sys.stdout)
        # prompt when production environment
        self.confirm_execution_on_production(
            'Rsync command "%s" will be executed %s hosts. Are you sure? [yes/NO]: '
            % (color.green(rsync_command), color.green(len(hosts))))

        executor = RsyncExecutor(self.context, self.log, hosts)
        return executor.execute(self.context.source, self.context.destination)