def run(self, options="", arguments="", authUser="******", returnOutput=True):
     if authUser == 'admin':
         authUser = self.domainAdmin
         #authUser = utilities.getAdministratorUser()
     if authUser:
         options = "-u {} -w {} {}".format(authUser.name, authUser.password, options)
     if returnOutput:
         output, returnCode = self.remoteShell.run("{} {} {}".format(self.uptoolPath, options, arguments), returnOutput)
         isSucessful = utilities.getBooleanResult(returnCode)
         return output, isSucessful
     else:
         returnCode = self.remoteShell.run("{} {} {}".format(self.uptoolPath, options, arguments), returnOutput)
         isSucessful = utilities.getBooleanResult(returnCode)
         return isSucessful
 def run(self, options='', arguments='', authUser='******', returnOutput=False, timeout=90):
     if authUser == 'admin':
         authUser = self.domainAdmin
         #authUser = utilities.getAdministratorUser()
     if authUser:
         options = "-u {} -w {} {}".format(authUser.name, authUser.password, options)
     if returnOutput:
         output, returnCode = self.remoteShell.run("{} {} {}".format(self.vastoolPath, options, arguments), returnOutput, timeout=timeout)
         self.remoteShell.logger.info('This is the output "{}"'.format(output))
         isSucessful = utilities.getBooleanResult(returnCode)
         return output, isSucessful
     else:
         returnCode = self.remoteShell.run("{} {} {}".format(self.vastoolPath, options, arguments), returnOutput, timeout=timeout)
         isSucessful = utilities.getBooleanResult(returnCode)
         return isSucessful
    def run(self, domain, checkOptions=None, authUser=None, authPass=None, verbose=False, csv=False, displayHelp=False):

        if authUser == None:
            authUser = self.domainAdmin.name
        if authPass == None:
            authPass = self.domainAdmin.password

        if verbose:
            verbose = "--verbose"
        else:
            verbose = ""

        if csv:
            csv = "--csv"
        else:
            csv = ""

        if displayHelp:
            displayHelp = "--help"
        else:
            displayHelp = ""

        if checkOptions == None:
            checkOptions = ""

        output, result = self.remoteShell.run(
            "{} -u {} -w {} {} {} {} {} {}".format(
                self.preflightPath, authUser, authPass, checkOptions, domain, verbose, csv, displayHelp
            ),
            returnOutput=True,
        )

        return output, utilities.getBooleanResult(result)
 def delusercheck(self, debuglevel=None):
     if debuglevel == None:
         debuglevel = ""
     else:
         debuglevel = "-dg{}".format(debuglevel)
     output, returnCode = self._run("/opt/quest/libexec/vas/vasd/delusercheck {}".format(debuglevel), returnOutput=True)
     return output, utilities.getBooleanResult(returnCode)
 def _control(self, command):
     if "AIX" in self.os:
         return self._aix('{}'.format(command))
     elif "HP-UX" in self.os:
         return self._hpux('{}'.format(command))
     elif "linux" in self.os and "fedora" in self.distro and '16' in self.osversion:
         output, rc = self.remoteShell.run("systemctl {} vasproxyd.service".format(command), True)
         return output, utilities.getBooleanResult(rc)
     else:
         return self._linuxAndSolaris('{}'.format(command))
 def uninstall(self, version="", packages=""):
     if version == "":
         version = self.getVasVersion()
     
     versionNumber = self._getVersionNumber(version)
     buildNumber = self._getBuildNumber(version)
     
     path = self._getBuildPath(versionNumber, buildNumber)
     
     result = self.remoteShell.run('{}/install.sh remove {}'.format(path, packages), timeout=1200)
     return utilities.getBooleanResult(result)
 def nst_altarch(self, user, group):
     """
     Checks NST
     
     @author: Jared Jorgensen
     @contact: [email protected]
     @since: 7-26-2010
     @version: 1.0
     
     @rtype: C{bool}
     @returns: True if successful         
     @raises TypeError: Invalid input provided
     """
     result1 = self.remoteShell.run("/opt/quest/libexec/vas/nst-altarch {} {}".format(user, group))
     return utilities.getBooleanResult(result1)
 def install(self, version, os, osversion, arch, packages="", location="", timeout=600):
     versionNumber = self._getVersionNumber(version)
     buildNumber = self._getBuildNumber(version)
     
     if packages == "":
         packages = self.getInstallPackages(os, version)
     
     if os == "HP-UX" and osversion > '11.23':
         hpPackage = self.hpuxInstallPackages(osversion, arch)
         self.copyInstallFiles(version, hpPackage)
         if location == "":
             path = "/tmp"
         
     else:
         path = self._getBuildPath(versionNumber, buildNumber)
             
     result = self.remoteShell.run('{}/install.sh -q {}'.format(path, packages), timeout=timeout)
     return utilities.getBooleanResult(result)
    def kinit(self, user, password="******", requestRenewal=False, serviceTicket=False):
        if requestRenewal:
            requestRenewal = "-R"
        else:
            requestRenewal = ""
            
        if serviceTicket:
            service = "-S"
        else:
            service = ""

        cmd = '{} -w {} kinit {} {} {}'.format(self.vastoolPath, password, requestRenewal, service, user)
        if user == "\host":
            cmd = '{} kinit {} {} \host'.format(self.vastoolPath, requestRenewal, service)
        elif user == "host/":
            cmd = '{} kinit {} {} host/'.format(self.vastoolPath, requestRenewal, service)
        
        result = self.remoteShell.run(cmd, timeout=180)
       
        return utilities.getBooleanResult(result)
 def _getMembership(self, personalityType, name, uptoolOptions, authUser, authPass, supressBacklink, resultFile, single):
  
     oresultFile = "-o {}".format(resultFile)
         
     if supressBacklink:
         supressBacklink = "-x"
     else:
         supressBacklink = ""
         
     self.remoteShell.run("{} -u {} -w {} {} membership {} -g {} {} {}".format(self.uptoolPath, authUser, authPass, uptoolOptions,
                                                                   personalityType, name, supressBacklink, oresultFile))
     
     if self.remoteShell.run("test -e {}".format(resultFile)) == 0:
         if single == None:
             output, rCode = self.remoteShell.run("cat {}".format(resultFile), returnOutput=True)
         else:
             output, rCode = self.remoteShell.run("cat {} | grep {}".format(resultFile, single), returnOutput=True)
         
         output = output.splitlines()
     else:
         output = None
         rCode = False
     
     return output, utilities.getBooleanResult(rCode)
    def _treefrogCMD(self, command, treeFrogOptions='', cmdOptions='', formatTable=False, formatList=False, timeout=90):
        """ 
        @author: Jared Jorgensen
        @since: 04-14-2011
        @version: 1.0
        
        @type command: C{str}
        @param command: Treefrog command to run.
        
        @type treeFrogOptions: C{str}
        @param treeFrogOptions: Treefrog global options. Add options in a string format separated by space. Ex. "-v -V -i"
        
        @type cmdOptions: C{str}
        @param cmdOptions: Command options specific to command running. Individual command will pass this value in
        
        @type formatTable: C{bool}
        @param formatTable: If set to true this will pipe the output into a table format
        
        @type formatList: C{bool}
        @param formatList: If set to true this will pipe the output into a list format
        
        @type timeout: C{int}
        @param timeout: (Optional) timeout used for waiting for output
        
        @rType: C{bool}
        @returns: output and exit code 
        """
        cmd = "{}{} {} {}".format(self.binPath, command, treeFrogOptions, cmdOptions)
        if formatTable and not formatList:
            cmd = "{}{} {} {} | {}format-table".format(self.binPath, command, treeFrogOptions, cmdOptions, self.binPath)
        if formatList and not formatTable:
            cmd = "{}{} {} {} | {}format-list".format(self.binPath, command, treeFrogOptions, cmdOptions, self.binPath)

        output, returnCode = self.remoteShell.run(cmd, returnOutput=True, timeout=timeout)
        isSucessful = utilities.getBooleanResult(returnCode)
        return output, isSucessful
