def listSites(self, args): data = self.api.listSites() list_data = [] for site in data: json_obj = json.loads(site) list_data.append(json_obj) #print list_data gl_view.cli_view(list_data,"list-sites")
def deleteSite(self, args): if args.site_id == '': print '' print 'Command "glint delete-site" requires either varibale SITE_ID or argument --site-id' print '' else: data = self.api.deleteSite(args.site_id) gl_view.cli_view([data],"delete-site")
def getCredential(self, args): if args.site_id == '': print '' print 'Command "glint get-credential" requires either varibale SITE_ID or argument --site-id' print '' else: data = self.api.getCredential(args.site_id) gl_view.cli_view([data], "get-credential")
def deleteSite(self, args): if args.site_id == '': print '' print 'Command "glint delete-site" requires either varibale SITE_ID or argument --site-id' print '' else: data = self.api.deleteSite(args.site_id) gl_view.cli_view([data], "delete-site")
def listSites(self, args): data = self.api.listSites() list_data = [] for site in data: json_obj = json.loads(site) list_data.append(json_obj) #print list_data gl_view.cli_view(list_data, "list-sites")
def getCredential(self, args): if args.site_id == '': print '' print 'Command "glint get-credential" requires either varibale SITE_ID or argument --site-id' print '' else: data = self.api.getCredential(args.site_id) gl_view.cli_view([data],"get-credential")
def hasCredential(self, args): if (args.site_id == '') and (args.ck_type == ''): print '' print 'Command "glint has-credential" requires either varibales SITE_ID and CK_TYPE or arguments --site-id and --ck-type' print '' elif args.site_id == '': print '' print 'Command "glint has-credential" requires either varibale SITE_ID or agument --site-id' print '' elif args.ck_type == '': print '' print 'Command "glint has-credential" requires either varibale CK_TYPE or a gument --ck-type' print '' else: data = self.api.hasCredential(args.site_id, args.ck_type) gl_view.cli_view([data], "has-credential")
def hasCredential(self, args): if (args.site_id == '') and (args.ck_type == ''): print '' print 'Command "glint has-credential" requires either varibales SITE_ID and CK_TYPE or arguments --site-id and --ck-type' print '' elif args.site_id == '': print '' print 'Command "glint has-credential" requires either varibale SITE_ID or agument --site-id' print '' elif args.ck_type == '': print '' print 'Command "glint has-credential" requires either varibale CK_TYPE or a gument --ck-type' print '' else: data = self.api.hasCredential( args.site_id, args.ck_type) gl_view.cli_view([data],"has-credential")
def createSite(self, args): data = self.api.createSite(args.name,args.url,args.format) gl_view.cli_view([data],"create-site")
def imageDelete(self, args): data = self.api.imageDelete(args.image_name,args.image_source_site,args.image_source_tenant) gl_view.cli_view([data],"image-delete")
def imageCopy(self, args): data = self.api.imageCopy(args.image_name,args.image_source_site,[args.image_destination_site]) gl_view.cli_view([data],"image-copy")
def getImages(self, args): data = self.api.getImages() gl_view.cli_view(data, "get-images")
def addCredential(self, args): #return self.api.addCredential(args.remote_tenant,args.remote_username,args.remote_password,args.remote_site_id) data = self.api.addCredential(args.remote_tenant,args.remote_username,args.remote_password,args.remote_site_id) gl_view.cli_view([data],"add-credential")
def createSite(self, args): data = self.api.createSite(args.name, args.url, args.format) gl_view.cli_view([data], "create-site")
def imageDelete(self, args): data = self.api.imageDelete(args.image_name, args.image_source_site, args.image_source_tenant) gl_view.cli_view([data], "image-delete")
def imageCopy(self, args): data = self.api.imageCopy(args.image_name, args.image_source_site, [args.image_destination_site]) gl_view.cli_view([data], "image-copy")
def addCredential(self, args): #return self.api.addCredential(args.remote_tenant,args.remote_username,args.remote_password,args.remote_site_id) data = self.api.addCredential(args.remote_tenant, args.remote_username, args.remote_password, args.remote_site_id) gl_view.cli_view([data], "add-credential")
def getImages(self, args): data = self.api.getImages() gl_view.cli_view(data,"get-images")
data = [{ u'name': u'Mosue', u'url': u'http://mouse01.heprc.uvic.ca:5000/v2.0', u'authport': u'5000', u'version': u'v2.0', u'pk': u'1', u'type': u'Openstack' }, { u'name': u'Rateroni', u'url': u'http://rat01.heprc.uvic.ca:5000/v2.0', u'authport': u'5000', u'version': u'v2.0', u'pk': u'2', u'type': u'Openstack' }] g_view.cli_view(data, "list-sites") #delete-credential data = [{u'Result': u'Success removing Credential'}] g_view.cli_view(data, "delete-credential") #delete-site data = [{u'Result': u'Successful Delete'}] g_view.cli_view(data, "delete-site") #create-site data = [{u'site_id': 2, u'Result': u'Success'}] g_view.cli_view(data, "create-site") #add-credential data = [{u'Result': u'Sites: add Credential'}]
''' Created on Mar 31, 2015 @author: ronaldjosephdesmarais ''' import glintViewer as g_view #list-sites data = [{u'name': u'Mosue', u'url': u'http://mouse01.heprc.uvic.ca:5000/v2.0', u'authport': u'5000', u'version': u'v2.0', u'pk': u'1', u'type': u'Openstack'}, {u'name': u'Rateroni', u'url': u'http://rat01.heprc.uvic.ca:5000/v2.0', u'authport': u'5000', u'version': u'v2.0', u'pk': u'2', u'type': u'Openstack'}] g_view.cli_view(data,"list-sites") #delete-credential data = [{u'Result': u'Success removing Credential'}] g_view.cli_view(data,"delete-credential") #delete-site data = [{u'Result': u'Successful Delete'}] g_view.cli_view(data,"delete-site") #create-site data = [{u'site_id': 2, u'Result': u'Success'}] g_view.cli_view(data,"create-site") #add-credential data = [{u'Result': u'Sites: add Credential'}] g_view.cli_view(data,"add-credential") #has-credential data = [{u'result': True, u'error': False}] g_view.cli_view(data,"has-credential")