SSL connection multiplexing in Qpid
by Zane Bitter
Hi folks,
I'd like to sync up on what the plans are for this feature (QPID-3514).
I agree with Andrew's comments on the suitability of the current patch
to be carried forward in trunk. I wrote it with the constraint of not
wanting to break any exported interfaces, so that it could be applied to
the existing 0.12 release as a patch in Fedora 16.
If we are free to break as many of these interfaces as we like in 0.14,
I broadly agree with Andrew's approach. I am happy to start working on
an implementation of this if it would help in getting the feature
established for the long term. Andrew, would that be useful or would I
be duplicating work/potentially stepping on toes by doing so?
Notwithstanding that, from the Matahari perspective we would still like
to see the current patch applied to 0.12 in F16. There is no IPv6
support in 0.12 to break, so the only real issue is doing protocol
detection in the accept() thread, which can limit the rate at which new
connections can be established. In my opinion this is justifiable
because there is no change to existing behaviour unless the ssl-port is
explicitly set to the same value as the TCP port, so existing
configurations will not be affected (since this doesn't work at present).
So to summarise the proposal:
1) Add the existing patch to Fedora
2) Redesign the feature for 0.14 in a way that will make AMQP-1.0
implementation easier instead of harder
How would y'all feel about this plan? What is the next step to start
pushing this stuff forward?
thanks,
Zane.
12 years, 7 months
Re: Virt installer w/ vios-proxy
by Cole Robinson
> Hi Cole,
>
> Just wanted to make you aware of
> https://github.com/matahari/matahari/wiki/Vios-Proxy where we are in a
> proof of concept stage at the moment.
>
> Our goal is to make vios-proxy integration as simple as possible and I
> was told you may be doing some work on the virt-install code to add
> support for these devices?
>
> Would like to get your input or see if you need any help with getting
> this rolling within the installer for virtual machines.
>
> Thanks!
(sorry for breaking threading, couldn't find the original mail in my inbox to
reply to)
Some info about this can be found here:
https://bugzilla.redhat.com/show_bug.cgi?id=674658 . Sorry if the following is
old news to yall but just want to make sure we are on the same page.
For virt-install/virt-manager to setup a virtio-serial device that will work
out of the box with vios proxy, we need 2 things. First is a known port name
which vios proxy will look for in the guest, something like
org.matahariproject.vios_proxy.0 or similar. Then you can use udev rules
inside the guest to have the agent+proxy startup automatically if you see the
magic virtio port name.
The second piece is how the host machine communicates with the guest. This
should probably be a unix socket stored in /var/lib/libvirt/qemu as
recommended by danpb in https://bugzilla.redhat.com/show_bug.cgi?id=674658#c11
. Putting the socket in that location ensures it gets proper permissions and
selinux labeling to work with libvirt.
What's your plan for automating the host side vios-proxy setup? Maybe we can
have libvirt launch vios-proxy-guest if it sees the appropriate port name in
the guest XML. Presumably libvirt will be talking directly to matahari in the
future anyway so it's not that much of a stretch to have it do the proxy setup.
Might also be a good idea to update your docs with an example of how to setup
matahari+vios-proxy with an existing libvirt guest.
Thanks,
Cole
12 years, 7 months
[PATCH] Core: Enable SSL support in agents
by Zane Bitter
---
matahari-broker.sysconf.in | 5 ++
matahari.init.in | 3 +
matahari.spec.in | 1
matahari.sysconf.in | 12 +++--
src/CMakeLists.txt | 9 ++++
src/broker/broker.c | 13 ++++-
src/broker/broker_federation.c | 9 +++-
src/lib/mh_agent.cpp | 102 +++++++++++++++++++++++-----------------
8 files changed, 100 insertions(+), 54 deletions(-)
diff --git a/matahari-broker.sysconf.in b/matahari-broker.sysconf.in
index 4d3cf12..cd3d942 100644
--- a/matahari-broker.sysconf.in
+++ b/matahari-broker.sysconf.in
@@ -7,8 +7,11 @@ QPIDD_OPTIONS="--config @sysconfdir(a)/matahari-broker.conf"
# The following formats are allowed:
# Hostname and port
# <fqdn>:<port>
-# DNS SRV query format ("_matahari._tcp" is REQUIRED)
+# amqp:tcp:<fqdn>:<port>
+# amqp:ssl:<fqdn>:<port>
+# DNS SRV query format ("_matahari._<protocol>" is REQUIRED)
# _matahari._tcp.<fqdn>
+# _matahari._tls.<fqdn>
#
# Note that only the first (highest priority) SRV record returned by the DNS
# for each given query will be used.
diff --git a/matahari.init.in b/matahari.init.in
index 323ad89..ba9df14 100644
--- a/matahari.init.in
+++ b/matahari.init.in
@@ -47,6 +47,9 @@ start() {
fi
+ export QPID_SSL_CERT_DB
+ export QPID_SSL_CERT_PASSWORD_FILE
+
daemon $PROCESS $MATAHARI_ARGS --daemon
RETVAL=$?
echo
diff --git a/matahari.spec.in b/matahari.spec.in
index cabc6ba..74e9f1d 100644
--- a/matahari.spec.in
+++ b/matahari.spec.in
@@ -53,6 +53,7 @@ BuildRequires: pcre-devel
BuildRequires: glib2-devel
BuildRequires: sigar-devel
BuildRequires: libcurl-devel
+BuildRequires: nss-devel
BuildRequires: help2man
BuildRequires: augeas-devel >= 0.9.0
diff --git a/matahari.sysconf.in b/matahari.sysconf.in
index edd0065..e84e0cc 100644
--- a/matahari.sysconf.in
+++ b/matahari.sysconf.in
@@ -9,12 +9,16 @@ MATAHARI_BROKER=@MATAHARI_BROKER@
# Other options that all agents should observe
MATAHARI_AGENT_ARGS="--reconnect=yes"
+# SSL client options
+#QPID_SSL_CERT_DB=
+#QPID_SSL_CERT_PASSWORD_FILE=
+
# Other options that all consoles should observe
-# MATAHARI_CONSOLE_ARGS=...
+#MATAHARI_CONSOLE_ARGS=
# Per agent options
-# host_AGENT_ARGS=...
-# network_AGENT_ARGS=...
+#host_AGENT_ARGS=
+#network_AGENT_ARGS=
# Per console options
-# sysconfig_CONSOLE_ARGS=...
+#sysconfig_CONSOLE_ARGS=
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index bcc2ca5..b9f546f 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -10,6 +10,15 @@ if(WIN32)
else(WIN32)
set(VARIANT "linux")
+
+ # Enable TLS/SSL support
+ add_definitions(-DMH_SSL)
+ execute_process(COMMAND nss-config --includedir
+ OUTPUT_VARIABLE NSS_INCLUDE)
+ execute_process(COMMAND nspr-config --includedir
+ OUTPUT_VARIABLE NSPR_INCLUDE)
+ include_directories(${NSS_INCLUDE} ${NSPR_INCLUDE})
+
# DBus makes sense only on linux
# WITH-DBUS == OFF means no DBus,
# TRY means autodetection
diff --git a/src/broker/broker.c b/src/broker/broker.c
index c443266..58d0ee6 100644
--- a/src/broker/broker.c
+++ b/src/broker/broker.c
@@ -69,8 +69,8 @@ static void broker_args_free(char **args)
static char **broker_args(int argc, char * const argv[])
{
int i = 0, o = 0;
- char portarg[13];
- char **newargs = malloc(sizeof(char *) * (argc + 2 + 1));
+ char port[6];
+ char **newargs = malloc(sizeof(char *) * (argc + 3 + 1));
if (!newargs) {
mh_err("Failed to allocate argument list");
@@ -81,10 +81,15 @@ static char **broker_args(int argc, char * const argv[])
APPEND_ARG(newargs, o, argv[i++]);
}
- snprintf(portarg, sizeof(portarg), "--port=%hu", broker_get_port());
- APPEND_ARG(newargs, o, portarg);
+ // Note: always ensure there is enough space allocated for extra args
+ snprintf(port, sizeof(port), "%hu", broker_get_port());
+ APPEND_ARG(newargs, o, "--port");
+ APPEND_ARG(newargs, o, port);
APPEND_ARG(newargs, o, "--data-dir=" LOCAL_STATE_DIR "/lib/matahari");
+ // Make the SSL port the same by default
+ setenv("QPID_SSL_PORT", port, 0);
+
while (i < argc) {
APPEND_ARG(newargs, o, argv[i++]);
}
diff --git a/src/broker/broker_federation.c b/src/broker/broker_federation.c
index f4d09bb..e775d3e 100644
--- a/src/broker/broker_federation.c
+++ b/src/broker/broker_federation.c
@@ -31,7 +31,12 @@
#include "broker_federation.h"
-#define DNS_SRV_PREFIX "_matahari._tcp."
+#define DNS_SRV_PREFIX_TCP "_matahari._tcp."
+#define DNS_SRV_PREFIX_TLS "_matahari._tls."
+
+#define IS_DNS_SRV(ADDR, TYPE) (strncmp(ADDR, \
+ DNS_SRV_PREFIX_##TYPE, \
+ strlen(DNS_SRV_PREFIX_##TYPE)) == 0)
#define ROUTE_LIST(LOCAL, REMOTE) { \
{REMOTE, LOCAL, "amq.direct"}, \
@@ -102,7 +107,7 @@ void broker_federation_configure(void)
mh_string_copy(peers, brokers, sizeof(peers));
while ((peer = strtok_r(p ? NULL : peers, ",; ", &p)) != NULL) {
- if (strncmp(peer, DNS_SRV_PREFIX, strlen(DNS_SRV_PREFIX)) == 0) {
+ if (IS_DNS_SRV(peer, TCP) || IS_DNS_SRV(peer, TLS)) {
peer = broker_lookup(peer);
}
diff --git a/src/lib/mh_agent.cpp b/src/lib/mh_agent.cpp
index 5aee0a9..71ab8a6 100644
--- a/src/lib/mh_agent.cpp
+++ b/src/lib/mh_agent.cpp
@@ -37,7 +37,6 @@
#include <qpid/sys/Time.h>
#include <qpid/agent/ManagementAgent.h>
#include <qpid/client/ConnectionSettings.h>
-// #include <qpid/sys/ssl/util.h>
#include <qmf/DataAddr.h>
#include "matahari/agent.h"
@@ -50,6 +49,9 @@ extern "C" {
#include <sys/socket.h>
#include <netdb.h>
#endif
+#ifdef MH_SSL
+#include <secmod.h>
+#endif
}
using namespace qpid::management;
@@ -175,7 +177,8 @@ map_option(int code, const char *name, const char *arg, void *userdata)
(*options)["servername"] = arg;
} else if(strcmp(name, "port") == 0) {
- (*options)["serverport"] = atoi(arg);
+ uint16_t port = atoi(arg);
+ (*options)["serverport"] = port;
} else if(strcmp(name, "dns-srv") == 0) {
(*options)["dns-srv"] = 1;
@@ -186,35 +189,6 @@ map_option(int code, const char *name, const char *arg, void *userdata)
return 0;
}
-#ifdef MH_SSL
-static int
-ssl_option(int code, const char *name, const char *arg, void *userdata)
-{
- qpid::sys::ssl::SslOptions *options = static_cast<qpid::sys::ssl::SslOptions*>(userdata);
-
- if(strcmp(name, "ssl-cert-db") == 0) {
- options->certDbPath = strdup(arg);
- setenv("QPID_SSL_CERT_DB", arg, 1);
- if (!g_file_test(arg, G_FILE_TEST_IS_DIR)) {
- fprintf(stderr, "SSL Certificate database is not accessible. See --help\n");
- exit(1);
- }
-
- } else if(strcmp(name, "ssl-cert-name") == 0) {
- options->certName = strdup(arg);
-
- } else if(strcmp(name, "ssl-cert-password-file") == 0) {
- options->certPasswordFile = strdup(arg);
- setenv("QPID_SSL_CERT_PASSWORD_FILE", arg, 1);
- if (!g_file_test(arg, G_FILE_TEST_EXISTS)) {
- fprintf(stderr, "SSL Password file is not accessible. See --help.\n");
- exit(1);
- }
- }
- return 0;
-}
-#endif /* MH_SSL */
-
static int
connection_option(int code, const char *name, const char *arg, void *userdata)
{
@@ -228,7 +202,11 @@ connection_option(int code, const char *name, const char *arg, void *userdata)
strcasecmp(arg, "false") != 0);
(*options)["reconnect"] = reconnect;
} else {
- (*options)[name] = arg;
+ if (arg) {
+ (*options)[name] = arg;
+ } else {
+ (*options)[name] = true;
+ }
}
return 0;
}
@@ -313,10 +291,12 @@ mh_connect(OptionsMap mh_options, OptionsMap amqp_options, int retry)
std::stringstream query;
+ query << "_matahari.";
+ query << ((mh_options["protocol"]) == "ssl" ? "_tls" : "_tcp") << ".";
if (mh_options.count("servername")) {
- query << "_matahari._tcp." << mh_options["servername"];
+ query << mh_options["servername"];
} else {
- query << "_matahari._tcp." << mh_dnsdomainname();
+ query << mh_dnsdomainname();
}
if ((cur_srv_record = srv_records = mh_dnssrv_lookup(query.str().c_str()))) {
@@ -394,6 +374,7 @@ read_environment(OptionsMap& options)
if (!mh_strlen_zero(data)) {
options["serverport"] = data;
}
+
data = getenv("KRB5_KEYTAB");
if (!mh_strlen_zero(data)) {
options["krb5_keytab"] = data;
@@ -407,6 +388,27 @@ read_environment(OptionsMap& options)
} else {
options["krb5_interval"] = "10";
}
+
+#ifdef MH_SSL
+ data = getenv("QPID_SSL_CERT_DB");
+ if (!mh_strlen_zero(data)) {
+ options["ssl-cert-db"] = data;
+ if (!g_file_test(data, G_FILE_TEST_IS_DIR)) {
+ mh_crit("SSL Certificate database is not accessible. See --help");
+ exit(1);
+ }
+ }
+
+ data = getenv("QPID_SSL_CERT_NAME");
+ if (!mh_strlen_zero(data)) {
+ options["ssl-cert-name"] = data;
+ }
+
+ data = getenv("QPID_SSL_CERT_PASSWORD_FILE");
+ if (!mh_strlen_zero(data)) {
+ options["ssl-cert-password-file"] = data;
+ }
+#endif /* MH_SSL */
}
static void
@@ -456,10 +458,8 @@ mh_parse_options(const char *proc_name, int argc, char **argv, OptionsMap &optio
mh_add_option('r', required_argument, "reconnect", "attempt to reconnect if the broker connection is lost", &amqp_options, connection_option);
#ifdef MH_SSL
- qpid::sys::ssl::SslOptions ssl_options;
- mh_add_option('n', required_argument, "ssl-cert-name", "name of the certificate to use", &ssl_options, ssl_option);
- mh_add_option('C', required_argument, "ssl-cert-db", "file containing the certificate database", &ssl_options, ssl_option);
- mh_add_option('f', required_argument, "ssl-cert-password-file", "file containing the certificate password", &ssl_options, ssl_option);
+ mh_add_option('n', required_argument, "ssl-cert-name", "name of the certificate to use", &amqp_options, connection_option);
+ mh_add_option('t', no_argument, "require-tls", "Require TLS/SSL encryption", &options, connection_option);
#endif
#ifdef WIN32
@@ -540,13 +540,24 @@ mh_parse_options(const char *proc_name, int argc, char **argv, OptionsMap &optio
#endif
#ifdef MH_SSL
- if (ssl_options.certDbPath && ssl_options.certName && ssl_options.certPasswordFile) {
+ bool have_cert_db = options.count("ssl-cert-db");
+ bool have_cert_pw = options.count("ssl-cert-password-file");
+ bool have_cert_name = amqp_options.count("ssl-cert-name") ||
+ options.count("ssl-cert-name");
+ bool force_tls = options.count("require-tls");
+
+ if (have_cert_db || force_tls) {
options["protocol"] = "ssl";
- qpid::sys::ssl::initNSS(ssl_options, true);
- } else if (ssl_options.certDbPath || ssl_options.certName || ssl_options.certPasswordFile) {
- fprintf(stderr, "To enable SSL, you must supply a cert name, db and password file. See --help.\n");
- exit(1);
+ if (!have_cert_db) {
+ mh_warn("To enable SSL, you must supply a certificate database");
+ }
+ if (!have_cert_pw) {
+ mh_warn("To enable SSL, you must supply a certificate password file");
+ }
+ if (!have_cert_name) {
+ mh_warn("No SSL certificate name specified");
+ }
}
#endif
@@ -584,6 +595,11 @@ mh_should_daemonize(int code, const char *name, const char *arg, void *userdata)
// Don't attempt to log to the console
mh_enable_stderr(false);
+
+#ifdef MH_SSL
+ // NSS doesn't like being forked.
+ SECMOD_RestartModules(PR_FALSE);
+#endif
#endif
return 0;
12 years, 7 months
Summary of vios proxy addition
by Adam Stokes
In order to provide a way for qemu hosts to talk to qemu guests
without a network connection we need to use vios proxy. There are
a few things involved with setting up vios proxy both host and guests.
This addition gives the administrator the ability to configure the proxy guest
and host from a known configuration file to matahari. Also eliminates all setup
steps up to the point of virtio serial device creation (which will be handled by
virt-install and friends).
As usual this patch is open for discussions and dissecting and am looking forward
to hearing anyones thoughts.
12 years, 7 months
[PATCH] Core: Log to console iff it is possible
by Zane Bitter
The previous logic about when to log to stderr vs. syslog didn't make a
whole lot of sense. Instead, log to the console if possible (i.e. stderr is
a tty); otherwise log to syslog.
Signed-off-by: Zane Bitter <zbitter(a)redhat.com>
---
src/lib/mh_agent.cpp | 21 ++++++++++++++++-----
1 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/src/lib/mh_agent.cpp b/src/lib/mh_agent.cpp
index 6968637..5aee0a9 100644
--- a/src/lib/mh_agent.cpp
+++ b/src/lib/mh_agent.cpp
@@ -20,9 +20,6 @@
#ifdef WIN32
#include <windows.h>
-int use_stderr = 1;
-#else
-int use_stderr = 0;
#endif
#include <iostream>
@@ -584,7 +581,11 @@ mh_should_daemonize(int code, const char *name, const char *arg, void *userdata)
fprintf(stderr, "Error daemonizing: %s\n", strerror(errno));
exit(1);
}
+
+ // Don't attempt to log to the console
+ mh_enable_stderr(false);
#endif
+
return 0;
}
@@ -603,6 +604,16 @@ qmf::AgentSession& MatahariAgent::getSession(void)
return _impl->_agent_session;
}
+static bool
+mh_hastty(void)
+{
+#ifdef WIN32
+ return true;
+#else
+ return isatty(STDERR_FILENO);
+#endif
+}
+
int
MatahariAgent::init(int argc, char **argv, const char* proc_name)
{
@@ -612,14 +623,14 @@ MatahariAgent::init(int argc, char **argv, const char* proc_name)
logname << "matahari-" << proc_name;
/* Set up basic logging */
- mh_log_init(proc_name, mh_log_level, FALSE);
+ mh_log_init(proc_name, mh_log_level, mh_hastty());
mh_add_option('d', no_argument, "daemon", "run as a daemon", NULL, mh_should_daemonize);
OptionsMap amqp_options = mh_parse_options(proc_name, argc, argv, options);
/* Re-initialize logging now that we've completed option processing */
- mh_log_init(strdup(logname.str().c_str()), mh_log_level, mh_log_level > LOG_INFO);
+ mh_log_init(strdup(logname.str().c_str()), mh_log_level, mh_hastty());
// Set up the cleanup handler for sigint
signal(SIGINT, shutdown);
12 years, 7 months
Re: [Matahari] broker federation wiki
by Perry Myers
taking to upstream list
On 10/06/2011 10:39 AM, Adam Stokes wrote:
> Hi Ted,
>
> I've done some initial work on this push-route federation and so far
> this is what ive come up with
>
> Bare Metal host:
> - vios-proxy-host:49000
> - matahari-broker:49000
>
> Guest 1 VM:
> - vios-proxy-guest:48999
> - matahari-broker:49000
> - matahari-host-agent:49000
>
> Next I add my queues?
>
> qpid-route -s queue add localhost:48999 localhost:49000 amq.fanout
> public
>
> Attempt to see the queues through:
>
> qpid-config -a localhost:48999 queues
>
> I can see the queues from both the Guest and Host, however, when running
>
> qpid-route route list localhost:49000
>
> qpid-route never responds and I have to kill the program.
>
> My main question is am I taking the correct apprach so far?
>
> Thanks
> Adam
12 years, 7 months
Thoughts on testing
by Russell Bryant
Greetings,
I've been doing some work on our autobuild setup. I'm about done with
what I was going to do right now so here are some thoughts about the
state of things before I move on to something else.
The Matahari Project has been running an autobuild instance for a good
while. You can find the latest autobuild results here:
http://et3.redhat.com/hosted/matahari-rawhide/
If you look in the matahari source, the top level directory has a
script, autobuild.sh. This is what is run by autobuild. It uses mock
to do builds of both matahari and mingw32-matahari RPMs. There has
recently been some expansion to what autobuild covers:
1) The C API unit tests are now run.
2) Dave Johnson submitted a suite of tests that exercise the QMF APIs.
(Thanks, Dave!) I have put some work into making them compatible with
running inside of mock.
There are fairly extensive tests written against the Host and Sysconfig
QMF APIs that run in autobuild. It runs some scaled down tests (ensure
the agent starts, connects to a broker, and we can retrieve a property)
for the Resources, Services, and Network QMF APIs.
Potential future improvements for the backlog:
1) Resources, Services, Network QMF APIs
We have code that exercises these APIs more than what is being done in
autobuild at the moment. These APIs perform operations that aren't
really compatible with running inside of mock, so we'll have to explore
a different approach on enabling automated extensive tests of these APIs
(such as spinning up a VM).
2) Windows runtime tests
We do automated Windows builds, but we don't run them. It would be good
to eventually spin up a Windows VM, install everything and run it there,
too.
3) Code coverage
It would be nice to have an idea of the code coverage from these tests.
I've used lcov [1] before and it worked quite well. I think we should
integrate it at some point.
4) D-bus tests
We've got a number of tests running against the QMF APIs, but it would
be good to add tests that exercise the APIs over D-bus, as well.
Thanks,
[1] http://ltp.sourceforge.net/coverage/lcov.php
--
Russell Bryant
12 years, 7 months
[PATCH 0/4] Add resources/services/network QMF API tests to autobuild
by Russell Bryant
Greetings,
This set of patches adds tests for the rest of the QMF APIs to autobuild.
The catch is that these tests are minimal compared to what is being done
for Host and Sysconfig. The more extensive tests for these agents aren't
really compatible with running in mock.
[PATCH 1/4] tests: Make Resources QMF API tests mock compatible.
[PATCH 2/4] tests: add minimal Network QMF API test.
[PATCH 3/4] tests: Add minimal Services QMF API test.
[PATCH 4/4] tests: add resources/services/network tests to
autobuild.sh | 12 +++++
src/tests/deps.sh | 2
src/tests/test_network_api_minimal.py | 73 ++++++++++++++++++++++++++++++++++
src/tests/test_resource_api.py | 19 ++++++--
src/tests/test_service_api_minimal.py | 73 ++++++++++++++++++++++++++++++++++
5 files changed, 172 insertions(+), 7 deletions(-)
Thanks,
--
Russell Bryant
12 years, 7 months
[PATCH 0/2] Add sysconfig QMF API tests to autobuild
by Russell Bryant
Greetings,
These patches get the sysconfig QMF API tests running in autobuild.
[PATCH 1/2] tests: make sysconfig tests more mock compatible.
[PATCH 2/2] tests: Run sysconfig QMF API tests from autobuild.
autobuild.sh | 4 +
src/tests/matahariTest.py | 2
src/tests/test_sysconfig_api.py | 83 ++++++++++++++++++++++++++++++----------
3 files changed, 69 insertions(+), 20 deletions(-)
Thanks,
--
Russell Bryant
12 years, 7 months
[PATCH] tests: Don't blow up of query returns no results.
by Russell Bryant
This addresses the failure seen in the last autobuild run.
Signed-off-by: Russell Bryant <rbryant(a)redhat.com>
---
src/tests/matahariTest.py | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/src/tests/matahariTest.py b/src/tests/matahariTest.py
index 4396703..1a342ba 100644
--- a/src/tests/matahariTest.py
+++ b/src/tests/matahariTest.py
@@ -54,7 +54,9 @@ def findAgent(session,agentKeyWord,agentClass,hostname):
for agent in agents:
if agentKeyWord in str(agent):
if agent.getAttributes().get('hostname') == hostname:
- return agent.query("{class:"+agentClass+",package:'org.matahariproject'}")[0]
+ objs = agent.query("{class:"+agentClass+",package:'org.matahariproject'}")
+ if objs and len(objs):
+ return objs[0]
time.sleep(1)
loop_count = loop_count + 1
sys.exit("specific " + agentKeyWord + " agent for " + hostname + " not found.")
--
1.7.6.4
12 years, 7 months