Merge "Sync context.py from charm-helpers"
This commit is contained in:
commit
0261001e1c
@ -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…
x
Reference in New Issue
Block a user