def __init__(self, location, version):
self.location = location
self.version = version
+ self.application = version.application
@staticmethod
def parse(line):
"""Parses a line from the results of parallel-find.pl.
parser.add_option("--count-exists", dest="count_exists",
default=False, help="Count deployments that contain a file")
# There should be machine friendly output
- options, show_applications = parser.parse_args()
- if not show_applications: show_applications = applications.keys()
- show_applications = frozenset(show_applications)
+ options, show = parser.parse_args()
+ if not show: show = applications.keys()
+ show = frozenset(show)
vd = options.version_dir
try:
fi = fileinput.input([vd + "/" + f for f in os.listdir(vd)])
errors = 0
unrecognized = 0
processed = 0
+ # I really don't like this boolean
hanging = False # whether or not we last outputted a newline
if not options.quiet: print "Processing",
for line in fi:
except NoSuchApplication:
unrecognized += 1
continue
- if deploy.version.application.name not in show_applications: continue
+ if deploy.application.name + "-" + str(deploy.version.version) in show:
+ if hanging:
+ hanging = False
+ print
+ print "%s-%s deployment at %s" \
+ % (deploy.application.name, deploy.version.version, deploy.location)
+ elif deploy.application.name in show:
+ pass
+ else:
+ continue
deploy.count()
if options.count_exists:
r = deploy.count_exists(options.count_exists)
if hanging: print
print
for app in applications.values():
- if app.name not in show_applications: continue
+ if app.name not in show: continue
print app
print
print "With %d errors and %d unrecognized applications" % (errors, unrecognized)