Skip to content
Permalink
Browse files

fix: reimplement quads-cli --date

closes: #235
Change-Id: I8e250c880823824d29c24123a7b9cd856154cb8c
  • Loading branch information
grafuls committed Jan 7, 2020
1 parent c2dc994 commit 1c1d748b45ecfffa4b4dd9653600d24d419a4f94
Showing with 21 additions and 1 deletion.
  1. +21 −1 bin/quads-cli
@@ -627,7 +627,27 @@ def main(_args):
logger.info(version["result"])
exit(0)

logger.info('No result received')
clouds = Cloud.objects()
hosts = Host.objects()
_date = datetime.now()
if _args.datearg:
_date = datetime.strptime(_args.datearg, '%Y-%m-%d %H:%M')
for cloud in clouds:
if cloud.name == "cloud01":
available = []
for host in hosts:
if Schedule.is_host_available(host=host.name, start=_date, end=_date):
available.append(host)
if available:
logger.info(f"{cloud.name}:")
for host in available:
logger.info(f" - {host.name}")
else:
schedules = Schedule.current_schedule(cloud=cloud, date=_date)
if schedules:
logger.info(f"{cloud.name}:")
for schedule in schedules:
logger.info(f" - {schedule.host.name}")

exit(0)

0 comments on commit 1c1d748

Please sign in to comment.
You can’t perform that action at this time.