Skip to content

Commit

Permalink
Follow-up to previous commit (Ubuntu 16.04 support)
Browse files Browse the repository at this point in the history
  • Loading branch information
xolox committed Apr 7, 2016
1 parent 7b0a76d commit 898ffa1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion common/negotiator_common/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
from negotiator_common.config import BUILTIN_COMMANDS_DIRECTORY, USER_COMMANDS_DIRECTORY

# Semi-standard module versioning.
__version__ = '0.8.3'
__version__ = '0.8.4'

# Initialize a logger for this module.
logger = logging.getLogger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion guest/negotiator_guest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from negotiator_common.utils import compact, GracefulShutdown

# Semi-standard module versioning.
__version__ = '0.8.3'
__version__ = '0.8.4'

# Initialize a logger for this module.
logger = logging.getLogger(__name__)
Expand Down
16 changes: 14 additions & 2 deletions host/negotiator_host/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from executor import execute

# Semi-standard module versioning.
__version__ = '0.8.3'
__version__ = '0.8.4'

# Initialize a logger for this module.
logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -149,7 +149,19 @@ def __init__(self, guest_name, unix_socket=None):
self.guest_name = guest_name
# Figure out the absolute pathname of the UNIX socket?
if not unix_socket:
unix_socket = os.path.join(CHANNELS_DIRECTORY, '%s.%s' % (self.guest_name, HOST_TO_GUEST_CHANNEL_NAME))
# The new naming convention is used on Ubuntu 16.04 while the old
# naming convention is used on 12.04 and 14.04.
new_style = os.path.join(CHANNELS_DIRECTORY, 'domain-%s' % self.guest_name, HOST_TO_GUEST_CHANNEL_NAME)
old_style = os.path.join(CHANNELS_DIRECTORY, '%s.%s' % (self.guest_name, HOST_TO_GUEST_CHANNEL_NAME))
if os.path.exists(new_style):
logger.debug("Found channel of guest %r (using new naming convention).", self.guest_name)
unix_socket = new_style
elif os.path.exists(old_style):
logger.debug("Found channel of guest %r (using old naming convention).", self.guest_name)
unix_socket = old_style
else:
msg = "No UNIX socket pathname provided and auto-detection failed!"
raise GuestChannelInitializationError(msg)
# Connect to the UNIX socket.
logger.debug("Opening UNIX socket: %s", unix_socket)
self.socket = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
Expand Down

0 comments on commit 898ffa1

Please sign in to comment.