403b09
From 5754f00a924bd74079fbf8dc386437ef671547b0 Mon Sep 17 00:00:00 2001
403b09
From: Martin Babinsky <mbabinsk@redhat.com>
403b09
Date: Tue, 12 Jul 2016 13:44:49 +0200
403b09
Subject: [PATCH] vault-add: set the default vault type on the client side if
403b09
 none was given
403b09
403b09
`vault-add` commands does much processing depending on the vault type even
403b09
before the request is forwarded to remote server. Since default values for
403b09
parameters are now filled only on server side, the client-side logic would
403b09
fail if the vault type was not explicitly given. In this case we have to
403b09
retrieve and use the default vault type from schema.
403b09
403b09
https://fedorahosted.org/freeipa/ticket/6047
403b09
403b09
Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
403b09
---
403b09
 ipaclient/plugins/vault.py | 5 +++++
403b09
 1 file changed, 5 insertions(+)
403b09
403b09
diff --git a/ipaclient/plugins/vault.py b/ipaclient/plugins/vault.py
403b09
index bf0242fc4290bb94f29faf9c787dd7454a8921bf..a3ce6fecbfd38b342f826d8d27940d991d821e90 100644
403b09
--- a/ipaclient/plugins/vault.py
403b09
+++ b/ipaclient/plugins/vault.py
403b09
@@ -221,6 +221,11 @@ class vault_add(Local):
403b09
     def forward(self, *args, **options):
403b09
 
403b09
         vault_type = options.get('ipavaulttype')
403b09
+
403b09
+        if vault_type is None:
403b09
+            internal_cmd = self.api.Command.vault_add_internal
403b09
+            vault_type = internal_cmd.params.ipavaulttype.default
403b09
+
403b09
         password = options.get('password')
403b09
         password_file = options.get('password_file')
403b09
         public_key = options.get('ipavaultpublickey')
403b09
-- 
403b09
2.4.3
403b09