Пример #1
0
def display_info():
    """Displays Legit informatics."""

    puts('{0}. {1}\n'.format(colored.red('legit'),
                             black(u'A Kenneth Reitz Project™')))

    puts('Usage: {0}'.format(colored.blue('legit <command>')))
    puts('Commands: {0}.\n'.format(
        eng_join([str(colored.green(c)) for c in sorted(cmd_map.keys())])))
Пример #2
0
def display_info():
    """Displays Legit informatics."""

    puts('{0}. {1}\n'.format(
        colored.red('legit'),
        black(u'A Kenneth Reitz Project™')
    ))

    puts('Usage: {0}'.format(colored.blue('legit <command>')))
    puts('Commands: {0}.\n'.format(
        eng_join(
            [str(colored.green(c)) for c in sorted(cmd_map.keys())]
        )
    ))
Пример #3
0
    def main(self, project_name):
        # Deploy
        minions = self.parent.client.cmd(project_name, 'test.ping')

        if len(minions) == 0:
            puts(colored.red("No up minions matching, abort!"))
            sys.exit(1)

        bad_minions = []
        for minion, minion_status in minions.items():
            if not minion_status:
                bad_minions.append((minion, minion_status))
        if bad_minions:
            puts(colored.red("Could not deploy on theses minions statuses:"))
            with indent(2):
                for minion_tuple in bad_minions:
                    puts(colored.red('* %s status: %s' %  minion_tuple))

        puts(colored.blue("Starting deployment on %s" % eng_join(minions.keys(), im_a_moron=True)))

        for minion in minions:
            puts(colored.blue("=" * 10))
            puts(colored.blue("Minion: %s" % minion))
            puts(colored.blue("Roles: %s" % eng_join(self.parent.client.minions_roles()[minion], im_a_moron=True)))

            puts()
            puts(colored.blue("Execute state.highstate"))

            result = self.parent.client.cmd(minion, 'state.highstate',
                timeout=9999999999)[minion]
            x = _format_host(minion, result)
            print x[0]
            success = parse_result(result)

            if not success:
                puts()
                puts(colored.red("Deployment has failed on %s minion, abort!"
                                 % minion))
                sys.exit(1)

            # Do orchestration
            # orchestration_result = self.parent.client.orchestrate(minion)
            # print "orchestration_result", orchestration_result

            # Call health-checks
            puts(colored.blue("Starting healthchecks on %s" % minion))
            health_checks_result = self.parent.client.cmd(minion,
                    'state.top', 9999999999, 'healthcheck_top.sls')[minion]
            x = _format_host(minion, health_checks_result)
            print x[0]
            success = parse_result(health_checks_result)

            if not success:
                puts()
                puts(colored.red("Healthchecks has failed on minion %s"
                                 % minion))
                sys.exit(1)
            else:
                puts()
                puts(colored.green("Healthchecks success on minion %s"
                                   % minion))

        puts()
        puts(colored.green("Deployment success on all minions!"))