Skip to content

Instantly share code, notes, and snippets.

@milamberspace
Forked from sebgoa/libshell.py
Last active December 21, 2015 13:59
Show Gist options
  • Save milamberspace/6316806 to your computer and use it in GitHub Desktop.
Save milamberspace/6316806 to your computer and use it in GitHub Desktop.
#!/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')
o = urlparse.urlparse(endpoint)
boolSecure = False
if o.scheme == 'https':
boolSecure = True
conn=Driver(key=apikey,secret=secretkey,secure=boolSecure,host=o.hostname,port=o.port,path=o.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