Skip to content

Commit

Permalink
Merge pull request #96 from HSF/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
wguanicedew authored Jul 23, 2022
2 parents 3e78350 + 0bfd680 commit 64a2445
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 10 deletions.
2 changes: 2 additions & 0 deletions common/lib/idds/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ def get_rest_host():
"""
Function to get rest host
"""
if "IDDS_HOST" in os.environ:
return os.environ.get("IDDS_HOST")
host = config_get('rest', 'host')
url_prefix = get_rest_url_prefix()
while host.endswith("/"):
Expand Down
22 changes: 16 additions & 6 deletions main/lib/idds/agents/conductor/plugins/messaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,17 +90,22 @@ def connect_to_messaging_brokers(self):
broker_addresses = []
for b in self.brokers:
try:
if ":" in b:
b, port = b.split(":")
else:
port = self.port

addrinfos = socket.getaddrinfo(b, 0, socket.AF_INET, 0, socket.IPPROTO_TCP)
for addrinfo in addrinfos:
b_addr = addrinfo[4][0]
broker_addresses.append(b_addr)
broker_addresses.append((b_addr, port))
except socket.gaierror as error:
self.logger.error('Cannot resolve hostname %s: %s' % (b, str(error)))

self.logger.info("Resolved broker addresses: %s" % broker_addresses)

for broker in broker_addresses:
conn = stomp.Connection12(host_and_ports=[(broker, self.port)],
for broker, port in broker_addresses:
conn = stomp.Connection12(host_and_ports=[(broker, port)],
vhost=self.vhost,
keepalive=True,
timeout=self.broker_timeout)
Expand Down Expand Up @@ -157,17 +162,22 @@ def subscribe(self):
broker_addresses = []
for b in self.brokers:
try:
if ":" in b:
b, port = b.split(":")
else:
port = self.port

addrinfos = socket.getaddrinfo(b, 0, socket.AF_INET, 0, socket.IPPROTO_TCP)
for addrinfo in addrinfos:
b_addr = addrinfo[4][0]
broker_addresses.append(b_addr)
broker_addresses.append((b_addr, port))
except socket.gaierror as error:
self.logger.error('Cannot resolve hostname %s: %s' % (b, str(error)))

self.logger.info("Resolved broker addresses: %s" % broker_addresses)

for broker in broker_addresses:
conn = stomp.Connection12(host_and_ports=[(broker, self.port)],
for broker, port in broker_addresses:
conn = stomp.Connection12(host_and_ports=[(broker, port)],
vhost=self.vhost,
keepalive=True)
conn.set_listener('message-receiver', self.get_listener(conn.transport._Transport__host_and_ports[0]))
Expand Down
8 changes: 4 additions & 4 deletions start-daemon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ export IDDS_HOME=/opt/idds
if [ -f /etc/grid-security/hostkey.pem ]; then
echo "host certificate is already created."
chmod 600 /etc/grid-security/hostkey.pem
elif [ -f /opt/idds/configmap/hostkey.pem ]; then
echo "mount /opt/idds/configmap/hostkey.pem to /etc/grid-security/hostkey.pem"
ln -fs /opt/idds/configmap/hostkey.pem /etc/grid-security/hostkey.pem
ln -fs /opt/idds/configmap/hostcert.pem /etc/grid-security/hostcert.pem
elif [ -f /opt/idds/certs/hostkey.pem ]; then
echo "mount /opt/idds/certs/hostkey.pem to /etc/grid-security/hostkey.pem"
ln -fs /opt/idds/certs/hostkey.pem /etc/grid-security/hostkey.pem
ln -fs /opt/idds/certs/hostcert.pem /etc/grid-security/hostcert.pem
chmod 600 /etc/grid-security/hostkey.pem
fi

Expand Down

0 comments on commit 64a2445

Please sign in to comment.