Skip to content

Commit

Permalink
feat: added date arg for move-hosts dry-run
Browse files Browse the repository at this point in the history
closes: #299
Change-Id: I2b61bb2377ca2fdcca0b27aa8d0f0749b3481ec4
  • Loading branch information
grafuls committed Nov 29, 2019
1 parent 86acf15 commit 2f5c19b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions quads/api_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ def _get_obj(self, obj):

@cherrypy.expose
class MovesMethodHandler(MethodHandlerBase):
def GET(self):
def GET(self, **data):
date = datetime.datetime.now()
if "date" in data:
date = datetime.datetime.strptime(data["date"], "%Y-%m-%dt%H:%M:%S")

if self.name == "moves":
try:
_hosts = model.Host.objects()
Expand All @@ -42,7 +46,7 @@ def GET(self):

_scheduled_cloud = _host.default_cloud.name
_host_defined_cloud = _host.cloud.name
_current_schedule = self.model.current_schedule(host=_host).first()
_current_schedule = self.model.current_schedule(host=_host, date=date).first()
try:
if _current_schedule:
_scheduled_cloud = _current_schedule.cloud.name
Expand Down

0 comments on commit 2f5c19b

Please sign in to comment.