コード例 #1
0
    def _read_config(self):
        if not os.path.exists(self.config_path):
            sys.stderr.write("Config file does not exist: %s\n" % self.config_path)
            sys.exit(1)

        c = ConfigParser()
        config = c.add_file(self.config_path)
        try:
            self.username = c.add_option('username', keys = self.stanza).get()
            self.password = c.add_option('password', keys = self.stanza).get()
            self.web_address = c.add_option('web_address', keys = self.stanza).get()
            self.no_ssl_cert_check = c.add_option('no_ssl_cert_check', keys = self.stanza).get()
            self.cafile = c.add_option('cafile', keys = self.stanza).get()
        except Exception, e:
            sys.stderr.write("Faled to parse config - %s\n" % e)
            sys.exit(1)