コード例 #1
0
ファイル: BaseSystem.py プロジェクト: StratusLab/client
    def configureCloudAdminSshKeysNode(self):

        self.createDirsCmd("%s/.ssh/" % self.oneHome)
        self.setOwnerCmd("%s/.ssh/" % self.oneHome)

        # FIXME: why ssh key-pair from the Frontend is pushed to the Node?
        #        ssh-keygen on the Node should be used to generate the user
        #        specific ssh key-pair on that machine.
        oneKey = fileGetContent("%s/.ssh/id_rsa" % self.oneHome)
        self._filePutContentAsOneAdmin("%s/.ssh/id_rsa" % self.oneHome, oneKey)

        oneKeyPub = fileGetContent("%s/.ssh/id_rsa.pub" % self.oneHome)
        self._filePutContentAsOneAdmin("%s/.ssh/authorized_keys" % self.oneHome, oneKeyPub)
        self.chmodCmd("%s/.ssh/id_rsa" % self.oneHome, 0600)

        self._configureCloudAdminSsh()
コード例 #2
0
    def _buildFixedNetworkTemplate(self, networkName):
        vnetTpl = fileGetContent(join(Defaults.SHARE_DIR, "vnet/fixed.net"))

        ips = self._getIPs(networkName)
        macs = self._getMACs(networkName)
        leases = ['LEASES = [ IP="%s", MAC="%s"]' % (ip, mac) for ip, mac in zip(ips, macs)]

        vnetTpl = vnetTpl % (
            {"network_name": networkName, "bridge": self.config.get("node_bridge_name"), "leases": "\n".join(leases)}
        )
        return vnetTpl
コード例 #3
0
 def _buildRangedNetworkTemplate(self, networkName):
     vnetTpl = fileGetContent(join(Defaults.SHARE_DIR, "vnet/ranged.net"))
     vnetTpl = vnetTpl % (
         {
             "network_name": networkName,
             "bridge": self.config.get("node_bridge_name"),
             "network_size": self.config.get("one_%s_network_size" % networkName),
             "network_addr": self.config.get("one_%s_network" % networkName),
         }
     )
     return vnetTpl
コード例 #4
0
ファイル: PersistentDisk.py プロジェクト: StratusLab/client
    def _extractPdiskPassword(self):

        pswd = self._randomPassword()

        if not os.path.isfile(self.authnConfigFile):
            lines = []
        else:
            fileContent = fileGetContent(self.authnConfigFile)
            lines = fileContent.split('\n')

        pattern = '^\s*%s\s*=\s*([\w-]+)(?:\s*,.*)?$' % (self.pdiskUsername)
        search = re.compile(pattern)

        for line in lines:
            if search.match(line):
                pswd = search.findall(line)[0]

        return pswd
コード例 #5
0
    def _configurePolicies(self):
        oneAuthTpl = self._getTemplateFile("quota.conf.tpl", "ONE auth configuration")
        authConfFile = self.cloudConfDir + "auth/quota.conf"

        self.quotaMemoryKB = getValueInKB(self.quotaMemory)
        self.frontend.filePutContentsCmd(authConfFile, fileGetContent(oneAuthTpl) % self.__dict__)
コード例 #6
0
 def _configureOneDaemon(self):
     onedTpl = self._getTemplateFile("oned.conf.tpl", "ONe daemon configuration")
     conf = self.config.copy()
     conf["vm_dir"] = self.cloudVarLibDir
     self.frontend.filePutContentsCmd(self.cloudConfFile, fileGetContent(onedTpl) % conf)
コード例 #7
0
ファイル: Consolidation.py プロジェクト: StratusLab/client
 def _writeConfigFromTemplate(self, config, tpl):
     filePutContent(config,
                    fileGetContent(tpl) % self.__dict__)
コード例 #8
0
ファイル: PolicyValidator.py プロジェクト: StratusLab/client
 def _writeConfigFromTemplate(self):
     filePutContent(PolicyValidator.CONFIG,
                     fileGetContent(PolicyValidator.TEMPLATE_CFG) % self.__dict__)
コード例 #9
0
ファイル: PersistentDisk.py プロジェクト: StratusLab/client
 def _writePdiskBackendConfig(self):
     printStep('Writing backend configuration...')
     config = self.__dict__.copy()
     config['persistentDiskBackendSections'] = self._stripMultiLineValue(config['persistentDiskBackendSections'])
     self.system._remoteFilePutContents(self.pdiskConfigBackendFile,
                                        fileGetContent(self.pdiskConfigBackendTpl) % config)