@ Then ( "^I modify marathon environment variable '(.+?)' with value '(.+?)' for service '(.+?)'?$" ) public void setMarathonProperty ( String key , String value , String service ) throws Exception { commonspec . runCommandAndGetResult ( "touch " + service + "-env.json && dcos marathon app show " + service + " > /dcos/" + service + "-env.json" ) ; commonspec . runCommandAndGetResult ( "cat /dcos/" + service + "-env.json" ) ; String configFile = commonspec . getRemoteSSHConnection ( ) . getResult ( ) ; String myJson1 = commonspec . replaceJSONPathElement ( configFile , key , value ) ; String myJson4 = commonspec . updateMarathonJson ( myJson1 ) ; String myJson = myJson4 . replaceAll ( "\"uris\"" , "\"none\"" ) ; commonspec . runCommandAndGetResult ( "echo '" + myJson + "' > /dcos/final" + service + "-env.json" ) ; commonspec . runCommandAndGetResult ( "dcos marathon app update " + service + " < /dcos/final" + service + "-env.json" ) ; commonspec . setCommandExitStatus ( commonspec . getRemoteSSHConnection ( ) . getExitStatus ( ) ) ; }
Set a environment variable in marathon and deploy again .