CONFIGURATION OVERRIDE

Users can override or add to Netdisco configuration from the command line, or in a job specification in a configured schedule or API-submitted job. This in turn overrides the NETDISCO_WITH_CONFIGURATION environment variable.

Configuration is provided to a Job in either the port or subaction (extra) slots. There is a way to provide configuration when these slots are also used for job parameters.

Configuration can be provided directly as JSON, as simple "k1=v1,k2=v2" format, or, when job parameters are needed, in a JSON dictionary slot "with" alongside the job parameter in a dictionary slot "value".

When configuration override is provided to BOTH the port and subaction (extra) slots the BEHAVIOUR IS UNDEFINED. Best to avoid doing that.

Note that earlier behaviour of providing a bare string as a device_auth tag hint is now unsupported and device_auth_tag_hint setting can be used instead.

Also note that this implementation precludes providing a dictionary as the "extra" configuration to any action (as it will be interpreted and consumed as configuration setting overrides). Lists and strings remain supported.

For example:

  • undef (changed to empty string if subaction)

  • unchanged

  • "unchanged"

  • '"unchanged"'

  • [{"mac": "string", "port": "string"}]

  • {"mac": "string", "port": "string"} (unsupported)

  • {"value": [{"mac": "string", "port": "string"}]}

  • {"value": {"mac": "string", "port": "string"}}

  • {"value": '{"mac": "string", "port": "string"}'}

  • {"value": "unchanged", "with": {"snmptimeout": 5000000}}

  • {"value": "unchanged", "with": '{"snmptimeout": 5000000}'}

  • {"value": "unchanged", "with": 'snmptimeout=5000000'}

  • {"snmptimeout": 5000000}

  • '{"snmptimeout": 5000000}'

  • snmptimeout=5000000

  • {"value": "unchanged", "with": "FAILS"} (unsupported)

  • {"value": "unchanged", "with": ["FAILS"]} (unsupported)

parse_params_to_config

Takes a defined value, works out what has been provided. If there is configuration to override it applies that. If there is a residual value to return, it returns that, otherwise returns undef.