|
|
@ -42,8 +42,8 @@ have the following options: |
|
|
|
case the next network causes Mitter to crash or something related.) A value |
|
|
|
case the next network causes Mitter to crash or something related.) A value |
|
|
|
of 0 means the Network Manager will save the config file after each round of |
|
|
|
of 0 means the Network Manager will save the config file after each round of |
|
|
|
requests to all networks (failing or succeding); for devices that use flash |
|
|
|
requests to all networks (failing or succeding); for devices that use flash |
|
|
|
drives as storage, it's recommended some large value (since those devices |
|
|
|
drives as storage, it's recommended some large value (since those storage |
|
|
|
have a defined number of writes as lifetime.) Default is '5'. |
|
|
|
devices have a lifetime based on the number of writes.) Default is '5'. |
|
|
|
""" |
|
|
|
""" |
|
|
|
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------- |
|
|
|
#-------------------------------------------------------------------- |
|
|
@ -140,7 +140,7 @@ class Networks(object): |
|
|
|
def _save(self): |
|
|
|
def _save(self): |
|
|
|
"""Check the number of operations and, if it above the minimum value, |
|
|
|
"""Check the number of operations and, if it above the minimum value, |
|
|
|
save the config file.""" |
|
|
|
save the config file.""" |
|
|
|
max_count = self._options['Network_Manager']['save_count'] |
|
|
|
max_count = self._options['NetworkManager']['save_count'] |
|
|
|
_log.debug('Operations %d, max %d', self._operations, max_count) |
|
|
|
_log.debug('Operations %d, max %d', self._operations, max_count) |
|
|
|
if self._operations > max_count: |
|
|
|
if self._operations > max_count: |
|
|
|
self._options.save() |
|
|
|
self._options.save() |
|
|
@ -167,17 +167,17 @@ class Networks(object): |
|
|
|
conn.options(self._options) |
|
|
|
conn.options(self._options) |
|
|
|
|
|
|
|
|
|
|
|
# add Networks own options |
|
|
|
# add Networks own options |
|
|
|
self._options.add_group('Network_Manager', 'Network Manager') |
|
|
|
self._options.add_group('NetworkManager', 'Network Manager') |
|
|
|
self._options.add_option( |
|
|
|
self._options.add_option( |
|
|
|
'--timeout', |
|
|
|
'--timeout', |
|
|
|
group='Network_Manager', |
|
|
|
group='NetworkManager', |
|
|
|
option='timeout', |
|
|
|
option='timeout', |
|
|
|
help='Timeout for requests in all networks.', |
|
|
|
help='Timeout for requests in all networks.', |
|
|
|
type='int', |
|
|
|
type='int', |
|
|
|
metavar='SECONDS', |
|
|
|
metavar='SECONDS', |
|
|
|
default=120) |
|
|
|
default=120) |
|
|
|
self._options.add_option( |
|
|
|
self._options.add_option( |
|
|
|
group='Network_Manager', |
|
|
|
group='NetworkManager', |
|
|
|
option='save_count', |
|
|
|
option='save_count', |
|
|
|
help='Number of network operations till the config file ' \ |
|
|
|
help='Number of network operations till the config file ' \ |
|
|
|
'is saved', |
|
|
|
'is saved', |
|
|
|