Page MenuHomePhabricator

agent to archive (or de-archive) crontabs for disabled or re-enabled tools
Closed, ResolvedPublic

Description

An agent will need to run on the toolforge cron submission host. It will check ldap for disabled tools and ensure that the crontab for that tool is archived to the tool's local directory. It will also have to search for all archived crontabs and re-enable them for any active tool.

Event Timeline

Change 699927 had a related patch set uploaded (by Andrew Bogott; author: Andrew Bogott):

[cloud/toolforge@main] Add 'disable_tools.py', a catch-all project for disabling tools

https://gerrit.wikimedia.org/r/699927

Change 699927 abandoned by Andrew Bogott:

[cloud/toolforge@main] Add 'disable_tools.py', a catch-all project for disabling tools

Reason:

This is in a different repo

https://gerrit.wikimedia.org/r/699927

Change 706034 had a related patch set uploaded (by Andrew Bogott; author: Andrew Bogott):

[operations/puppet@production] toolforge grid-engine cron: use disable_tool.py to archive crontab for disabled tools

https://gerrit.wikimedia.org/r/706034

Change 706034 merged by Andrew Bogott:

[operations/puppet@production] toolforge cron: use disable_tool.py to archive crontab for disabled tools

https://gerrit.wikimedia.org/r/706034

This agent is failing just now, like this:

Aug  5 21:55:02 labstore1004 disable_tool.py[38376]: Traceback (most recent call last):
Aug  5 21:55:02 labstore1004 disable_tool.py[38376]:   File "/srv/disable-tool/disable_tool.py", line 539, in <module>
Aug  5 21:55:02 labstore1004 disable_tool.py[38376]:     args.func(config)
Aug  5 21:55:02 labstore1004 disable_tool.py[38376]:   File "/srv/disable-tool/disable_tool.py", line 409, in archive
Aug  5 21:55:02 labstore1004 disable_tool.py[38376]:     if _is_expired(datestamp, int(conf["default"]["archive_after_days"])):
Aug  5 21:55:02 labstore1004 disable_tool.py[38376]:   File "/srv/disable-tool/disable_tool.py", line 128, in _is_expired
Aug  5 21:55:02 labstore1004 disable_tool.py[38376]:     LOG.info("Elapsed days is %s" % (datetime.datetime.now() - datestamp).days)
Aug  5 21:55:02 labstore1004 disable_tool.py[38376]: TypeError: unsupported operand type(s) for -: 'datetime.datetime' and 'datetime.date'
Aug  5 21:55:02 labstore1004 systemd[1]: disable-tool.service: Main process exited, code=exited, status=1/FAILURE
Aug  5 21:55:02 labstore1004 systemd[1]: disable-tool.service: Unit entered failed state.
Aug  5 21:55:02 labstore1004 systemd[1]: disable-tool.service: Failed with result 'exit-code'.

I believe this to be fixed