F5Networks / f5-openstack-image-prep

Contains scripts to prepare an F5® BIG-IP® VE image file to boot in OpenStack.
Apache License 2.0
0 stars 13 forks source link

get_licensed_modules does not find GTM/DNS license #34

Open alonsocamaro opened 8 years ago

alonsocamaro commented 8 years ago

In the os-license.sh:get_licensed_modules function

enabled_modules variable returns the GTM/DNS license as "dnsgtm"

# enabled_modules=$(awk '/^mod.*enabled/ { print $1 }' /config/bigip.license | sed 's/mod_//' | tr '\n' ' ')
# echo $enabled_modules
ltm ilx aml dnsgtm cgnat asm apm am afw afm

and provisionable_modules / get_supported_modules funtion returns the following tokens

# get_supported_modules
afm am apm asm avr fps gtm ilx lc ltm pem swg

which makes the following comparison to do not work

if [[ "$provisionable_modules" == *"$module"* ]]; then

alonsocamaro commented 8 years ago

A fix is the following:

root@node-1:~/onboarding/os-functions# diff -u10 os-license.sh*
--- os-license.sh   2016-08-04 17:56:46.909058172 +0000
+++ os-license.sh.orig  2016-08-04 17:57:07.544995194 +0000
@@ -120,21 +120,20 @@
        provisionable_modules=$(get_supported_modules)
        enabled_modules=$(awk '/^mod.*enabled/ { print $1 }' /config/bigip.license |
                                 sed 's/mod_//' | tr '\n' ' ')

        for module in $enabled_modules; do
            case $module in
                wo@(c|m)) module="wom" ;;
                wa?(m)) module="wam" ;;
                af@(m|w)) module="afm" ;;
                am) module="apm" ;;
-               dnsgtm) module="gtm" ;;
            esac

            if [[ "$provisionable_modules" == *"$module"* ]]; then
                licensed_modules="$licensed_modules $module"
                log "Found license for $(upcase $module) module..."
            fi
        done

        echo "$licensed_modules"
    else

Test:

With old function:

[root@bigip1:Active:Standalone] os-functions # get_licensed_modules 
  ltm ilx asm apm apm afm afm ltm ilx gtm asm apm apm afm afm ltm ilx asm apm apm afm afm

With new function:

[root@bigip1:Active:Standalone] os-functions # get_licensed_modules 
  ltm ilx asm apm apm afm afm ltm ilx gtm asm apm apm afm afm