Fix conversion of restart-policy from GRPC
Fix conversion of restart-policy from GRPC

restart-condition for services from "on_failure" to "on-failure".

Since GRPC does not support dashes in properties, this change
added a conversion when _setting_ the restart-condition.

However, when inspecting a service, no conversion took place
from the internal GRPC value, resulting in "on_failure" to
be shown.

This change updates the conversion to fix this, and removes
a "hack" that was previously used for this, now using a
Switch to compare to actual types.

Before this change:

    docker service create --name web --restart-condition=on-failure nginx:alpine

    docker service inspect --format '{{ json .Spec.TaskTemplate.RestartPolicy }}' web
    {"Condition":"on_failure","MaxAttempts":0}

Afer this change:

    docker service create --name web --restart-condition=on-failure nginx:alpine

    docker service inspect --format '{{ json .Spec.TaskTemplate.RestartPolicy }}' web
    {"Condition":"on-failure","MaxAttempts":0}

Signed-off-by: Kay Yan <e76f72b975356b80d2cb3f2fdec92498896ce81e@daocloud.io>

mtesselH/docker,pradipd/moby,allencloud/docker,sdurrheimer/docker,trebonian/docker,danyalKhaliq10p/moby,ibuildthecloud/docker,KingEmet/docker,mkumatag/docker,jthelin/docker,flavio/docker,Ramzec/docker,pradipd/moby,sdurrheimer/docker,allencloud/docker,diogomonica/docker,nalind/docker,erikstmartin/docker,jlhawn/docker,msabansal/docker,coolljt0725/docker,mahak/docker,naveed-jamil-tenpearls/moby,raja-sami-10p/moby,dgageot/docker,justincormack/docker,estesp/docker,trebonian/docker,dsheets/moby,pramodhkp/moby,ripcurld0/moby,jimjag/docker,laijs/moby,shhsu/docker,KarthikNayak/docker,coolljt0725/docker,bonczj/moby-json-file-logger,Ramzec/docker,cyphar/docker,moypray/docker,maxamillion/docker,KingEmet/docker,dmcgowan/docker,akira-baruah/docker,thaJeztah/docker,moypray/docker,moby/moby,tophj-ibm/moby,paralin/docker,nalind/docker,q384566678/docker,trebonian/docker,rancher/docker,srust/docker,charleszheng44/moby,yasiramin10p/moby,shhsu/docker,michael-holzheu/docker,JMesser81/docker,endophage/docker,konstruktoid/docker-1,jvanz/docker,x1022as/docker,qudongfang/docker,lixiaobing1/docker,lixiaobing10051267/docker,mtesselH/docker,vdemeester/docker,mikedougherty/docker,michael-holzheu/docker,trebonian/docker,jwhonce/docker,catinthesky/docker,kojiromike/docker,yummypeng/docker,mikedougherty/docker,SvenDowideit/docker,dsheets/moby,erikh/docker,gnailuy/docker,liaoqingwei/docker,darrenstahlmsft/moby,YuPengZTE/docker,moul/docker,catinthesky/docker,akira-baruah/docker,thtanaka/docker,dims/docker,thtanaka/docker,ripcurld0/moby,paralin/docker,POLJM242/docker,dperny/docker,rremer/moby,ffoysal/docker,crosbymichael/docker,harche/docker,maxamillion/docker,bearstech/moby,mtesselH/docker,docker/docker,POLJM242/docker,nawawi/docker,coolljt0725/docker,whuwxl/docker,konstruktoid/docker-1,scotttlin/docker,djs55/docker,SvenDowideit/docker,yosifkit/docker,mixja/docker,cyphar/docker,miminar/docker,Mokolea/docker,jameszhan/docker,tmp6154/docker,kolyshkin/moby,yummypeng/docker,shishir-a412ed/docker,kunalkushwaha/docker,yosifkit/docker,sarnautov/moby,kencochrane/docker,Mokolea/docker,KingEmet/docker,tianon/docker,mahak/docker,jlhawn/docker,mkumatag/docker,thaJeztah/docker,vdemeester/docker,estesp/docker,thtanaka/docker,HideoYamauchi/docker,coreos/docker,maxamillion/docker,AkihiroSuda/docker,cpuguy83/docker,liaoqingwei/docker,q384566678/docker,hqhq/moby,kolyshkin/docker,tklauser/docker,Syntaxide/docker,kunalkushwaha/docker,srust/docker,vdemeester/docker,ColinHebert/docker,tklauser/docker,jameszhan/docker,endophage/docker,mkumatag/docker,mike1729/docker,jameszhan/docker,ffoysal/docker,pramodhkp/moby,nawawi/docker,YuPengZTE/docker,noironetworks/docker,thaJeztah/docker,charleszheng44/moby,mikebrow/docker,sterchelen/docker,whuwxl/docker,bonczj/moby-json-file-logger,dccurtis/docker,justincormack/docker,rhatdan/docker,dperny/docker,crosbymichael/docker,endophage/docker,qudongfang/docker,tophj-ibm/moby,imkin/moby,shishir-a412ed/docker,rremer/moby,darrenstahlmsft/moby,jvanz/docker,mikedougherty/docker,duglin/docker,ibuildthecloud/docker,ffoysal/docker,jwhonce/docker,konstruktoid/docker-upstream,hqhq/moby,flavio/docker,naveed-jamil-tenpearls/moby,ColinHebert/docker,srust/docker,konstruktoid/docker-1,moypray/docker,ibuildthecloud/docker,AkihiroSuda/docker,nalind/docker,raja-sami-10p/moby,miminar/docker,jwhonce/docker,mstanleyjones/docker,mike1729/docker,JMesser81/docker,resin-io/docker,PatrickLang/moby,kojiromike/docker,prertik/docker,rancher/docker,shhsu/docker,AkihiroSuda/docker,unclejack/docker,docker/docker,miminar/docker,harche/docker,gnailuy/docker,johnstep/moby-moby,amatsus/docker,michael-holzheu/docker,unclejack/docker,q384566678/docker,tonistiigi/docker,mahak/docker,x1022as/docker,amatsus/docker,gnailuy/docker,madhanrm/docker,fcrisciani/docker,danyalKhaliq10p/moby,dims/docker,imkin/moby,moby/moby,konstruktoid/docker-upstream,harche/docker,johnstep/moby-moby,erikstmartin/docker,haveatry/docker,laijs/moby,konstruktoid/docker-upstream,noironetworks/docker,PatrickLang/moby,xuxinkun/docker,tklauser/docker,Mokolea/docker,jthelin/docker,Syntaxide/docker,tianon/docker,mstanleyjones/docker,kolyshkin/moby,dsheets/moby,erikstmartin/docker,gschaetz/moby,dims/docker,hqhq/moby,moul/docker,flavio/docker,rancher/docker,pramodhkp/moby,sarnautov/moby,kojiromike/docker,bearstech/moby,tonistiigi/docker,konstruktoid/docker-upstream,paralin/docker,coreos/docker,raja-sami-10p/moby,alfred-landrum/docker,diogomonica/docker,YuPengZTE/docker,fcrisciani/docker,mikebrow/docker,liaoqingwei/docker,scotttlin/docker,paralin/docker,darrenstahlmsft/moby,laijs/docker,rhatdan/docker,nawawi/docker,whuwxl/docker,KarthikNayak/docker,estesp/docker,duglin/docker,bearstech/moby,jvanz/docker,tophj-ibm/moby,mtrmac/docker,erikh/docker,mstanleyjones/docker,dccurtis/docker,yummypeng/docker,lixiaobing10051267/docker,dccurtis/docker,darrenstahlmsft/docker,dmcgowan/docker,pradipd/moby,naveed-jamil-tenpearls/moby,yongtang/docker,dperny/docker,gschaetz/moby,gjaskiewicz/moby,gjaskiewicz/moby,resin-io/docker,cpuguy83/docker,yosifkit/docker,yasiramin10p/moby,resin-io/docker,dgageot/docker,nawawi/docker,tophj-ibm/docker,docker/docker,KarthikNayak/docker,lixiaobing10051267/docker,jimjag/docker,tophj-ibm/docker,msabansal/docker,crosbymichael/docker,Syntaxide/docker,madhanrm/docker,scotttlin/docker,JMesser81/docker,sterchelen/docker,yongtang/docker,yosifkit/docker,moby/moby,alfred-landrum/docker,darrenstahlmsft/docker,sdurrheimer/docker,cpuguy83/docker,qudongfang/docker,shishir-a412ed/docker,jimjag/docker,Ramzec/docker,dgageot/docker,ColinHebert/docker,Ramzec/docker,fcrisciani/docker,bearstech/moby,kolyshkin/moby,ndeloof/docker,noironetworks/docker,moul/docker,gnailuy/docker,justincormack/docker,kencochrane/docker,Mokolea/docker,dmcgowan/docker,tmp6154/docker,erikh/docker,duglin/docker,HideoYamauchi/docker,catinthesky/docker,yongtang/docker,kolyshkin/docker,mtrmac/docker,alfred-landrum/docker,lixiaobing1/docker,ripcurld0/moby,djs55/docker,darrenstahlmsft/docker,AkihiroSuda/docker,stevvooe/docker,amatsus/docker,cyphar/docker,kunalkushwaha/docker,cpuguy83/docker,mike1729/docker,PatrickLang/moby,sarnautov/moby,xuxinkun/docker,coreos/docker,mixja/docker,x1022as/docker,stevvooe/docker,tmp6154/docker,charleszheng44/moby,laijs/docker,djs55/docker,rremer/moby,ibuildthecloud/docker,mikebrow/docker,prertik/docker,thaJeztah/docker,msabansal/docker,allencloud/docker,gschaetz/moby,johnstep/moby-moby,moby/moby,haveatry/docker,yasiramin10p/moby,laijs/docker,xuxinkun/docker,laijs/moby,mixja/docker,ibuildthecloud/docker,jimjag/docker,haveatry/docker,tonistiigi/docker,lixiaobing1/docker,moul/docker,unclejack/docker,bonczj/moby-json-file-logger,diogomonica/docker,ndeloof/docker,imkin/moby,stevvooe/docker,flavio/docker,SvenDowideit/docker,nalind/docker,mahak/docker,tophj-ibm/docker,sterchelen/docker,gjaskiewicz/moby,mtrmac/docker,kencochrane/docker,ndeloof/docker,rhatdan/docker,HideoYamauchi/docker,madhanrm/docker,prertik/docker,jlhawn/docker,danyalKhaliq10p/moby