def __init__(self):
     self.param_valid = True
     self.tmc_url = os.getenv("tmc_url")
     if self.tmc_url is None:
         print(
             "No tmc_url provided, please set environment variable tmc_url")
         self.param_valid = False
         return
     self.api_token = os.getenv("api_token")
     if self.api_token is None:
         print(
             "No api_token provided, please set environment variable api_token"
         )
         self.param_valid = False
         return
     self.org_id = os.getenv("org_id")
     if self.org_id is None:
         print("No org_id provided, please set environment variable org_id")
         self.param_valid = False
         return
     self.lcp_name = os.getenv("lcp_name")
     if self.lcp_name is None:
         print(
             "No lcp_name provided, please set environment variable lcp_name"
         )
         self.param_valid = False
         return
     self.tmc = TMC(self.tmc_url, self.api_token, self.org_id)
Ejemplo n.º 2
0
 def __init__(self,
              vc,
              username,
              password,
              tmc_url,
              api_token,
              org_id,
              lcp_prefix,
              yaml_action,
              skiplist=[]):
     self.vc = vc
     self.username = username
     self.password = password
     self.tmc_url = tmc_url
     self.api_token = api_token
     self.org_id = org_id
     self.lcp_prefix = lcp_prefix
     self.yaml_action = yaml_action
     self.tmc_handler = TMC(self.tmc_url, self.api_token, self.org_id)
     self.wcp_fetcher = WCPFetcher(self.vc, self.username, self.password)
     self.wcp_info = self.wcp_fetcher.wcp_info
     self.skipIPList = skiplist
     print("Skip List: " + str(self.skipIPList))
     mywcp_info = self.wcp_info.copy()
     for w in mywcp_info:
         if mywcp_info[w]["IP"] in self.skipIPList:
             self.wcp_info.pop(w, None)
     print("WCP Clusters: ")
     print(self.wcp_info)
     print("Initialized successfully")