diff --git a/cylc/flow/scheduler.py b/cylc/flow/scheduler.py index aff1a99e8e6..93528fccc3a 100644 --- a/cylc/flow/scheduler.py +++ b/cylc/flow/scheduler.py @@ -1262,11 +1262,17 @@ def _configure_contact(self) -> None: def load_flow_file(self, is_reload=False): """Load, and log the workflow definition.""" - # Local workflow environment set therein. - # Allow -S and -D to take effect in Cylc VR. - # https://github.com/cylc/cylc-flow/issues/5968 - self.options.rose_template_vars = [] - self.options.defines = [] + if is_reload: + # If the workflow is reloaded clear any existing rose options + # The reload command doesn't have the ability to set these but + # if the user has used VR to re-install before reload they will + # expect the changed values not the ones stored on the scheduler. + # Note: Does NOT apply to reload on restart, because the play + # command used to restart can have template variables attached. + # See https://github.com/cylc/cylc-flow/pull/5996 + self.options.rose_template_vars = [] + self.options.defines = [] + self.options.opt_conf_keys = [] return WorkflowConfig( self.workflow, self.flow_file,