Browse Source

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

pull/944/head
ibuler 7 years ago
parent
commit
01895bafc0
  1. 2
      apps/ops/models.py
  2. 2
      apps/ops/utils.py
  3. 4
      apps/terminal/signals_handler.py

2
apps/ops/models.py

@ -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):

2
apps/ops/utils.py

@ -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,

4
apps/terminal/signals_handler.py

@ -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, \

Loading…
Cancel
Save