Method: Bandshell.write_network_config
- Defined in:
- lib/bandshell/netconfig.rb
.write_network_config(cm, am) ⇒ Object
Save the network configuration to the configuration store. Arguments are instances of connection method and addressing method classes. Throws exception if either one is not valid.
480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 |
# File 'lib/bandshell/netconfig.rb', line 480 def self.write_network_config(cm, am) # Check that everything is consistent. If not, we currently throw # an exception, which probably is not the best long term solution. cm.validate am.validate # Serialize our instances as JSON data to be written to the config file. json_data = { 'connection_method' => cm.class.basename, 'connection_method_args' => cm.args, 'addressing_method' => am.class.basename, 'addressing_method_args' => am.args }.to_json # Save the serialized configuration. ConfigStore.write_config('network_config', json_data) end |