Exemplo n.º 1
0
    def init_nodepool(self):
        from nodepool import nodedb, nodepool
        self.nodedb = nodedb

        self.pool = nodepool.NodePool(Configuration().NODEPOOL_CONFIG)
        config = self.pool.loadConfig()
        self.pool.reconfigureDatabase(config)
        self.pool.setConfig(config)
Exemplo n.º 2
0
    def main(self):
        # commands which do not need to start-up or parse config
        if self.args.command in ('config-validate'):
            return self.args.func()

        self.pool = nodepool.NodePool(self.args.secure, self.args.config)
        config = self.pool.loadConfig()
        self.pool.reconfigureDatabase(config)
        self.pool.setConfig(config)
        self.args.func()
Exemplo n.º 3
0
    def main(self):
        self.parse_arguments()

        if self.args.version:
            from nodepool.version import version_info as npc_version_info
            print "Nodepool version: %s" % npc_version_info.version_string()
            return (0)

        self.pool = nodepool.NodePool(self.args.config)
        config = self.pool.loadConfig()
        self.pool.reconfigureDatabase(config)
        self.pool.setConfig(config)
        self.args.func()
Exemplo n.º 4
0
    def main(self):
        # commands which do not need to start-up or parse config
        if self.args.command in ('config-validate'):
            return self.args.func()

        self.pool = nodepool.NodePool(self.args.secure, self.args.config)
        config = self.pool.loadConfig()
        if self.args.command in ('dib-image-delete', 'dib-image-list',
                                 'image-build', 'image-delete',
                                 'image-upload', 'image-update'):
            self.pool.reconfigureGearmanClient(config)
        self.pool.reconfigureDatabase(config)
        self.pool.setConfig(config)
        self.args.func()
Exemplo n.º 5
0
    def main(self):
        self.zk = None

        # commands which do not need to start-up or parse config
        if self.args.command in ('config-validate'):
            return self.args.func()

        self.pool = nodepool.NodePool(self.args.secure, self.args.config)
        config = self.pool.loadConfig()

        # commands needing ZooKeeper
        if self.args.command in ('image-build', 'dib-image-list', 'image-list',
                                 'dib-image-delete', 'image-delete',
                                 'alien-image-list'):
            self.zk = zk.ZooKeeper()
            self.zk.connect(config.zookeeper_servers.values())
        else:
            self.pool.reconfigureDatabase(config)

        self.pool.setConfig(config)
        self.args.func()

        if self.zk:
            self.zk.disconnect()
Exemplo n.º 6
0
 def useNodepool(self, *args, **kwargs):
     args = (self.secure_conf, ) + args
     pool = nodepool.NodePool(*args, **kwargs)
     self.addCleanup(pool.stop)
     return pool