当前位置: 首页>>代码示例>>Python>>正文


Python Util.printDetail方法代码示例

本文整理汇总了Python中stratuslab.Util.printDetail方法的典型用法代码示例。如果您正苦于以下问题:Python Util.printDetail方法的具体用法?Python Util.printDetail怎么用?Python Util.printDetail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在stratuslab.Util的用法示例。


在下文中一共展示了Util.printDetail方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: listVms

# 需要导入模块: from stratuslab import Util [as 别名]
# 或者: from stratuslab.Util import printDetail [as 别名]
    def listVms(self, showVmsFromAllUsers=False):
        fromAllUsers = -2
        currentUserOnly = -3

        if showVmsFromAllUsers:
            visibilitySwitch = fromAllUsers
        else:
            visibilitySwitch = currentUserOnly

        # Hack to retry on SSL errors.
        maxRetries = 3
        retries = 0
        while True:
            try:
                ret, info, _ = self._rpc.one.vmpool.info(self._sessionString, visibilitySwitch, -1, -1, -1)
                break
            except ssl.SSLError as e:
                retries += 1
                t = strftime("%Y-%m-%d %H:%M:%S", gmtime())
                Util.printDetail('SSL ERROR ENCOUNTERED (%s): %s' % (t, str(e)))
                if retries >= maxRetries:
                    raise e

        if not ret:
            raise OneException(info)

        vmlist = Util.etree_from_text(info)
        for xml in vmlist.findall('VM'):
            self._addStateSummary(xml)

        return etree.tostring(vmlist)
开发者ID:StratusLab,项目名称:client,代码行数:33,代码来源:one.py

示例2: _generateOpensslConfig

# 需要导入模块: from stratuslab import Util [as 别名]
# 或者: from stratuslab.Util import printDetail [as 别名]
    def _generateOpensslConfig(self):
        config = """
[ req ]
distinguished_name     = req_distinguished_name
x509_extensions        = v3_ca
prompt                 = no
input_password         = %(certPassword)s
output_password        = %(certPassword)s

dirstring_type = nobmp

[ req_distinguished_name ]
C = EU
O = StratusLab Project
OU = Testing Department
CN = %(commonName)s

[ v3_ca ]
basicConstraints = CA:false
nsCertType=client, email, objsign
keyUsage=critical, digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment, keyAgreement
subjectKeyIdentifier=hash
authorityKeyIdentifier=keyid:always,issuer:always
subjectAltName=email:%(subjectEmail)s
""" % self.configHolder.options

        conf_filename = os.path.join(self.tmp_dir, 'openssl.cfg')
        open(conf_filename, 'w').write(config)

        Util.printDetail("Generated openssl configuration in: %s" % conf_filename,
                         self.configHolder.verboseLevel)
        Util.printDetail("Openssl configuration: %s" % open(conf_filename).read(),
                         self.configHolder.verboseLevel,
                         Util.VERBOSE_LEVEL_DETAILED)
开发者ID:StratusLab,项目名称:client,代码行数:36,代码来源:CertGenerator.py

示例3: addNetworkAcl

# 需要导入模块: from stratuslab import Util [as 别名]
# 或者: from stratuslab.Util import printDetail [as 别名]
    def addNetworkAcl(self, users, net_id_int, rights):
        """
        users - hex
        net_id_int - integer, network ID
        rights - hex
        """
        # "magic" number
        _magic = self.ACL_USERS['UID']
        net_resource = hex(self.ACL_RESOURCES['NET'] + _magic + net_id_int)

        # Hack to retry on SSL errors
        maxRetries = 3
        retries = 0
        while True:
            try:
                ret, info, _ = self._rpc.one.acl.addrule(self._sessionString,
                                                         users,
                                                         net_resource,
                                                         rights)
                break
            except ssl.SSLError as e:
                retries += 1
                t = strftime("%Y-%m-%d %H:%M:%S", gmtime())
                Util.printDetail('SSL ERROR ENCOUNTERED (%s): %s' % (t, str(e)))
                if retries >= maxRetries:
                    raise e

        if not ret:
            raise OneException(info)

        return info
开发者ID:StratusLab,项目名称:client,代码行数:33,代码来源:one.py

