Beispiel #1
0
    def authenticate(self, adminUsername, adminPassword):
        """
        Check if the credentials are valid.

            Returns:
                True if username and password match a valid user in the system
            Throws:
                UserNotAuthorized
                TortugaException
        """

        url = 'v1/authenticate/%s' % (urllib.parse.quote_plus(adminUsername))

        postdata = json.dumps({
            'password': adminPassword,
        })

        try:
            _, responseDict = self.sendSessionRequest(url,
                                                      method='POST',
                                                      data=postdata)

            return toBool(responseDict.get('authenticate'))
        except TortugaException:
            raise
        except Exception as ex:
            raise TortugaException(exception=ex)
Beispiel #2
0
 def setPreserve(self, preserve):
     """ Set preserve."""
     self['preserve'] = toBool(preserve)
Beispiel #3
0
 def getIsRunning(self):
     return toBool(self.get('running'))
Beispiel #4
0
 def setIsIdle(self, val):
     self['isIdle'] = toBool(val)
Beispiel #5
0
 def setMcastEnabled(self, mcastEnabled):
     """ Set multicast enabled flag. """
     self['mcastEnabled'] = toBool(mcastEnabled)
Beispiel #6
0
 def getSoftwareOverrideAllowed(self):
     """ Return hardware profile override allowed flag. """
     return toBool(self.get('softwareOverrideAllowed'))
Beispiel #7
0
 def getGrow(self):
     return toBool(self.get('grow'))
Beispiel #8
0
 def getBootLoader(self):
     """ Return boot loader flag. """
     return toBool(self.get('bootLoader'))
Beispiel #9
0
 def getUsingDhcp(self):
     """ Get using dhcp flag. """
     return toBool(self.get('usingDhcp'))
Beispiel #10
0
 def setUsingDhcp(self, usingDhcp):
     """ Set using dhcp flag. """
     self['usingDhcp'] = toBool(usingDhcp)
Beispiel #11
0
 def getShared(self):
     return toBool(self.get('shared'))
Beispiel #12
0
 def setShared(self, val):
     self['shared'] = toBool(val)
Beispiel #13
0
 def getPersistent(self):
     return toBool(self.get('persistent'))
Beispiel #14
0
 def setPersistent(self, val):
     self['persistent'] = toBool(val)
Beispiel #15
0
 def getPreserve(self):
     """ Return preserve. """
     return toBool(self.get('preserve'))
Beispiel #16
0
 def setBoot(self, boot):
     """ Set boot."""
     self['boot'] = toBool(boot)
Beispiel #17
0
 def setBootLoader(self, bootLoader):
     """ Set boot loader flag."""
     self['bootLoader'] = toBool(bootLoader)
Beispiel #18
0
 def getBoot(self):
     """ Return boot. """
     return toBool(self.get('boot'))
Beispiel #19
0
 def setGrow(self, value=True):
     self['grow'] = toBool(value)
Beispiel #20
0
 def setIsOs(self, isOs):
     """ Set isOs flag."""
     self['isOs'] = toBool(isOs)
Beispiel #21
0
 def setSoftwareOverrideAllowed(self, allowed):
     """ Set hardware profile override allowed flag."""
     self['softwareOverrideAllowed'] = toBool(allowed)
Beispiel #22
0
 def getIsOs(self):
     """ Return isOs flag. """
     return toBool(self.get('isOs'))
Beispiel #23
0
 def setBcastEnabled(self, bcastEnabled):
     """ Set broadcast enabled flag. """
     self['bcastEnabled'] = toBool(bcastEnabled)
Beispiel #24
0
 def setIsRemovable(self, isRemovable):
     """ Set isRemovable flag."""
     self['isRemovable'] = toBool(isRemovable)
Beispiel #25
0
 def getMcastEnabled(self):
     """ Return multicast enabled flag. """
     # The default for this flag is True...so if null set true..
     if self.get('mcastEnabled') is None:
         self.setMcastEnabled(True)
     return toBool(self.get('mcastEnabled'))
Beispiel #26
0
 def getIsRemovable(self):
     """ Return removable flag. """
     return toBool(self.get('isRemovable'))
Beispiel #27
0
 def getIsIdle(self):
     return toBool(self.get('isIdle'))
Beispiel #28
0
 def setIsRunning(self, val):
     self['running'] = toBool(val)