Changeset 1468 for trunk/server
- Timestamp:
- Feb 17, 2010, 11:44:13 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server/common/oursrc/hacron/hacron
r1467 r1468 27 27 28 28 class HacronError(Exception): 29 def __init__(self, errno, msg='Something went wrong'):30 self. errno =errno29 def __init__(self, ocf_errno, msg='Something went wrong'): 30 self.ocf_errno = ocf_errno 31 31 self.msg = msg 32 32 logger.error(msg) … … 83 83 def _remove(dest): 84 84 if not path.exists(dest) and not path.islink(dest): 85 logger. info('Tried to remove nonexistant path %s' % dest)85 logger.error('Tried to remove nonexistant path %s' % dest) 86 86 return True 87 87 … … 142 142 143 143 def start_cron(args, options): 144 if not _touch(_serverfile(HOSTNAME)): 144 serverfile = _serverfile(HOSTNAME) 145 if not _touch(serverfile): 146 logger.error('Could not touch %s' % serverfile) 145 147 return OCF_ERR_CONFIGURED 146 148 elif _is_master(HOSTNAME): … … 167 169 try: 168 170 _restart_crond(args, options) 169 except OSError, e:170 return e. errno171 except HacronException, e: 172 return e.ocf_errno 171 173 return OCF_SUCCESS 172 174 … … 184 186 try: 185 187 _restart_crond(args, options) 186 except OSError, e:187 return e. errno188 except HacronException, e: 189 return e.ocf_errno 188 190 return OCF_SUCCESS 189 191 … … 199 201 if not _touch(_serverfile(HOSTNAME)): 200 202 logger.error('Could not touch %s' % _serverfile(HOSTNAME)) 201 return OCF_ GENERIC_ERR203 return OCF_ERR_GENERIC 202 204 elif not path.exists(CRONSPOOL_DIR): 203 return OCF_ GENERIC_ERR205 return OCF_ERR_GENERIC 204 206 else: 205 207 return OCF_SUCCESS … … 216 218 """Remove servers from the list of available ones.""" 217 219 for server in servers: 218 os.unlink(_serverfile(server)) 220 _remove(_serverfile(server)) 221 _remove(_crondir(server)) 222 logger.info('Removed %s from list of available ones' % server) 223 219 224 220 225 def meta_data_cron(args, options): … … 325 330 _set_globals(args, options) 326 331 except HacronError, e: 327 return e. errno332 return e.ocf_errno 328 333 329 334 with lock('%s/hacron-%s.lock' % (HA_RSCTMP, OCF_RESOURCE_INSTANCE)):
Note: See TracChangeset
for help on using the changeset viewer.