Sync context.py from charm-helpers
See https://github.com/juju/charm-helpers/pull/370 Change-Id: I8bc18c12e64dc43823f0d83d4705f5d0f2bb5edc Partial-Bug: #1842353
This commit is contained in:
parent
86b3e38a54
commit
899b75b971
|
@ -18,6 +18,7 @@ import json
|
|||
import math
|
||||
import os
|
||||
import re
|
||||
import socket
|
||||
import time
|
||||
from base64 import b64decode
|
||||
from subprocess import check_call, CalledProcessError
|
||||
|
@ -1716,6 +1717,10 @@ class NeutronAPIContext(OSContextGenerator):
|
|||
'rel_key': 'enable-nfg-logging',
|
||||
'default': False,
|
||||
},
|
||||
'enable_port_forwarding': {
|
||||
'rel_key': 'enable-port-forwarding',
|
||||
'default': False,
|
||||
},
|
||||
'global_physnet_mtu': {
|
||||
'rel_key': 'global-physnet-mtu',
|
||||
'default': 1500,
|
||||
|
@ -1745,6 +1750,13 @@ class NeutronAPIContext(OSContextGenerator):
|
|||
|
||||
ctxt['extension_drivers'] = ','.join(extension_drivers)
|
||||
|
||||
l3_extension_plugins = []
|
||||
|
||||
if ctxt['enable_port_forwarding']:
|
||||
l3_extension_plugins.append('port_forwarding')
|
||||
|
||||
ctxt['l3_extension_plugins'] = l3_extension_plugins
|
||||
|
||||
return ctxt
|
||||
|
||||
def get_neutron_options(self, rdata):
|
||||
|
@ -2160,3 +2172,14 @@ class LogrotateContext(OSContextGenerator):
|
|||
'logrotate_count': self.count,
|
||||
}
|
||||
return ctxt
|
||||
|
||||
|
||||
class HostInfoContext(OSContextGenerator):
|
||||
"""Context to provide host information."""
|
||||
|
||||
def __call__(self):
|
||||
ctxt = {
|
||||
'host_fqdn': socket.getfqdn(),
|
||||
'host': socket.gethostname(),
|
||||
}
|
||||
return ctxt
|
||||
|
|
Loading…
Reference in New Issue