Quick fix for https://fedorahosted.org/freeipa/ticket/6047

Note that it depends on mbasti's patch 552 (already acked) otherwise client-side vault commands would not be even visible in CLI.

--
Martin^3 Babinsky
From b2019ce4b1dbf16b52e43d89a3d113cd5d9efc93 Mon Sep 17 00:00:00 2001
From: Martin Babinsky <mbabi...@redhat.com>
Date: Tue, 12 Jul 2016 13:44:49 +0200
Subject: [PATCH] vault-add: set the default vault type on the client side if
 none was given

`vault-add` commands does much processing depending on the vault type even
before the request is forwarded to remote server. Since default values for
parameters are now filled only on server side, the client-side logic would
fail if the vault type was not explicitly given. In this case we have to
retrieve and use the default vault type from schema.

https://fedorahosted.org/freeipa/ticket/6047
---
 ipaclient/plugins/vault.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/ipaclient/plugins/vault.py b/ipaclient/plugins/vault.py
index 11210d6e1339f42598b39bcf599d3e6eacb5b9d8..b7e0cfffb2fff62fdbbf438964d124fc2dd8ac36 100644
--- a/ipaclient/plugins/vault.py
+++ b/ipaclient/plugins/vault.py
@@ -225,6 +225,11 @@ class vault_add(Local):
     def forward(self, *args, **options):
 
         vault_type = options.get('ipavaulttype')
+
+        if vault_type is None:
+            internal_cmd = self.api.Command.vault_add_internal
+            vault_type = internal_cmd.params.ipavaulttype.default
+
         password = options.get('password')
         password_file = options.get('password_file')
         public_key = options.get('ipavaultpublickey')
-- 
2.5.5

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to