diff --git a/tools/install-plugin-fleet.py b/tools/install-plugin-fleet.py index 42d261fc..8a2ec43c 100644 --- a/tools/install-plugin-fleet.py +++ b/tools/install-plugin-fleet.py @@ -75,11 +75,11 @@ def verify_dunechest_fleet_target(sid, root, unit, incoming, installed): def plan(artifacts, inventory, expected_source): mode=inventory.get('mode') - if mode not in {'gui-preserve-backends','pillager-preserve-economy','arrakis-crysknife','navigator','planet-dunechest','fleet-dunechest','arrakis-raw-spice','arrakis-jerboa','compact-menus','lobby-food','lobby-account','arrakis-dunegroups','fleet-dunegroups','arrakis-dunechat'}: + if mode not in {'gui-preserve-backends','pillager-preserve-economy','arrakis-crysknife','navigator','planet-dunechest','fleet-dunechest','arrakis-raw-spice','arrakis-jerboa','compact-menus','lobby-food','lobby-account','arrakis-dunegroups','fleet-dunegroups','arrakis-dunechat','fleet-dunechat'}: raise ValueError('An explicit supported rollout mode is required') compact_menus=mode=='compact-menus' dunegroups=mode in {'arrakis-dunegroups','fleet-dunegroups'} - dunechat=mode=='arrakis-dunechat' + dunechat=mode in {'arrakis-dunechat','fleet-dunechat'} lobby_food=mode=='lobby-food' lobby_account=mode=='lobby-account' jerboa=mode=='arrakis-jerboa' @@ -199,15 +199,18 @@ def plan(artifacts, inventory, expected_source): if raw_spice and (sid != 'arrakis' or root != ARRAKIS_ROOT or unit != 'dune-arrakis.service' or wanted != {'jarvistranslator'} or selected_prerequisites): raise ValueError('Raw spice rollout may only replace JARVIS on Arrakis') - if dunechat and (sid != 'arrakis' or root != ARRAKIS_ROOT or unit != 'dune-arrakis.service' - or wanted != {'dunechat'} or selected_prerequisites): - raise ValueError('DuneChat canary requires the exact Arrakis service and standalone plugin') if dunegroups: target = Path('/opt/dunerealms/lobby') if sid == 'lobby' else Path('/opt/dunerealms/servers') / sid approved = {'arrakis'} if mode == 'arrakis-dunegroups' else DUNECHEST_PLANETS | {'lobby'} if (sid not in approved or root != target or unit != f'dune-{sid}.service' or wanted != {'jarvistranslator','dunegroups'} or selected_prerequisites): raise ValueError('DuneGroups requires an exact reviewed server and plugin pair') + if dunechat: + target = Path('/opt/dunerealms/lobby') if sid == 'lobby' else Path('/opt/dunerealms/servers') / sid + approved = {'arrakis'} if mode == 'arrakis-dunechat' else DUNECHEST_PLANETS | {'lobby'} + if (sid not in approved or root != target or unit != f'dune-{sid}.service' + or wanted != {'dunechat'} or selected_prerequisites): + raise ValueError('DuneChat requires an exact reviewed server and standalone plugin') if lobby_food and (sid != 'lobby' or root != Path('/opt/dunerealms/lobby') or unit != 'dune-lobby.service' or wanted != {'jarvistranslator'} or selected_prerequisites): raise ValueError('Lobby food rollout may only replace JARVIS on Lobby') @@ -421,19 +424,19 @@ def plan(artifacts, inventory, expected_source): for path in sorted(plugins.glob('*.jar')) if path.name not in replaced] configurations = [] if dunechat: - from plugin_dunechat import DISCORD_CONFIG, DISCORD_JAR, enable_modern_discord + from plugin_dunechat import DISCORD_CONFIGS, DISCORD_JAR, enable_modern_discord discord = existing_paths.get('discordsrv') if (discord is None or discord.name != 'DiscordSRV.jar' or digest(discord) != DISCORD_JAR or not {'jarvistranslator', 'dunegroups'} <= existing_paths.keys() or 'medievalfactions' in existing_paths or 'dunechat' in existing_paths): raise ValueError('DuneChat requires the reviewed Discord relay, retained JARVIS and DuneGroups') config = plugins/'DiscordSRV/config.yml' - if config.is_symlink() or config.parent.is_symlink() or digest(config) != DISCORD_CONFIG: - raise ValueError('Unexpected private Arrakis DiscordSRV config revision') + if config.is_symlink() or config.parent.is_symlink() or digest(config) != DISCORD_CONFIGS[sid]: + raise ValueError('Unexpected private DiscordSRV config revision') updated = enable_modern_discord(config.read_bytes().decode('utf-8')).encode('utf-8') configurations.append({'path': 'DiscordSRV/config.yml', 'transform': 'enable-modern-discord', 'sha256': hashlib.sha256(updated).hexdigest(), - 'previousSha256': DISCORD_CONFIG, 'previousMetadata': metadata(config)}) + 'previousSha256': DISCORD_CONFIGS[sid], 'previousMetadata': metadata(config)}) retained = [{'filename': path.name, 'sha256': digest(path), 'metadata': metadata(path)} for path in sorted(plugins.glob('*.jar'))] if dunegroups: diff --git a/tools/plugin_dunechat.py b/tools/plugin_dunechat.py index d20296b7..51c7eaf5 100644 --- a/tools/plugin_dunechat.py +++ b/tools/plugin_dunechat.py @@ -4,7 +4,14 @@ import hashlib import re -DISCORD_CONFIG = 'ea5460f59766315e47e343e0a6d88deb71232df065f7bde0074ab742c8f65b4d' +DISCORD_CONFIGS = { + 'arrakis': 'ea5460f59766315e47e343e0a6d88deb71232df065f7bde0074ab742c8f65b4d', + 'caladan': 'b5e49f560c8ff43d0d49002dc6844e30c81449bd220c51e151b9f47215e71c14', + 'giedi_prime': 'd1bc9a45a59813f3c2b8e1478e854ea193a272c69bc78b84ac542b178fd575f1', + 'kaitain': '4f962d0225a934906a96b095933816505801e702dab8633456d6e9daa8aa131f', + 'sigma_draconis_iv': '5ce962eae27af1af1bcf6527bb840a80bc44b921745416e318b8ce002ddca597', + 'lobby': 'b95c7ed186c048ee4ca88d3c7eaa6962eb6228525b1ecb09f11727e41df21924', +} DISCORD_JAR = 'ef2fa1f2eb146c7c77412b7190a7dd33f1fc91282683fe45407739554c8aefef' diff --git a/tools/plugin_fleet_rollback.py b/tools/plugin_fleet_rollback.py index 27760daa..c0b7ecfd 100644 --- a/tools/plugin_fleet_rollback.py +++ b/tools/plugin_fleet_rollback.py @@ -60,7 +60,7 @@ def rollback_receipt(receipt_path, expected_source, apply=False, run=control, le private_jarvis = (relative == 'JarvisTranslator/config.yml' and entry.get('transform') == 'enable-dunegroups' and sid in reviewed and root == target and unit == f'dune-{sid}.service') private_discord = (relative == 'DiscordSRV/config.yml' and entry.get('transform') == 'enable-modern-discord' - and server['id'] == 'arrakis' and root == Path('/opt/dunerealms/servers/arrakis')) + and sid in reviewed and root == target and unit == f'dune-{sid}.service') if relative not in ('MCGUI/config.yml','DunerealmsGUI/menu-pack.yml') and not (private_jarvis or private_discord): raise ValueError('Unsafe rollback configuration path') current=plugins/relative