#!/bin/bash # $HeadURL$ $LastChangedRevision$ PROGNAME=`basename $0` SANDPIT=`pwd` . $(ade-config ade_share_prefix)/include/adetestsupport.sh ############################################################################## # # Purpose of test: # # gnocchi# paa listhosts '^orzo ' # host status pid pkgtype distro release port last changed # ---------- ---------- ----- ------- ---------- ---------- ------- ------------------------------ # alphabeti available deb debian wheezy amd64 Sat Mar 23 14:52:47 CET 2013 # borzo available deb debian wheezy amd64 Mon Mar 25 13:53:37 CET 2013 # cercis available deb ubuntu precise amd64 Tue Feb 12 11:36:46 CET 2013 # doodle available deb debian wheezy amd64 Tue Apr 16 08:06:48 CEST 2013 # farfalle available deb debian squeeze amd64 Tue Feb 12 11:36:39 CET 2013 # fettuce available deb debian squeeze amd64 Tue Feb 12 11:36:40 CET 2013 # fiori available deb debian squeeze amd64 Fri May 24 08:55:31 CEST 2013 # gnocchi available deb debian squeeze amd64 Tue Feb 12 11:36:37 CET 2013 # halusky available deb ubuntu precise amd64 Tue Feb 12 11:36:46 CET 2013 # lasagne available deb debian squeeze amd64 Tue Feb 12 11:36:41 CET 2013 # linguine available deb ubuntu precise i386 Tue Feb 12 11:36:48 CET 2013 # macaroni available deb debian lenny i386 Tue Feb 12 11:36:48 CET 2013 # nb016161 available deb ubuntu precise amd64 Tue Feb 12 11:36:47 CET 2013 # noodle available deb debian wheezy amd64 Tue Apr 16 08:06:34 CEST 2013 # orzo available deb debian wheezy amd64 Sun Mar 24 18:14:01 CET 2013 # penne available deb debian squeeze amd64 Tue Feb 12 11:36:43 CET 2013 # rocky available deb debian squeeze amd64 Tue Feb 12 11:36:43 CET 2013 # spaghetti available rpm centos 6.3 x86_64 Tue Feb 12 11:36:49 CET 2013 # spirali available deb debian squeeze amd64 Tue Feb 12 11:36:44 CET 2013 # torchio available deb debian squeeze amd64 Tue Feb 12 11:36:45 CET 2013 # ziti available deb debian squeeze amd64 Tue Feb 12 11:36:37 CET 2013 # # gnocchi# # # Without that trailing space, the above command works as expected (i.e. gets orzo, but not # borzo or anything else.) # # Bug id: # ############################################################################## # Ensure dates are consistently formatted export LC_ALL=C # Start of support functions filter_variant_text() { # Note how the variable *width* of a hostname - and therefore of the padding # that follows it in column-aligned output - means that we can't change # just to VARIANT-HOSTNAME but *with* padding to # VARIANT-HOSTNAME with fixed width padding. Another padding issues comes # from that summer and winter timezones have different widths and therefore # different paddings. Although the timezone is devarianted the spacing is # not. This only seems to be a problem on the end of the line because dates # are always in the last column. eval "$@" | sed -e 's/[A-Z][a-z][a-z] [A-Z][a-z][a-z] [1-3 ][0-9] [0-2][0-9]:[0-5][0-9]:[0-5][0-9] [A-Z][A-Z]* [1-2][0-9][0-9][0-9]/Fri Dec 31 23:59:59 GMT 1999/g' \ -e 's/^\(pub\)\( *\)\([^ ]*\)\( *\)\([^ ]*\)$/\1\2VARIANT-KEY-ID\4VARIANT-DATE/' \ -e "s@$SANDPIT@VARIANT-SANDPIT@g" \ -e "s/$UNAMEN */VARIANT-HOSTNAME /g" \ -e "s/$UNAMEN\([^ \t]\)/VARIANT-HOSTNAME\1/g" \ -e "s/20[1-9][0-9][0-1][0-9][0-3][0-9][0-2][0-9][0-5][0-9][0-5][0-9]/VARIANT-TIMESTAMP/g" \ -e "s/ *\$//" # return the passed command's return code, not sed's. return ${PIPESTATUS[0]} } launch_shell() { PS1="$PROGNAME> " bash --norc || true } # End of support functions # Start of environment setup export PAA_RCDIR=$SANDPIT/.paa export PAA_ROOTDIR=$SANDPIT export PAA_STATE_PREFIX=$SANDPIT/var # Misc UNAMEN=$(uname -n) echo "creating three similarly named hosts and one differently named one ..." paa host orzo deb debian squeeze amd64 paa host borzo deb debian squeeze amd64 paa host orzos deb debian squeeze amd64 paa host banana deb debian squeeze amd64 echo echo "listing all hosts ..." filter_variant_text "paa listhosts" echo echo "listing hosts with 'orzo' in name..." filter_variant_text "paa listhosts orzo" echo echo "listing hosts with '^orzo' in name..." filter_variant_text "paa listhosts ^orzo" echo echo "listing hosts with 'orzo ' in name..." filter_variant_text "paa listhosts \"orzo \"" echo echo "all done"