Skip to content
Snippets Groups Projects
Commit 346134dd authored by Sybren A. Stüvel's avatar Sybren A. Stüvel
Browse files

Added `--reregister` CLI option to re-register this worker at its Manager.

WARNING: this can cause duplicate worker information in the Manager's
database.

This makes it easier to re-register workers; now this can be used, rather
than editing ~/.flamenco-worker.cfg. Since that file is likely to have been
created by the Worker itself, the user may not even know it exists.
parent c9234a2c
Branches
Tags
No related merge requests found
......@@ -6,6 +6,8 @@ changed functionality, fixed bugs).
## Version 2.0.6 (in development)
- Fixed incompatibility with attrs version 17.1+.
- Added `--reregister` CLI option to re-register this worker at its Manager.
WARNING: this can cause duplicate worker information in the Manager's database.
## Version 2.0.5 (released 2017-05-09)
......
......@@ -16,6 +16,10 @@ def main():
parser.add_argument('-v', '--verbose', action='store_true',
help='Show configuration before starting, '
'and asyncio task status at shutdown.')
parser.add_argument('-r', '--reregister', action='store_true',
help="Erases authentication information and re-registers this worker "
"at the Manager. WARNING: this can cause duplicate worker information "
"in the Manager's database.")
args = parser.parse_args()
# Load configuration
......@@ -26,6 +30,11 @@ def main():
log = logging.getLogger(__name__)
log.debug('Starting')
if args.reregister:
log.warning('Erasing worker_id and worker_secret so we can attempt re-registration.')
confparser.erase('worker_id')
confparser.erase('worker_secret')
# Patch AsyncIO
from . import patch_asyncio
patch_asyncio.patch_asyncio()
......
......@@ -45,6 +45,9 @@ class ConfigParser(configparser.ConfigParser):
secs = self.value(key, float)
return datetime.timedelta(seconds=secs)
def erase(self, key: str) -> bool:
return self.set(CONFIG_SECTION, key, '')
def merge_with_home_config(new_conf: dict):
"""Updates the home configuration file with the given config dict."""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment