On Mon, Apr 11, 2011 at 10:15 PM, Russell Bryant
<russell(a)russellbryant.net> wrote:
On Mon, Apr 11, 2011 at 3:27 PM, <astokes(a)fedoraproject.org>
wrote:
> while (true) {
> if(_console_session.getAgentCount() > 0) {
> agent = _console_session.getAgent(0);
> - qmf::ConsoleEvent result(agent.query("{class:Console,
package:'org.matahariproject', where:[eq, hostname, [quote,
supa.kooba]]}"));
> + qmf::ConsoleEvent result(agent.query("{class:Console,
package:'org.matahariproject', where:[eq, uuid, [quote," +
_instance.getProperty("uuid").asString() +"]]}"));
Is this string ever going to be different? If not, you could build it
once outside of the loop instead of doing it over and over again.
TMK it should not be different, so we can move this outside the loop.
> if(result.getType() == qmf::CONSOLE_QUERY_RESPONSE) {
> - _instance.setProperty("status", "Received console
event");
> - break;
> + if(result.getDataCount() == 1) {
> + cached_config = result.getData(0);
> + _instance.setProperty("status", "Read console
event for " + _instance.getProperty("hostname").asString());
> + break;
> + }
> }
> }
> qpid::sys::sleep(1);
> @@ -84,6 +91,13 @@ gboolean
> ConsoleAgent::invoke(qmf::AgentSession session, qmf::AgentEvent event, gpointer
user_data)
> {
> if(event.getType() == qmf::AGENT_METHOD) {
> - //const std::string& methodName(event.getMethodName());
> + const std::string& methodName(event.getMethodName());
> + if(methodName == "update") {
> + _instance.setProperty("status", "update method
sent");
> + }
> + goto bail;
Do you really want to unconditionally always "goto bail" here and skip
session.methodSuccess()? I'm guessing the goto should be in an else
block.
You are correct, but, this code is not feature complete and im just
posting working/compiled code as i go for progress :)
> }
> + session.methodSuccess(event);
> +bail:
> + return TRUE;
> }
> diff --git a/src/schema.xml b/src/schema.xml
> index 75c008b..3c8de7b 100644
> --- a/src/schema.xml
> +++ b/src/schema.xml
> @@ -5,6 +5,7 @@
> <!-- Common -->
> <arg name="timestamp" type="absTime" />
> <arg name="sequence" type="uint32" />
> + <arg name="uuid" type="sstr" />
>
> <!-- Services API -->
> <arg name="name" type="sstr" />
> --
> 1.7.4
>
> _______________________________________________
> Matahari mailing list
> Matahari(a)lists.fedorahosted.org
>
https://fedorahosted.org/mailman/listinfo/matahari
>