summaryrefslogtreecommitdiffstats
path: root/func/ansible_api.py
diff options
context:
space:
mode:
authorSerenaFeng <feng.xiaowei@zte.com.cn>2016-09-20 13:58:21 +0800
committerSerenaFeng <feng.xiaowei@zte.com.cn>2016-09-21 15:02:44 +0800
commit6183cefebbc1af8ad1987dc61372d6c2d6a59f6d (patch)
treed2300ba196eb5e61fd2366a44e29f018791ad961 /func/ansible_api.py
parentfac2a3bff97efed6d4e50bfe249c8107100b8f52 (diff)
add unified logger process for qtip
log the output information to both file and console, and unify the log file path and level JIRA: QTIP-108 Change-Id: I3a881e9da1f74c6959250a94f05cf90a231c34e6 Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
Diffstat (limited to 'func/ansible_api.py')
-rw-r--r--func/ansible_api.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/func/ansible_api.py b/func/ansible_api.py
index 57224eb7..2f02a62e 100644
--- a/func/ansible_api.py
+++ b/func/ansible_api.py
@@ -8,12 +8,15 @@
##############################################################################
import os
from collections import namedtuple
-import logging
+from ansible.executor.playbook_executor import PlaybookExecutor
+from ansible.inventory import Inventory
from ansible.parsing.dataloader import DataLoader
from ansible.vars import VariableManager
-from ansible.inventory import Inventory
-from ansible.executor.playbook_executor import PlaybookExecutor
+
+from utils import logger_utils
+
+logger = logger_utils.QtipLogger('ansible_api').get
class AnsibleApi:
@@ -26,7 +29,7 @@ class AnsibleApi:
def _check_path(self, file_path):
if not os.path.exists(file_path):
- logging.error('The playbook %s does not exist' % file_path)
+ logger.error('The playbook %s does not exist' % file_path)
return False
else:
return True