-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython debugging
More file actions
58 lines (42 loc) · 1.56 KB
/
python debugging
File metadata and controls
58 lines (42 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#! /bin/python3.3/
import argparse
import configparser
import getpass
import sys
import urllib
from lxml import objectify, etree
import json
from xml.etree import ElementTree as ET
#""" start authentication """
sys.path.append("Lib")
from vCloudSessionObj import vCloudSessionObj
from vCloudRequestObj import vCloudRequestObj
def get_parser():
parser = argparse.ArgumentParser()
parser.add_argument('-H', '--hostname')
#print("-h")
parser.add_argument('-u', '--username')
#print("-u")
parser.add_argument('-o', '--organization', required=True)
#print("-o")
return parser
#print("into parser")
#python
if __name__ == '__main__':
args = get_parser().parse_args()
sessionObj = vCloudSessionObj( args.hostname,args.username,getpass.getpass(), args.organization)
validity = sessionObj.is_valid()
if validity is False:
print("Login Failed")
sys.exit()
requestObj = vCloudRequestObj(sessionObj)
QueryResultRecords = requestObj.get('/api/admin/extension/vapps/query')
#"""start new process... create new vApp"""
def getcatalog():
GET /catalogs/query # this will make a list of catalogues to choose from
catalogID = raw_input("please enter the catalogue id: ") #"""for inputting the catalog id"""
#"""makes use of the catalogID variable from the raw input and gets the selected catalogue"""
GET /catalog/catalogID
def GetNewVapp():
vappID = raw_input("please enter the vApp ID: ") #"""for inputting the vApp ID"""
POST /vApp/vappID/action/deploy #"""api call to deploy the catalogued vApp ID"""