Skip to content

Instantly share code, notes, and snippets.

@sebgoa
Created June 26, 2013 19:25
Show Gist options
  • Save sebgoa/5870702 to your computer and use it in GitHub Desktop.
Save sebgoa/5870702 to your computer and use it in GitHub Desktop.
A quickie shell for Apache libcloud
#!/usr/bin/env python
import code
import sys
import os
import urlparse
from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver
import libcloud.security as sec
Driver = get_driver(Provider.CLOUDSTACK)
apikey=os.getenv('API_KEY')
secretkey=os.getenv('SECRET_KEY')
endpoint=os.getenv('ENDPOINT')
host=urlparse.urlparse(endpoint).netloc
path=urlparse.urlparse(endpoint).path
conn=Driver(key=apikey,secret=secretkey,secure=True,host=host,path=path)
class shell(code.InteractiveConsole):
def __init__(self,locals=None):
code.InteractiveConsole.__init__(self,locals=locals)
return
console = shell(locals())
console.interact("Hello LibCloud Shell !!"+ "\n"+"You are running at: %s" % endpoint)
@milamberspace
Copy link

Hello Seb,

I've made some improvements (http/https + port) on your libshell.
You can see at:
https://gist.github.com/milamberspace/6316806

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment