adds log message for successful connection and disconnection (#17993)

The network module will now log a message when it connects to a remote host
successfully and specify the transport used.  It will also log a message
when the module discconnect() method is called.
pull/17994/head
Peter Sprygada 8 years ago committed by GitHub
parent 3badb212fb
commit 65ea24f4bb

@ -147,6 +147,8 @@ class NetworkModule(AnsibleModule):
self.connection.connect(self.params)
if self.params['authorize']:
self.connection.authorize(self.params)
self.log('connected to %s:%s using %s' % (self.params['host'],
self.params['port'], self.params['transport']))
except NetworkError:
exc = get_exception()
self.fail_json(msg=exc.message)
@ -155,6 +157,7 @@ class NetworkModule(AnsibleModule):
try:
if self.connected:
self.connection.disconnect()
self.log('disconnected from %s' % self.params['host'])
except NetworkError:
exc = get_exception()
self.fail_json(msg=exc.message)

Loading…
Cancel
Save