Esempio n. 1
0
    def cleanup_platforms(self):
        force = self.app.pargs.force
        all_platforms = self.app.pargs.all_platforms

        if all_platforms:
            platform_name = None
        else:
            platform_name = fileoperations.get_platform_name()

        # We clean up all failed platform versions
        failed_versions = sorted(
            platformops.list_custom_platform_versions(
                platform_name=platform_name,
                status='Failed',
            )
        )

        if failed_versions:
            if not force:
                if not platform_name:
                    io.echo(prompts['cleanupplatform.confirm'].replace('{platform-name}', 'All Platforms'))

                    for failed_version in failed_versions:
                        io.echo(failed_version)

                    io.validate_action(prompts['cleanupplatform.validate-all'], 'all')
                else:
                    io.echo(prompts['cleanupplatform.confirm'].replace('{platform-name}', platform_name))
                    io.validate_action(prompts['cleanupplatform.validate'], platform_name)

            for failed_version in failed_versions:
                platformops.delete_platform_version(failed_version, force=True)
Esempio n. 2
0
    def do_command(self):
        version = self.app.pargs.version
        cleanup = self.app.pargs.cleanup
        force = self.app.pargs.force

        if cleanup:
            self.cleanup_platforms()
        else:
            if version:
                delete_platform_version(version, force)
            else:
                self.app.args.print_help()
Esempio n. 3
0
    def do_command(self):
        version = self.app.pargs.version
        cleanup = self.app.pargs.cleanup
        force = self.app.pargs.force

        # TODO: raise if 'version' and 'cleanup' are both specified
        if cleanup:
            self.cleanup_platforms()
        else:
            if version:
                platformops.delete_platform_version(version, force)
            else:
                self.app.args.print_help()