From 5c0d64d17abb59f417cc2c6e486a04c9d7aeea68 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Mon, 10 Feb 2014 19:41:06 -0500 Subject: [PATCH] Try unix socket by default in confetty If the unix socket is available and nothing specified, try to use that --- bin/confetty | 2 ++ confluent/messages.py | 12 ++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/bin/confetty b/bin/confetty index 711d39fc..d57026e3 100755 --- a/bin/confetty +++ b/bin/confetty @@ -254,6 +254,8 @@ if opts.server: # going over a TLS network server = connect_tls_server(opts.server) elif opts.unixsock: server = connect_unix_server(opts.unixsock) +elif os.path.exists("/var/run/confluent/api.sock"): + server = connect_unix_server("/var/run/confluent/api.sock") #Next stop, reading and writing from whichever of stdin and server goes first. #see pyghmi code for solconnect.py diff --git a/confluent/messages.py b/confluent/messages.py index 3d5c80cd..7160fb08 100644 --- a/confluent/messages.py +++ b/confluent/messages.py @@ -216,7 +216,7 @@ class BootDevice(ConfluentChoiceMessage): raise Exception("Invalid boot device argument passed in:" + device) self.kvpairs = { node: { - 'bootdevice': {'value': device}, + 'device': {'value': device}, } } @@ -226,7 +226,7 @@ class InputBootDevice(BootDevice): self.bootdevbynode = {} if not inputdata: raise exc.InvalidArgumentException() - if 'bootdevice' not in inputdata: + if 'device' not in inputdata: for key in nodes: if key not in inputdata: raise exc.InvalidArgumentException() @@ -234,14 +234,14 @@ class InputBootDevice(BootDevice): if ('state' not in datum or datum['state'] not in self.valid_values): raise exc.InvalidArgumenTException() - self.bootdevbynode[key] = datum['bootdevice'] + self.bootdevbynode[key] = datum['device'] else: datum = inputdata - if ('bootdevice' not in datum or - datum['bootdevice'] not in self.valid_values): + if ('device' not in datum or + datum['device'] not in self.valid_values): raise exc.InvalidArgumentException() for node in nodes: - self.bootdevbynode[node] = datum['bootdevice'] + self.bootdevbynode[node] = datum['device'] def bootdevice(self, node): return self.bootdevbynode[node]