Created
June 26, 2013 19:25
-
-
Save sebgoa/5870702 to your computer and use it in GitHub Desktop.
A quickie shell for Apache libcloud
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello Seb,
I've made some improvements (http/https + port) on your libshell.
You can see at:
https://gist.github.com/milamberspace/6316806