def collectOldLogFiles(env="dev"): # Get the active versions so we can ignore them activeVersions = getActiveVersionsForEnvironment(env) # For every region, process each node in the env regions = ('us-west-1', 'ap-southeast-1') targetName = "slots-{}".format(env) print "Active versions on {}: {}".format(env, activeVersions) for region in regions: for node in getNodesForEnvironmentAndRegion(env, region): if node[0] != targetName: # We dont wanna bother with something called 'slots-cache-prod' continue ip = node[1] result = searchForOldLogs(ip) if type(result) is not list: print "Error getting logs from {}".format(ip) continue saveOldLogs(result, ip, activeVersions)
#!/usr/bin/env python2.7 """ Print the highest (current) active version for a given environment. """ import sys from get_active_versions import getActiveVersionsForEnvironment if __name__ == "__main__": env = "dev" app = "slots" if len(sys.argv) > 1: env = sys.argv[1] if len(sys.argv) > 2: app = sys.argv[2] versions = getActiveVersionsForEnvironment(env, app) print max(versions)