Skip to content

Commit

Permalink
Merge pull request #3087 from DimStar77/SD153979
Browse files Browse the repository at this point in the history
announcer: inject hostname in case fqdn cannot be found
  • Loading branch information
dirkmueller committed Jun 11, 2024
2 parents fe74cce + ba97836 commit 7999809
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion factory-package-news/announcer.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import argparse
import logging
import yaml
import socket

logger = logging.getLogger()

Expand Down Expand Up @@ -59,6 +60,9 @@ def _load_config(handle=None):
pass

config = _load_config(options.config)
hostname = socket.getfqdn()
if hostname == 'localhost':
hostname = 'botmaster.suse.de'

if options.sender:
config['sender'] = options.sender
Expand Down Expand Up @@ -137,7 +141,7 @@ def _load_config(handle=None):
print(msg.as_string())
else:
logger.info(f"announcing version {version}")
s = smtplib.SMTP(config['relay'])
s = smtplib.SMTP(host=config['relay'], local_hostname=hostname)
s.send_message(msg)
s.quit()

Expand Down

0 comments on commit 7999809

Please sign in to comment.