[Bugfix] task运行失败,因为tasks没有设置

pull/944/head
ibuler 2018-01-16 11:40:18 +08:00
parent f1ec53d1bc
commit 01895bafc0
3 changed files with 3 additions and 5 deletions

View File

@ -165,7 +165,7 @@ class AdHoc(models.Model):
if item and isinstance(item, list):
self._tasks = json.dumps(item)
else:
raise SyntaxError('Tasks should be a list')
raise SyntaxError('Tasks should be a list: {}'.format(item))
@property
def hosts(self):

View File

@ -16,6 +16,8 @@ def update_or_create_ansible_task(
run_as_admin=False, run_as="", become_info=None,
created_by=None,
):
if not hosts or not tasks or not task_name:
return
defaults = {
'name': task_name,

View File

@ -13,10 +13,6 @@ RUNNING = False
logger = get_logger(__file__)
@shared_task
@register_as_period_task(interval=3600)
@after_app_ready_start
@after_app_shutdown_clean
def set_session_info_cache():
logger.debug("")
from .utils import get_session_asset_list, get_session_user_list, \