99 | | adminconf = ConfigParser.ConfigParser() |
100 | | filename = os.path.join(self.directory, "pykotadmin.conf") |
101 | | adminconf.read([filename]) |
102 | | if adminconf.sections() : # were we able to read the file ? |
103 | | try : |
104 | | backendinfo["storageadmin"] = adminconf.get("global", "storageadmin", raw=1) |
105 | | except (ConfigParser.NoSectionError, ConfigParser.NoOptionError) : |
106 | | raise PyKotaConfigError, _("Option %s not found in section global of %s") % ("storageadmin", filename) |
107 | | else : |
108 | | self.isAdmin = 1 # We are a PyKota administrator |
109 | | try : |
110 | | backendinfo["storageadminpw"] = adminconf.get("global", "storageadminpw", raw=1) |
111 | | except (ConfigParser.NoSectionError, ConfigParser.NoOptionError) : |
112 | | pass # Password is optional |
| 104 | if self.isAdmin : |
| 105 | adminconf = ConfigParser.ConfigParser() |
| 106 | adminconf.read([self.adminfilename]) |
| 107 | if adminconf.sections() : # were we able to read the file ? |
| 108 | try : |
| 109 | backendinfo["storageadmin"] = adminconf.get("global", "storageadmin", raw=1) |
| 110 | except (ConfigParser.NoSectionError, ConfigParser.NoOptionError) : |
| 111 | raise PyKotaConfigError, _("Option %s not found in section global of %s") % ("storageadmin", self.adminfilename) |
| 112 | try : |
| 113 | backendinfo["storageadminpw"] = adminconf.get("global", "storageadminpw", raw=1) |
| 114 | except (ConfigParser.NoSectionError, ConfigParser.NoOptionError) : |
| 115 | pass # Password is optional |
| 116 | # Now try to overwrite the storagebackend, storageserver |
| 117 | # and storagename. This allows admins to use the master LDAP |
| 118 | # server directly and users to use the replicas transparently. |
| 119 | try : |
| 120 | backendinfo["storagebackend"] = adminconf.get("global", "storagebackend", raw=1) |
| 121 | except ConfigParser.NoOptionError : |
| 122 | pass |
| 123 | try : |
| 124 | backendinfo["storageserver"] = adminconf.get("global", "storageserver", raw=1) |
| 125 | except ConfigParser.NoOptionError : |
| 126 | pass |
| 127 | try : |
| 128 | backendinfo["storagename"] = adminconf.get("global", "storagename", raw=1) |
| 129 | except ConfigParser.NoOptionError : |
| 130 | pass |