示例4: _startDhcp

# 需要导入模块: from stratuslab import Util [as 别名]
# 或者: from stratuslab.Util import printDetail [as 别名]
    def _startDhcp(self):
        Util.printDetail('(Re)Starting DHCP server.')

        serviceName = self.packages['dhcp'].initdScriptName
        rc = self.restartService(serviceName)

        if rc != 0:
            Util.printError('Failed to (re)start DHCP service.')
开发者ID:remyd1,项目名称:client,代码行数:10,代码来源:BaseSystem.py

示例5: _configureVirtualNetInterface

# 需要导入模块: from stratuslab import Util [as 别名]
# 或者: from stratuslab.Util import printDetail [as 别名]
    def _configureVirtualNetInterface(self, device, ip, netmask):
        device = device + ":privlan"

        Util.printDetail("Configuring network interface %s." % device)
        self._configureNetworkInterface(device, ip, netmask)

        Util.printDetail("Starting network interface %s." % device)
        self.executeCmd(["ifup", device])
开发者ID:StratusLab,项目名称:client,代码行数:10,代码来源:BaseSystem.py

示例6: _installDhcp

# 需要导入模块: from stratuslab import Util [as 别名]
# 或者: from stratuslab.Util import printDetail [as 别名]
    def _installDhcp(self):
        Util.printDetail('Installing DHCP server.')

        dhcpPackage = self.getPackageName('dhcp')
        self.installPackages([dhcpPackage])

        if not self.isPackageInstalled(dhcpPackage):
            Util.printError('Failed to install %s.' % dhcpPackage)
开发者ID:remyd1,项目名称:client,代码行数:10,代码来源:BaseSystem.py

示例7: doWork

# 需要导入模块: from stratuslab import Util [as 别名]
# 或者: from stratuslab.Util import printDetail [as 别名]
 def doWork(self):
     configHolder = ConfigHolder(self.options.__dict__)
     signator = Signator(self.manifestFile, configHolder)
     isError = signator.sign()
     if isError:
         Util.printError('Error signing metadata file')
     else:
         Util.printDetail('Metadata file successfully signed: %s' % signator.outputManifestFile)
开发者ID:StratusLab,项目名称:client,代码行数:10,代码来源:stratus_sign_metadata.py

示例8: _saveFirewallRules

# 需要导入模块: from stratuslab import Util [as 别名]
# 或者: from stratuslab.Util import printDetail [as 别名]
    def _saveFirewallRules(self, filename):
        # back-up
        self.executeCmd(('cp -fp %s %s.LAST'%((filename,)*2)).split(' '))

        _,output = self.executeCmdWithOutput(['iptables-save'])
        Util.printDetail('Saving firewall rules to %s.' % filename)
        filePutContent(filename, output)
        os.chmod(filename, 0600)
开发者ID:remyd1,项目名称:client,代码行数:10,代码来源:BaseSystem.py

示例9: buildAndSave

# 需要导入模块: from stratuslab import Util [as 别名]
# 或者: from stratuslab.Util import printDetail [as 别名]
 def buildAndSave(self, filename=''):
     manifestText = self.build()
     if not filename:
         filename = '%s-%s-%s-%s-%s%s' % (self.os, self.osversion,
                                          self.arch, self.type,
                                          self.version, Util.manifestExt)
     Util.filePutContent(filename, manifestText)
     Util.printDetail("Manifest: %s" % filename, self.verboseLevel,
                      Util.VERBOSE_LEVEL_DETAILED)
开发者ID:StratusLab,项目名称:client,代码行数:11,代码来源:ManifestInfo.py

示例10: _installFetchCrl

# 需要导入模块: from stratuslab import Util [as 别名]
# 或者: from stratuslab.Util import printDetail [as 别名]
 def _installFetchCrl(self):
     """fetch-crl 3:
     http://www.nikhef.nl/grid/fetchcrl3
     http://dist.eugridpma.info/distribution/util/fetch-crl3/
     """
     Util.printDetail('NB! Installation of fetch-crl is not implemented for Ubuntu.')
     Util.printDetail("""For manual installation see:
     http://www.nikhef.nl/grid/fetchcrl3
     http://dist.eugridpma.info/distribution/util/fetch-crl3/""")
