diff --git a/lib/ansible/callbacks.py b/lib/ansible/callbacks.py index 57a7b292caf..1468b3d1b58 100644 --- a/lib/ansible/callbacks.py +++ b/lib/ansible/callbacks.py @@ -29,7 +29,14 @@ from ansible.color import stringc import logging if constants.DEFAULT_LOG_PATH != '': - logging.basicConfig(filename=constants.DEFAULT_LOG_PATH, level=logging.DEBUG, format='%(asctime)s %(name)s %(message)s') + path = constants.DEFAULT_LOG_PATH + + if (os.path.exists(path) and not os.access(path, os.W_OK)) or not os.access(os.path.dirname(path), os.W_OK): + sys.stderr.write("log file at %s is not writeable, aborting\n" % path) + sys.exit(1) + + + logging.basicConfig(filename=path, level=logging.DEBUG, format='%(asctime)s %(name)s %(message)s') mypid = str(os.getpid()) user = getpass.getuser() logger = logging.getLogger("p=%s u=%s | " % (mypid, user)) diff --git a/lib/ansible/utils/template.py b/lib/ansible/utils/template.py index cb0b56aeaea..7553d89695d 100644 --- a/lib/ansible/utils/template.py +++ b/lib/ansible/utils/template.py @@ -247,14 +247,14 @@ def _legacy_varFind(basedir, text, vars, lookup_fatal, depth, expand_lists): else: replacement = None - return {'replacement': replacement, 'start': start, 'end': end} + return dict(replacement=replacement, start=start, end=end) if is_complex: var_end -= 1 if text[var_end] != '}' or brace_level != 0: return None space = _legacy_varFindLimitSpace(basedir, vars, space, text[part_start:var_end], lookup_fatal, depth, expand_lists) - return {'replacement': space, 'start': start, 'end': end} + return dict(replacement=space, start=start, end=end) def legacy_varReplace(basedir, raw, vars, lookup_fatal=True, depth=0, expand_lists=False): ''' Perform variable replacement of $variables in string raw using vars dictionary '''