cmd/switch: fix exception.
cmd/switch: fix exception.

keg_only? should use 'rack' not 'canonical_name'

Closes Homebrew/homebrew#40124.
Closes Homebrew/homebrew#40126.

Signed-off-by: Mike McQuaid <a17fed27eaa842282862ff7c1b9c8395a26ac320@mikemcquaid.com>

claui/brew,vitorgalvao/brew,tonyg/homebrew,Homebrew/brew,DomT4/brew,alyssais/brew,muellermartin/dist,reelsense/brew,gordonmcshane/homebrew,jmsundar/brew,EricFromCanada/brew,mistydemeo/homebrew,staticfloat/brew,konqui/brew,konqui/brew,mahori/brew,sjackman/homebrew,toonetown/homebrew,rwhogg/brew,amar-laksh/brew_sudo,MikeMcQuaid/brew,claui/brew,vitorgalvao/brew,ilovezfs/brew,hanxue/linuxbrew,Homebrew/brew,muellermartin/dist,tonyg/homebrew,mahori/brew,pseudocody/brew,bfontaine/brew,palxex/brew,palxex/brew,DomT4/brew,MikeMcQuaid/brew,reitermarkus/brew,MikeMcQuaid/brew,DomT4/brew,staticfloat/brew,gregory-nisbet/brew,Homebrew/brew,mgrimes/brew,hanxue/linuxbrew,mgrimes/brew,reitermarkus/brew,nandub/brew,AnastasiaSulyagina/brew,AnastasiaSulyagina/brew,zmwangx/brew,amar-laksh/brew_sudo,aw1621107/brew,jmsundar/brew,toonetown/homebrew,gregory-nisbet/brew,bfontaine/brew,vitorgalvao/brew,sjackman/homebrew,EricFromCanada/brew,alyssais/brew,gordonmcshane/homebrew,mahori/brew,ilovezfs/brew,ilovezfs/brew,mgrimes/brew,EricFromCanada/brew,aw1621107/brew,maxim-belkin/brew,konqui/brew,JCount/brew,aw1621107/brew,maxim-belkin/brew,mistydemeo/homebrew,konqui/brew,amar-laksh/brew_sudo,EricFromCanada/brew,pseudocody/brew,Linuxbrew/brew,maxim-belkin/brew,nandub/brew,palxex/brew,staticfloat/brew,toonetown/homebrew,Linuxbrew/brew,claui/brew,sjackman/homebrew,Linuxbrew/brew,tonyg/homebrew,Homebrew/brew,Linuxbrew/brew,rwhogg/brew,claui/brew,zmwangx/brew,MikeMcQuaid/brew,zmwangx/brew,reelsense/brew,reitermarkus/brew,DomT4/brew,mahori/brew,alyssais/brew,JCount/brew,jmsundar/brew,bfontaine/brew,reelsense/brew,muellermartin/dist,nandub/brew,gordonmcshane/homebrew,pseudocody/brew,mistydemeo/homebrew,nandub/brew,vitorgalvao/brew,JCount/brew,gregory-nisbet/brew,AnastasiaSulyagina/brew,reitermarkus/brew,hanxue/linuxbrew,sjackman/homebrew,JCount/brew,rwhogg/brew