diff options
author | Christophe Fergeau <cfergeau@redhat.com> | 2015-12-08 10:10:01 +0100 |
---|---|---|
committer | Christophe Fergeau <cfergeau@redhat.com> | 2017-05-05 11:01:34 +0200 |
commit | 86ffe4a11b115f6ed7e7ebdc6350f1ac719f7e73 (patch) | |
tree | 3d687a2a660fe19c6fa20842be05000245e3884d | |
parent | 5960b3fb88c960c4df86f1a8303cc8b8360d9902 (diff) |
ca file wip
-rw-r--r-- | examples/list-vms-async.c | 1 | ||||
-rw-r--r-- | examples/list-vms.c | 13 | ||||
-rw-r--r-- | govirt/ovirt-proxy.c | 4 |
3 files changed, 16 insertions, 2 deletions
diff --git a/examples/list-vms-async.c b/examples/list-vms-async.c index 57aefba..cbc2079 100644 --- a/examples/list-vms-async.c +++ b/examples/list-vms-async.c @@ -165,6 +165,7 @@ static void fetched_ca_cert_cb(GObject *source_object, } g_print("\tCA certificate: %p\n", ca_cert); g_byte_array_unref(ca_cert); + g_object_set(G_OBJECT(proxy), "admin", TRUE, "ssl-ca-file", "/home/teuf/redhat/virt/govirt/idm.spice.brq.redhat.com.crt", NULL); ovirt_proxy_fetch_api_async(proxy, NULL, api_fetched_cb, user_data); } diff --git a/examples/list-vms.c b/examples/list-vms.c index 6737c64..ef892cf 100644 --- a/examples/list-vms.c +++ b/examples/list-vms.c @@ -127,7 +127,18 @@ int main(int argc, char **argv) api = ovirt_proxy_fetch_api(proxy, &error); if (error != NULL) { g_debug("failed to lookup %s: %s", argv[2], error->message); - goto error; + if (g_error_matches(error, REST_PROXY_ERROR, REST_PROXY_ERROR_SSL)) { + g_warning("SSL Error while getting API, need to retry"); + g_object_set(proxy, "ssl-strict", FALSE, NULL); + g_clear_error(&error); + g_object_set(G_OBJECT(proxy), "admin", TRUE, NULL); + api = ovirt_proxy_fetch_api(proxy, &error); + if (error != NULL) { + goto error; + } + } else { + goto error; + } } g_assert(api != NULL); diff --git a/govirt/ovirt-proxy.c b/govirt/ovirt-proxy.c index 460805f..064ea25 100644 --- a/govirt/ovirt-proxy.c +++ b/govirt/ovirt-proxy.c @@ -179,7 +179,9 @@ RestXmlNode *ovirt_proxy_get_collection_xml(OvirtProxy *proxy, err->message); g_clear_error(&err); } else if (err != NULL) { - g_warning("Error while getting collection: %s", err->message); + if (g_error_matches(err, REST_PROXY_ERROR, REST_PROXY_ERROR_SSL)) { + g_warning("SSL Error while getting collection: %s %s %d", err->message, g_quark_to_string(err->domain), err->code); + } g_propagate_error(error, err); } else { g_warning("Error while getting collection"); |