Repository: ansible/ansible

Issue:
Missing an option to disable cow whitelisting
##### ISSUE TYPE
 - Feature Idea

##### COMPONENT NAME
Cow support.

##### ANSIBLE VERSION
<!--- Paste verbatim output from “ansible --version” between quotes below -->
```
ansible 2.3.0 (devel f1b37a184c) last updated 2016/12/07 17:17:58 (GMT +200)
  config file = 
  configured module search path = Default w/o overrides
```

##### CONFIGURATION
None

##### OS / ENVIRONMENT
N/A

##### SUMMARY
Currently a cow whitelist is mandatory, but it would be nice to be able to not enforce one.
For example, I use Ponysay instead of cowsay and they use completely different "cows" names. If I want to have all of the ponies, I must do :
```
export ANSIBLE_COW_WHITELIST=ace,ahuizotl,airheart,allie,aloe,amethyststar,amira,angel,applebloom,applebloomdance,applebumpkin,applecore,applefritter,applejack,applejackscarecrow,applesplit,archer,babseed,basil,bastionyorsets,bear,beautybrass,berrydreams,berrypinch,berrypunch,bigmac,bigmacsleep,billneigh,blaze,blinkie,blossomforth,blueberry,blueberrycake,blueblood,blueharvest,blues,bonbon,bonbonlyra,bonbonstand,bonvoyage,boxxy,brad,braeburn,brucemane,bulkbiceps,buttonmash,cadance,cadancecrystal,cadancescruffy,caesar,candylicious,candymane,caramel,carecake,carrot,carrotcake,carrottop,celestia,celestiasmall,cerberus,changeling,changelingqueen,cheerilee,cheerilee80,cheesesandwich,cherryberry,cherrycola,cherryfizzy,chrysalis,clockwork,cloudchaser,cloudkicker,clyde,coldheart,colgate,colton,cottoncloudy,cow,crackle,craftycrate,creampuff,cremebrulee,cupcake,cutiemarkcrusaders,daisy,dancefever,daringdo,davenport,deepblue,derpy,derpybags,derpycloud,derpysad,derpysit,derpystand,derpystandwing,descent,diamondmint,diamondtiara,dinky,discord,discordamused,discordpuppetmaster,djpon-3,doctor,drhooves,elsie,epona,fancypants,featherweight,fiddlesticks,fido,fillycadance,fillydash,fillydashfly,fillyjack,fillyjacktravel,fillypinkie,fillypinkiecurly,fillyrarity,fillyshy,fillytwilight,filmreel,filthyrich,firestreak,flam,flashsentry,fleetfoot,fleurdelis,fleurdelishair,fleurdelislay,flim,flitter,flowertrio,fluttershy,fluttershygala,fluttershyshy,fluttershystare,forestspirit,frederickhorseshoepin,georgewashingtony,gilda,gildastand,gingergold,gingersnap,goldenharvest,granny,grannychair,grannysleep,gummy,gustavelegrand,haakim,hairytipper,harpass,harshwhinny,hayfever,hayseed,heartstrings,highscore,hoity,hollydash,horsemd,horsepower,horte,hughjelly,inky,ironwill,ironwillwalk,jeffletrotski,jesuspezuna,joe,joetuxedo,jubileena,junebug,laflour,lemonhearts,lightning,lightningdust,lily,lilyvalley,lintsalot,lotus,lotusblossom,lulamoon,luna,lunafly,lyra,lyrabonbon,lyrasit,mabel,magnum,mane-iac,mannyroar,manticore,mantishy,maredowell,maredowellfly,master,maudepie,maybelle,mayor,meadowsong,melilot,midnightstrike,milkyway,minuette,misty,mjolna,mrbreezy,mrsparkle,mrssparkle,mule,nightingale,nightlight,nightmaremoon,nightmarerarity,noi,noteworthy,octavia,oinkoinkoink,opal,orange,orangebird,orangefrog,owl,owlowiscious,pansyshy,papermoon,parasprite,peachbottom,pearl,perry,perrypierce,persnickety,petunia,philomena,philomenaphoenix,photofinish,pictureperfect,pigpen,pinacolada,pinkacopter,pinkamina,pinkie,pinkiebounce,pinkiecannon,pinkiecannonfront,pinkiecannonhappy,pinkiechicken,pinkiecrazyface,pinkiefly,pinkiegala,pinkiegummy,pinkiegummydisguise,pinkiehugfluttershy,pinkiehugsfluttershy,pinkieoink,pinkieparade,pinkiepartycannon,pinkieprincess,pinkiesilly,pinkietongue,pinkieumbrellahat,pinkieumbrellahatfear,pinkiewhoops,pinkiewhoopseat,pinkiewhoopsout,pipsqueak,pipsqueakpirate,pokey,pokeypierce,ponet,poppycock,poundcake,poundfly,powderrouge,prettyvision,princesserroria,pumpkincake,purplehaze,quickfix,raccoon,raggedy,rainbow,rainbowblitz,rainbowdashcrystal,rainbowdrag,rainbowdrop,rainbowfim,rainbowfly,rainbowgala,rainbowhurricane,rainbowsalute,rainbowshadowbolt,rainbowshine,rainbowsleep,raindrops,rarity,raritycomplaining,raritydrama,rarityelite,rarityfly,raritygala,rarityponder,raritysdad,raritysmom,raven,ravenearth,ravenunicorn,redheart,rhyme,rocky,rose,roseluck,rover,royalguard,royalnightguard,royalribbon,royalunicornguard,ruby,rumble,sapphire,scootaloo,screwball,screwloose,seabreeze,seaswirl,shiningarmor,shiningarmorcrystal,shiningarmorguard,shiningarmorwedding,shoeshine,shortround,silverspeed,silverspoon,silverstar,sindy,skyra,snails,snips,snowflake,snowheart,soarin,soarinofficer,soigne,sombra,sparkler,spike,spikecrystal,spikefloat,spikelove,spikemustache,spitfire,spot,squirrel,starlight,stella,stevenmagnet,stevenmagnettrue,strawberrycream,strongheart,sue,suedance,sunnyrays,sunsetshimmer,surprise,sweetcream,sweetie,sweetiedrops,sweetiesing,tank,tealove,tenderheart,theodoredonaldkerabatsos,theoldenpony,thunderlane,timeturner,tom,tornadobolt,trixie,trixieamulet,trixielulamoon,trixiestage,trixiestand,truffleshuffle,turf,turnip,twilacorn,twilight,twilightcrazyfromball,twilightcrystal,twilightfly,twilightprincess,twilightrage,twilightspike,twilightthebearded,twilighttime,twilightvelvet,twilightwings,twilightzero,twinkleshine,twist,unclewing,vinyl,violet,walter,waltercoltchak,wildfire,wildflower,winona,woona,yearling,zecora,zecorabalance
```

##### EXPECTED RESULTS
Un-setting ANSIBLE_COW_WHITELIST (or setting it to an empty string) could allow all "cows" to be whitelisted.

##### ACTUAL RESULTS
We need to explicitly whitelist all "cows".


Discussion:

Resolving patch:
diff --git a/lib/ansible/utils/display.py b/lib/ansible/utils/display.py
--- a/lib/ansible/utils/display.py
+++ b/lib/ansible/utils/display.py
@@ -84,7 +84,9 @@ def __init__(self, verbosity=0):
             try:
                 cmd = subprocess.Popen([self.b_cowsay, "-l"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
                 (out, err) = cmd.communicate()
-                self.cows_available = [ to_bytes(c) for c in set(C.ANSIBLE_COW_WHITELIST).intersection(out.split())]
+                self.cows_available = set([ to_bytes(c) for c in out.split() ])
+                if C.ANSIBLE_COW_WHITELIST:
+                    self.cows_available = set(C.ANSIBLE_COW_WHITELIST).intersection(self.cows_available)
             except:
                 # could not execute cowsay for some reason
                 self.b_cowsay = False


Test patch: