The problem is with the Helios::Config->getParam() method. Helios::Config caches the config hash that results from a parseConfig() call to reduce database queries and maximize performance. The getParam() method checks this hash for the requested parameter and returns its value if it is present.
In this case, however, the user is asking not for the parameter set for this host, but for another host (in the example, actually the special '*' all hosts value). The getParam() code that checks the cached config hash does not take into account the requested host is different than the current host, and incorrectly returns the cached value instead of querying the database for the correct value.
The offending code is this section of getParam():
# shortcut: if the current config hash has already been retrieved
# and the requested param is set, return *that* param
if ( defined($self->getConfig()) && defined($self->getServiceName) &&
($self->getServiceName eq $service_name) &&
defined($self->getConfig()->{$param_name}) ) {
return $self->getConfig()->{$param_name};
}
This if() statement needs to take not only the service name into account but also the host.
On Sat Aug 23 18:30:39 2014, LAJANDY wrote:
Show quoted text> Issue the following commands to set a MAX_WORKERS parameter for
> Helios::TestService for all hosts and another for the current host:
>
> helios_config_set --service=Helios::TestService --hostname=*
> --param=MAX_WORKERS --value=2
> Service: Helios::TestService Host: * Param: MAX_WORKERS SET.
>
> helios_config_set --service=Helios::TestService --param=MAX_WORKERS
> --value=5
> Service: Helios::TestService Host: ubuntu-precise64-1 Param:
> MAX_WORKERS SET.
>
> Now, use helios_config_get to retrieve the param values:
>
> # don't specify host, you get current host, as expected
> helios_config_get --service=Helios::TestService --param=MAX_WORKERS
> 5
>
> # ask specifically for the parameter for all hosts,
> # and you still get the current host's parameter
> helios_config_get --service=Helios::TestService --param=MAX_WORKERS
> --hostname=*
> 5
>
> This use case runs counter to how Helios services are usually used,
> but you would expect to get the all hosts (*) parameter value if you
> specifically ask for it.