Пример #1
0
                print line

def op_remove_build():
    validate_input()
    if not Utils.confirm("You are about to remove Marathon build for {}.".format( MarathonConfig.marathon_version() )):
        LOG.info("You have cancelled the action.")
        exit(0)
    Utils.cmd("rm -rf {}/{}".format( MarathonConfig.packages_dir(),
                                     MarathonConfig.marathon_version()))

def op_remove_sources():
    if not Utils.confirm("You are about to remove Marathon sources for {}.".format( MarathonConfig.marathon_git_repository() )):
        LOG.info("You have cancelled the action.")
        exit(0)
    Utils.cmd("rm -rf {}".format( MarathonConfig.marathon_repository_dir() ))

def op_check_this_system():
    LOG.info("Checking dependencies:")
    LOG.info(" -> Docker? : {}".format( "Yes" if Utils.is_docker_available() else "No" ))
    LOG.info(" -> Git?    : {}".format( "Yes" if Utils.is_git_available() else "No" ))

if __name__ == "__main__":

    if "build" == MarathonConfig.command(): op_build()
    if "show-releases" == MarathonConfig.command(): op_show_releases()
    if "show-builds" == MarathonConfig.command(): Utils.print_builds( LOG, MarathonConfig.packages_dir() )
    if "remove-build" == MarathonConfig.command(): op_remove_build()
    if "show-sources" == MarathonConfig.command(): Utils.list_sources(MarathonConfig.source_dir(), 'marathon')
    if "remove-sources" == MarathonConfig.command(): op_remove_sources()
    if "check-this-system" == MarathonConfig.command(): op_check_this_system()
    
Пример #2
0
                print line

def op_remove_build():
    validate_input()
    if not Utils.confirm("You are about to remove Chronos build for {}.".format( ChronosConfig.chronos_version() )):
        LOG.info("You have cancelled the action.")
        exit(0)
    Utils.cmd("rm -rf {}/{}".format( ChronosConfig.packages_dir(),
                                     ChronosConfig.chronos_version()))

def op_remove_sources():
    if not Utils.confirm("You are about to remove Chronos sources for {}.".format( ChronosConfig.chronos_git_repository() )):
        LOG.info("You have cancelled the action.")
        exit(0)
    Utils.cmd("rm -rf {}".format( ChronosConfig.chronos_repository_dir() ))

def op_check_this_system():
    LOG.info("Checking dependencies:")
    LOG.info(" -> Docker? : {}".format( "Yes" if Utils.is_docker_available() else "No" ))
    LOG.info(" -> Git?    : {}".format( "Yes" if Utils.is_git_available() else "No" ))

if __name__ == "__main__":

    if "build" == ChronosConfig.command(): op_build()
    if "show-releases" == ChronosConfig.command(): op_show_releases()
    if "show-builds" == ChronosConfig.command(): Utils.print_builds( LOG, ChronosConfig.packages_dir() )
    if "remove-build" == ChronosConfig.command(): op_remove_build()
    if "show-sources" == ChronosConfig.command(): Utils.list_sources(ChronosConfig.source_dir(), 'chronos')
    if "remove-sources" == ChronosConfig.command(): op_remove_sources()
    if "check-this-system" == ChronosConfig.command(): op_check_this_system()