[openstack-dev] [devstack] Bug in is_*_enabled functions?
Brian Haley
brian.haley at hp.com
Thu Feb 27 15:22:14 UTC 2014
On 02/26/2014 05:18 PM, Carl Baldwin wrote:
> Brian,
>
> In shell it is correct to return 0 for success and non-zero for failure.
But, at least in lib/neutron, there is a check like this:
if is_service_enabled neutron; then
...
fi
Which will fail with a 0 return code and miss some config. It seems like these
functions should return TRUE (1) in this case based on their naming scheme.
There were recent changes to these *enabled() functions a few days ago which is
part of the reason I'm asking as well, don't know if something got overlooked.
-Brian
> On Feb 26, 2014 10:54 AM, "Brian Haley" <brian.haley at hp.com
> <mailto:brian.haley at hp.com>> wrote:
>
> While trying to track down why Jenkins was handing out -1's in a Neutron patch,
> I was seeing errors in the devstack tests it runs. When I dug deeper it looked
> like it wasn't properly determining that Neutron was enabled - ENABLED_SERVICES
> had multiple "q-*" entries, but 'is_service_enabled neutron' was returning 0.
>
> I boiled it down to a simple reproducer based on the many is_*_enabled()
> functions:
>
> #!/usr/bin/env bash
> set -x
>
> function is_foo_enabled {
> [[ ,${ENABLED_SERVICES} =~ ,"f-" ]] && return 0
> return 1
> }
>
> ENABLED_SERVICES=f-svc
>
> is_foo_enabled
>
> $ ./is_foo_enabled.sh
> + ENABLED_SERVICES=f-svc
> + is_foo_enabled
> + [[ ,f-svc =~ ,f- ]]
> + return 0
>
> So either the return values need to be swapped, or && changed to ||. I haven't
> tested is_service_enabled() but all the is_*_enabled() functions are wrong
> at least.
>
> Is anyone else seeing this besides me? And/or is someone already working on
> fixing it? Couldn't find a bug for it.
>
> Thanks,
>
> -Brian
>
> _______________________________________________
> OpenStack-dev mailing list
> OpenStack-dev at lists.openstack.org <mailto:OpenStack-dev at lists.openstack.org>
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
>
>
> _______________________________________________
> OpenStack-dev mailing list
> OpenStack-dev at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
More information about the OpenStack-dev
mailing list