Quantcast

Using user:pass in http:// urls for "script":

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Using user:pass in http:// urls for "script":

rantav
Is it possible to use a user:pass in a url passed to a script element in the json model document?

I have:
    "mountPoint": "/m1/i001",
    "script": "http://username:password@svn....:8081/repos/Outbrain/trunk/.../GluAgentDeployer.groovy"

(username and full path truncated).

So when I try to deploy this I get:

Install script for installation agent-1:/m1/i001 on agent-1 - 362ms
* /m1/i001
* HTTP Authorization failure

Screenshot: https://skitch.com/rantav/rgeef/glu-dev-1-glu-console-deployment-deploy-fabric-glu-dev-1-sequential

Using curl and the same URL (run from the exact same host as the agent) will work nicely so I suppose there's an issue supporting the user:pass basic auth in groovy or maybe it's just something specific to glu.

My motivation was to read the groovy script straight from SVN, just makes deployment a lot easier...

Ideas how should I go about this?
Thanks (and sorry for spamming your forum with my newb questions...)
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Using user:pass in http:// urls for

frenchyan
Administrator
Under the cover, the agent uses ShellImpl.fetch (https://github.com/linkedin/glu/blob/master/agent/org.linkedin.glu.agent-impl/src/main/groovy/org/linkedin/glu/agent/impl/capabilities/ShellImpl.groovy)

which as you can see @ line 323 delegates to ant under the cover.

Can you write a quick ant script and try it with ant ?

build.xml
<target name="get">
  <get src="<your uri goes here>" dest="/tmp/myscript.groovy"/>
</target>

and run

ant get

Does it work ? Do you get the same error ?

I can see that the get ant task (http://ant.apache.org/manual/Tasks/get.html) accepts username and password as parameters. So can you try with:

<target name="get">
  <get src="<your uri goes here without username/password>" dest="/tmp/myscript.groovy" username="xxx" password="yyy"/>
</target>

Does it work now ?

If yes then I think it is a matter of changing the fetch method to extract those and feed them to ant.

Thanks
Yan
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Using user:pass in http:// urls for

frenchyan
Administrator
In reply to this post by rantav
In regards to the approach itself I actually think it is a good thing to read straight from your source of truth (svn). I would not recommend reading from trunk though as 'trunk' is never a point in time, meaning you cannot really have reproducibility. I would suggest using a tag.

No worry for your questions. They are very good and provide great discussion (and also pointing out the weaknesses of the code and/or documentation :) !

Thanks
Yan
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Using user:pass in http:// urls for

rantav
In reply to this post by rantav
Ant indeed needed its username and password.
I've sent a pull request https://github.com/rantav/glu/commit/0947231958a3c27df5e89f4023e35e7fd67d33fd
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Using user:pass in http:// urls for

frenchyan
Administrator
Cool. I will pull your changes in.

Thanks
Yan
Loading...