开发者ID:StratusLab,项目名称:client,代码行数:11,代码来源:ubuntu.py

示例11: _installCAs

# 需要导入模块: from stratuslab import Util [as 别名]
# 或者: from stratuslab.Util import printDetail [as 别名]
 def _installCAs(self):
     """CA:
     https://wiki.egi.eu/wiki/EGI_IGTF_Release
     http://repository.egi.eu/sw/production/cas/1/current/tgz/
     """
     Util.printDetail('NB! Installation of CA is not implemented for Ubuntu.')
     Util.printDetail("""For manual installation see:
     https://wiki.egi.eu/wiki/EGI_IGTF_Release
     http://repository.egi.eu/sw/production/cas/1/current/tgz/""")
     self._installFetchCrl()
开发者ID:StratusLab,项目名称:client,代码行数:12,代码来源:ubuntu.py

示例12: isPackageInstalled

# 需要导入模块: from stratuslab import Util [as 别名]
# 或者: from stratuslab.Util import printDetail [as 别名]
    def isPackageInstalled(self, package):
        cmd = self.getIsPackageInstalledCommand(package)

        rc, output = self._executeWithOutput(cmd, shell=True)

        if rc != 0:
            Util.printDetail(output)
            return False

        return True
开发者ID:remyd1,项目名称:client,代码行数:12,代码来源:BaseSystem.py

示例13: installCAs

# 需要导入模块: from stratuslab import Util [as 别名]
# 或者: from stratuslab.Util import printDetail [as 别名]
    def installCAs(self):
        def _isCertificateAuthority():
            return Util.isTrueConfVal(getattr(self, 'certificateAuthority', False))

        if not _isCertificateAuthority():
            Util.printDetail('Requested not to install CAs.')
        else:
            self._installCAs()
            self._installFetchCrl()
            self._enableFetchCrl()
            self._installVomsFiles()
开发者ID:remyd1,项目名称:client,代码行数:13,代码来源:BaseSystem.py

示例14: _configureCloudAdminSudo

# 需要导入模块: from stratuslab import Util [as 别名]
# 或者: from stratuslab.Util import printDetail [as 别名]
    def _configureCloudAdminSudo(self, commands):
        Util.printDetail("Configuring sudo rights for '%s'" % self.oneUsername)
        for cmd in commands:
            replace = '%s ALL = NOPASSWD: %s' % (self.oneUsername, cmd)
            self.appendOrReplaceInFileCmd('/etc/sudoers', '%s' % replace, replace)

        replace = 'Defaults:%s !requiretty' % self.oneUsername
        self.appendOrReplaceInFileCmd('/etc/sudoers', '%s' % replace, replace)

        replace = 'Defaults:%s !requiretty' % 'root'
        self.appendOrReplaceInFileCmd('/etc/sudoers', '%s' % replace, replace)
开发者ID:remyd1,项目名称:client,代码行数:13,代码来源:BaseSystem.py

示例15: configureCloudAdminPdiskNode

# 需要导入模块: from stratuslab import Util [as 别名]
# 或者: from stratuslab.Util import printDetail [as 别名]
    def configureCloudAdminPdiskNode(self):
        pdiskAttach = "/usr/sbin/attach-persistent-disk.sh"
        pdiskDetach = "/usr/sbin/detach-persistent-disk.sh"

        if Util.isFalseConfVal(getattr(self, "persistentDisks", False)):
            self.executeCmd('"[ -f %(pd)s ] || { touch %(pd)s; chmod +x %(pd)s; }"' % {"pd": pdiskDetach}, shell=True)
            return

        Util.printDetail("Configuring persistent disks management for " "'%s' user." % self.oneUsername)

        line = "oneadmin ALL = NOPASSWD: %s, %s" % (pdiskAttach, pdiskDetach)
        self.appendOrReplaceInFileCmd("/etc/sudoers", "^%s.*persistent-disk.*$" % self.oneUsername, line)
开发者ID:StratusLab,项目名称:client,代码行数:14,代码来源:BaseSystem.py


注:本文中的stratuslab.Util.printDetail方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。