Skip to content

Commit

Permalink
Merge pull request #2183 from matthewrmshin/fix-suite-host-self-id-ad…
Browse files Browse the repository at this point in the history
…dress-ssl-cert

Use preferred suite host self ID in SSL cert
  • Loading branch information
oliver-sanders authored Mar 2, 2017
2 parents c0d5ee2 + 860da9e commit d6c4d33
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
11 changes: 6 additions & 5 deletions lib/cylc/suite_srv_files_mgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
import cylc.flags
from cylc.mkdir_p import mkdir_p
from cylc.owner import USER, is_remote_user
from cylc.suite_host import get_hostname, is_remote_host, get_local_ip_address
from cylc.suite_host import (
get_local_ip_address, get_suite_host, is_remote_host)


class SuiteServiceFileError(Exception):
Expand Down Expand Up @@ -77,7 +78,7 @@ def cache_passphrase(self, reg, owner, host, value):
if owner is None:
owner = USER
if host is None:
host = get_hostname()
host = get_suite_host()
path = self._get_cache_dir(reg, owner, host)
self.cache[self.FILE_BASE_PASSPHRASE][(reg, owner, host)] = value
# Dump to a file only for remote suites loaded via SSH.
Expand Down Expand Up @@ -237,7 +238,7 @@ def get_auth_item(self, item, reg, owner=None, host=None, content=False):
if my_owner is None:
my_owner = USER
if my_host is None:
my_host = get_hostname()
my_host = get_suite_host()
try:
return self.cache[item][(reg, my_owner, my_host)]
except KeyError:
Expand Down Expand Up @@ -467,7 +468,7 @@ def _get_ssl_cert(self, path, reg, pkey_obj):
if len(reg) > 64:
common_name = reg[:61] + "..."
# See https://github.com/kennethreitz/requests/issues/2621
host = get_hostname()
host = get_suite_host()
ext = crypto.X509Extension(
"subjectAltName",
False,
Expand Down Expand Up @@ -566,7 +567,7 @@ def _is_local_auth_ok(self, reg, owner, host):
if owner is None:
owner = USER
if host is None:
host = get_hostname()
host = get_suite_host()
host_value = data.get(self.KEY_HOST, "")
self.can_use_load_auths[(reg, owner, host)] = (
reg == data.get(self.KEY_NAME) and
Expand Down
2 changes: 1 addition & 1 deletion tests/suite-host-self-id/00-address.t
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ create_test_globalrc '' '
[suite host self-identification]
method = address'
suite_run_ok "${TEST_NAME_BASE}-run" \
cylc run --reference-test --debug "${SUITE_NAME}" \
timeout 60 cylc run --reference-test --debug "${SUITE_NAME}" \
"--set=MY_HOST_IP=${MY_HOST_IP}"
#-------------------------------------------------------------------------------

Expand Down
6 changes: 6 additions & 0 deletions tests/suite-host-self-id/00-address/suite.rc
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#!Jinja2
[cylc]
UTC mode = True
[[events]]
abort on stalled = True
abort on inactivity = True
inactivity = PT1M
[[reference test]]
required run mode = live
live mode suite timeout = PT1M
Expand All @@ -12,3 +16,5 @@
script = """
grep -F -q "CYLC_SUITE_HOST={{MY_HOST_IP}}" "${CYLC_SUITE_RUN_DIR}/.service/contact"
"""
[[[job]]]
execution time limit = PT30S

0 comments on commit d6c4d33

Please sign in to comment.