Skip to content

Commit

Permalink
stem: use Cylc host selection interface
Browse files Browse the repository at this point in the history
* The `ROSE_ORIG_HOST` variable is set using the Cylc interface.
* The `HOST_SOURCE...` rose-stem variables are set using the Rose
  interface.
* The two interfaces differ, Cylc picks long hostnames, Rose picks short
  ones.
* The inconsistency may cause issues with simplistic "is this localhost"
  checks.
* The shortnames are causing issues at one site.
* Switch to using the Cylc interface for all scenarios.
  • Loading branch information
oliver-sanders committed Jan 23, 2025
1 parent 8b82e47 commit 8be43ac
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ creating a new release entry be sure to copy & paste the span tag with the
updated. Only the first match gets replaced, so it's fine to leave the old
ones in. -->

## __cylc-rose-1.5.0 (<span actions:bind='release-date'>Awaiting release</span>)__

[#361](https://github.com/cylc/cylc-rose/pull/361) -
Rose stem now uses long hostnames for the `HOST_SOURCE...` variables to match
`ROSE_ORIG_HOST`.

## __cylc-rose-1.5.0 (<span actions:bind='release-date'>Released 2025-01-09</span>)__

[#353](https://github.com/cylc/cylc-rose/pull/353) - Remove Empy support.
Expand Down
8 changes: 4 additions & 4 deletions cylc/rose/stem.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,14 @@
import sys

from ansimarkup import parse as cparse

from cylc.flow.exceptions import CylcError
from cylc.flow.hostuserutil import get_host
from cylc.flow.scripts.install import get_option_parser
from cylc.flow.scripts.install import install as cylc_install

import metomi.rose.config
from metomi.rose.fs_util import FileSystemUtil
from metomi.rose.host_select import HostSelector
from metomi.rose.popen import RosePopener
from metomi.rose.reporter import Event, Reporter
from metomi.rose.resource import ResourceLocator
Expand Down Expand Up @@ -239,8 +241,6 @@ def __init__(self, opts, reporter=None, popen=None, fs_util=None):
else:
self.fs_util = fs_util

self.host_selector = HostSelector(event_handler=self.reporter,
popen=self.popen)
self.template_section = '[template variables]'

def _add_define_option(self, var, val):
Expand Down Expand Up @@ -429,7 +429,7 @@ def _prepend_localhost(self, url):
locations."""
if ':' not in url or url.split(':', 1)[0] not in ['svn', 'fcm', 'http',
'https', 'svn+ssh']:
url = self.host_selector.get_local_host() + ':' + url
url = f'{get_host()}:{url}'
return url

def _parse_auto_opts(self):
Expand Down
6 changes: 3 additions & 3 deletions tests/functional/test_rose_stem.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@
from uuid import uuid4
from typing import Dict

from metomi.rose.host_select import HostSelector

import pytest

from cylc.flow.hostuserutil import get_host

from cylc.rose.stem import RoseStemVersionException

# We want to test Rose-Stem's insertion of the hostname,
# not Rose's method of getting the hostname, so it doesn't
# Matter that we are using the same host selector here as
# in the module under test:
HOST = HostSelector().get_local_host()
HOST = get_host()


# Check that FCM is present on system, skipping checks elsewise:
Expand Down

0 comments on commit 8be43ac

Please sign in to comment.