1 follower Follow

Importing a deployment archive from a URL

Many clients store packages in a central repository such as Nexus. To deploy them using XL Deploy, they need to be imported there first. XL Deploy does not have an option to do this directly (from the CLI or GUI), but using Python, you can easily write a script to do it which will run in the XL Deploy CLI. Here's an example:

import urllib2

 # This script is an example of how to import a file from a repository (nexus).
 # First, the file is downloaded to the local filesystem. Then, it is imported
 # into XL Deploy.

 # Setup handling of basic authentication
 def setupBasicAuth():
 # create a password manager
 password\_mgr = urllib2.HTTPPasswordMgrWithDefaultRealm()

 # Add the username and password.
 top\_level\_url = ""
 password\_mgr.add\_password(None, top\_level\_url, "username", "password")

 # create "opener" (OpenerDirector instance)
 handler = urllib2.HTTPBasicAuthHandler(password\_mgr)
 opener =\_opener(handler)

 # Install the opener.
 # Now all calls to urllib.urlopen use our opener.

 # Download file
 def downloadFile():
 # Open the URL of the resource you want to download
 f = urllib2.urlopen("")

 # Open our local file for writing
 local\_file = open("/tmp/tmpfile.jar", "w")

 # Write to our local file

 # Main script


 # Import it into Deployit
XebiaLabs Support

Please sign in to leave a comment.