def status(self, **kwargs): table = PrettyTable(["Service", "Status"]) for service in self.project.services: table.add_row((service.name, format_service_status(service))) print(table)
def list_apps(self, **kwargs): table = PrettyTable(["App", "Version", "State"]) if os.path.exists(self._get_git_dir()): last_app = None for app in os.listdir(self._get_git_dir()): app_dir = self._get_deployment_dir() + '/' + app if os.path.exists(app_dir): versions = os.listdir(app_dir) if len(versions): for version in versions: try: project = self.get_deployment(app, version).project status = {} for service in project.get_services(): status[service.name] = format_service_status(service) app_status = '' for service, st in status.items(): app_status += '%s=%s ' % (service, st) table.add_row(('' if last_app == app else app, version, app_status)) last_app = app except IOError: print('Application %s : %s has no config.yml. Wrong branch deployed?' % (app, version)) else: table.add_row((app, '-', 'NOT DEPLOYED')) else: table.add_row((app, '-', 'NOT DEPLOYED')) print(table)