From 51ccdc246726a6ecbf4a44f17b488aae533dd9f7 Mon Sep 17 00:00:00 2001
From: Giuseppe Scrivano <gscrivan@redhat.com>
Date: Tue, 10 Jan 2017 18:53:11 +0100
Subject: use etcdctl from the container when containerized=True

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
---
 playbooks/common/openshift-cluster/upgrades/etcd/backup.yml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'playbooks/common/openshift-cluster/upgrades')

diff --git a/playbooks/common/openshift-cluster/upgrades/etcd/backup.yml b/playbooks/common/openshift-cluster/upgrades/etcd/backup.yml
index b7f0267c1..727b24234 100644
--- a/playbooks/common/openshift-cluster/upgrades/etcd/backup.yml
+++ b/playbooks/common/openshift-cluster/upgrades/etcd/backup.yml
@@ -3,6 +3,7 @@
   vars:
     embedded_etcd: "{{ groups.oo_etcd_to_config | default([]) | length == 0 }}"
     timestamp: "{{ lookup('pipe', 'date +%Y%m%d%H%M%S') }}"
+    etcdctl_command: "{{ 'etcdctl' if not openshift.common.is_containerized or embedded_etcd else 'docker exec etcd_container etcdctl' }}"
   roles:
   - openshift_facts
   tasks:
@@ -47,7 +48,7 @@
 
   - name: Generate etcd backup
     command: >
-      etcdctl backup --data-dir={{ openshift.etcd.etcd_data_dir }}
+      {{ etcdctl_command }} backup --data-dir={{ openshift.etcd.etcd_data_dir }}
       --backup-dir={{ openshift.common.data_dir }}/etcd-backup-{{ backup_tag | default('') }}{{ timestamp }}
 
   - set_fact:
-- 
cgit v1.2.3