projects
/
osm
/
N2VC.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add ModelEntity callbacks and async return values.
[osm/N2VC.git]
/
juju
/
client
/
connection.py
diff --git
a/juju/client/connection.py
b/juju/client/connection.py
index
aea1a1c
..
cdd93d9
100644
(file)
--- a/
juju/client/connection.py
+++ b/
juju/client/connection.py
@@
-1,4
+1,3
@@
-import asyncio
import io
import json
import logging
import io
import json
import logging
@@
-12,6
+11,8
@@
import websockets
import yaml
import yaml
+from juju.errors import JujuAPIError
+
log = logging.getLogger("websocket")
log = logging.getLogger("websocket")
@@
-42,6
+43,12
@@
class Connection:
self.ws = None
self.facades = {}
self.ws = None
self.facades = {}
+ @property
+ def is_open(self):
+ if self.ws:
+ return self.ws.open
+ return False
+
def _get_ssl(self, cert):
return ssl.create_default_context(
purpose=ssl.Purpose.CLIENT_AUTH, cadata=cert)
def _get_ssl(self, cert):
return ssl.create_default_context(
purpose=ssl.Purpose.CLIENT_AUTH, cadata=cert)
@@
-73,9
+80,10
@@
class Connection:
outgoing = json.dumps(msg, indent=2, cls=encoder)
await self.ws.send(outgoing)
result = await self.recv()
outgoing = json.dumps(msg, indent=2, cls=encoder)
await self.ws.send(outgoing)
result = await self.recv()
- log.debug("send %s got %s", msg, result)
+ #log.debug("Send: %s", outgoing)
+ #log.debug("Recv: %s", result)
if result and 'error' in result:
if result and 'error' in result:
- raise
Runtime
Error(result)
+ raise
JujuAPI
Error(result)
return result
async def clone(self):
return result
async def clone(self):