Example #1
0
 def api(self):
     if self._api is None:
         top = robj.connect(self._url)
         for ver in top.api_versions:
             if ver.name == "v1":
                 break
         else:
             raise errors.RbuildError("No compatible REST API found on " "rBuilder '%s'" % self._url.__safe_str__())
         self._api = ver
     return self._api
Example #2
0
 def api(self):
     if self._api is None:
         top = robj.connect(self._url)
         for ver in top.api_versions:
             if ver.name == 'v1':
                 break
         else:
             raise errors.RbuildError("No compatible REST API found on "
                                      "rBuilder '%s'" %
                                      self._url.__safe_str__())
         self._api = ver
     return self._api
Example #3
0
 def processConfigOptions(self, cfg, *args, **kwargs):
     AbstractCommand.processConfigOptions(self, cfg, *args, **kwargs)
     self.cfg = cfg
     if not self.cfg.authPass and os.getuid() != 0:
         sys.exit("error: Can't authenticate. "
                 "This script must be run as root.")
     api = robj.connect("https://%s:%s@localhost/api" %
             (self.cfg.authUser, self.cfg.authPass))
     for v in self._collection(api.api_versions):
         if v.name == 'v1':
             self.api = v
             break