From b92d697db1ae22f46d52f557f422706a6b1b5ab3 Mon Sep 17 00:00:00 2001 From: Romain Dessort Date: Thu, 15 Mar 2018 11:18:04 -0400 Subject: [PATCH] Make commit tasks work on squeeze On squeeze machines, the task fetching the user.email variable fails and therefore git_config_user_email.config_value ansible variable is undefined in the next task. I added a condition to handle this case. --- etc-git/tasks/commit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc-git/tasks/commit.yml b/etc-git/tasks/commit.yml index 8c4fb539..3843d66a 100644 --- a/etc-git/tasks/commit.yml +++ b/etc-git/tasks/commit.yml @@ -26,7 +26,7 @@ - name: "set commit author" set_fact: commit_author: '{% if ansible_env.SUDO_USER is not defined %}root{% else %}{{ ansible_env.SUDO_USER }}{% endif %}' - commit_email: '{% if git_config_user_email.config_value == "" %}root@localhost{% else %}{{ git_config_user_email.config_value }}{% endif %}' + commit_email: '{% if git_config_user_email.config_value is not defined or git_config_user_email.config_value == "" %}root@localhost{% else %}{{ git_config_user_email.config_value }}{% endif %}' - name: "/etc modifications are committed" shell: "git add -A . && git commit -m \"{{ commit_message | mandatory }}\" --author \"{{ commit_author | mandatory }} <{{ commit_email | mandatory }}>\""