Beispiel #12
0
 def version(self):
     output, returnCode = self.remoteShell.run("{} -v".format(self.oat), returnOutput=True)
     isSucessful = utilities.getBooleanResult(returnCode)
     return output, isSucessful
Beispiel #13
0
 def oat_changeowner_usage(self, command=""):
     output, returnCode = self.remoteShell.run("{} -h {}".format(self.oatChangeOwner, command), returnOutput=True)
     isSucessful = utilities.getBooleanResult(returnCode)
     return output, isSucessful
Beispiel #14
0
 def oat_match_usage(self):
     output, returnCode = self.remoteShell.run("{} -h".format(self.oatMatch), returnOutput=True)
     isSucessful = utilities.getBooleanResult(returnCode)
     return output, isSucessful
 def usage(self):
     result = self.remoteShell.run('%s -h container' % (self.uptoolPath))
     return utilities.getBooleanResult(result)
     
 def passwd(self, userName=None, password=None, oldPassword=None, verifyPassword=None, shHandle=None):
     result1 = super(aixComputer, self).passwd(userName, password, oldPassword, verifyPassword, shHandle)
     result2 = utilities.getBooleanResult(self.remoteShell.run("pwdadm -c %s" % userName))
     return result1 and result2
 def _linuxAndSolaris(self, command):
     output, result = self.remoteShell.run("/etc/init.d/vasproxyd {}".format(command), True)
     result = utilities.getBooleanResult(result)
     return output, result
 def _hpux(self, command):
     output, result = self.remoteShell.run("/sbin/init.d/vasproxyd {}".format(command), True)
     result = utilities.getBooleanResult(result)
     return output, result
 def verifyGroupOverride(self):
     output, exitCode = self._run("/opt/quest/libexec/vas/sqlite3 /var/opt/quest/vas/vasd/vas_ident.vdb 'select * from group_ovrd;'", returnOutput=True)
     return output, utilities.getBooleanResult(exitCode)
 def stop_in_debug(self):
     rc = self.remoteShell.run("kill {}".format(self.pid))
     return utilities.getBooleanResult(rc)
 def getConnectedStatus(self):
     returnCode = self._run("/opt/quest/libexec/vas/sugi/asdcom GetConnectedStatus")
     return utilities.getBooleanResult(returnCode)
 def checkUserADTable(self):
     output, exitCode = self._run("/opt/quest/libexec/vas/sqlite3 /var/opt/quest/vas/vasd/vas_ident.vdb 'select * from user_ad;'", returnOutput=True)
     return output, utilities.getBooleanResult(exitCode)
 def version(self):
     output, result = self.remoteShell.run("{} -v".format(self.uptoolPath), returnOutput=True)
     return output, utilities.getBooleanResult(result)
 def usage(self):
     output, result = self.remoteShell.run("%s -h" % (self.uptoolPath), returnOutput=True)
     return output, utilities.getBooleanResult(result)
 def vasdis_helper(self, args=""):
     returnCode = self._run("/opt/quest/libexec/vas/vasd/vasdis_helper {}".format(args))
     return utilities.getBooleanResult(returnCode)
 def usage(self):
     output, result = self.remoteShell.run("{} -h membership".format(self.uptoolPath), returnOutput=True)
     return output, utilities.getBooleanResult(result)
 def usage(self):
     result = self.remoteShell.run('%s -h depopulate' % (self.uptoolPath))
     return utilities.getBooleanResult(result)
     
 def run(self, arguments='', options='', authUser='******', returnOutput=True, timeout=60):
     output, returnCode = self.remoteShell.run('{} {} {}'.format(self.command, options, arguments), returnOutput, timeout=timeout)
     returnCode = utilities.getBooleanResult(returnCode)
     return output, returnCode