[Patchew-devel] [PATCH v2 1/2] deploy: Allow empty importer_identity

Fam Zheng famz at redhat.com
Wed Mar 21 03:18:57 UTC 2018


Copy task in the playbook and ssh command in the image will not work if
importer_identity is not specified.

Signed-off-by: Fam Zheng <famz at redhat.com>
---
 scripts/dockerfiles/importer.docker    | 6 +++++-
 scripts/playbooks/deploy-importers.yml | 1 +
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/scripts/dockerfiles/importer.docker b/scripts/dockerfiles/importer.docker
index 984f019..6dc530b 100644
--- a/scripts/dockerfiles/importer.docker
+++ b/scripts/dockerfiles/importer.docker
@@ -2,7 +2,11 @@ FROM fedora:latest
 RUN dnf install -y python offlineimap findutils git wget
 RUN git config --global user.email "importer at patchew.org"
 RUN git config --global user.name "Patchew Importer"
-RUN echo IdentityFile=/data/patchew/identity > ~/.ssh/config
+RUN if test -f /data/patchew/identify; then \
+        echo IdentityFile=/data/patchew/identity > ~/.ssh/config; \
+    else \
+        ssh-keygen -t rsa -q -C patchew-importer -f ~/.ssh/id_rsa; \
+    fi
 RUN echo StrictHostKeyChecking no >> ~/.ssh/config
 RUN echo UserKnownHostsFile=/dev/null >> ~/.ssh/config
 ENV LC_ALL en_US.UTF-8
diff --git a/scripts/playbooks/deploy-importers.yml b/scripts/playbooks/deploy-importers.yml
index 1a9d805..5e13dab 100644
--- a/scripts/playbooks/deploy-importers.yml
+++ b/scripts/playbooks/deploy-importers.yml
@@ -60,6 +60,7 @@
         dest: "{{ identity_file }}"
         validate: test -f %s
         mode: 0400
+      when: importer_identity != ""
     - name: Create config
       template:
         src: "templates/importer-config.j2"
-- 
2.14.3




More information about the Patchew-devel mailing list