NetworkManager/src/settings
Thomas Haller 79be44d990 ifcfg: add read/write support for user-data
The user data values are encoded in shell variables named
prefix "NM_USER_". The variable name is an encoded form of the
data key, consisting only of upper-case letters, digits, and underscore.

The alternative would be something like

  NM_USER_1_KEY=my.keys.1
  NM_USER_1_VAL='some value'
  NM_USER_2_KEY=my.other.KEY.42
  NM_USER_2_VAL='other value'

contary to

  NM_USER_MY__KEYS__1='some value'
  NM_USER_MY__OTHER___K_E_Y__42='other value'

The advantage of the former, numbered scheme is that it may be easier to
find the key of a user-data entry. With the current implementation, the
shell script would have to decode the key, like the ifcfg-rh plugin
does.

However, user data keys are opaque identifers for values. Usually, you
are not concerned with a certain name of the key, you already know it.
Hence, you don't need to write a shell script to decode the key name,
instead, you can use it directly:

  if [ -z ${NM_USER_MY__OTHER___K_E_Y__42+x} ]; then
      do_something_with_key "$NM_USER_MY__OTHER___K_E_Y__42"
  fi

Otherwise, you'd first have to search write a shell script to search
for the interesting key -- in this example "$NM_USER_2_KEY", before being
able to access the value "$NM_USER_2_VAL".
2017-05-06 14:12:19 +02:00
..
plugins ifcfg: add read/write support for user-data 2017-05-06 14:12:19 +02:00
nm-agent-manager.c logging: log device and connection along with the message 2017-03-24 12:42:09 +01:00
nm-agent-manager.h core: refactor private data in "src" 2016-10-04 09:50:56 +02:00
nm-inotify-helper.c all: use O_CLOEXEC for file descriptors 2016-12-13 11:26:59 +01:00
nm-inotify-helper.h core: refactor private data in "src" 2016-10-04 09:50:56 +02:00
nm-secret-agent.c settings/secret-agent: add initializers 2017-04-03 13:28:26 +02:00
nm-secret-agent.h include: use double-quotes to include our own headers 2017-03-09 14:12:35 +01:00
nm-settings-connection.c settings-connection: log the connection context 2017-03-24 12:42:09 +01:00
nm-settings-connection.h core/trivial: rename "nm-generated-assumed" flag to "volatile" 2017-03-16 18:27:33 +01:00
nm-settings-plugin.c settings: set @error on failure of nm_settings_plugin_add_connection() 2016-03-03 18:54:20 +01:00
nm-settings-plugin.h include: use double-quotes to include our own headers 2017-03-09 14:12:35 +01:00
nm-settings.c policy: try to retrieve hostname from dbus first 2017-03-24 15:18:08 +01:00
nm-settings.h policy: try to retrieve hostname from dbus first 2017-03-24 15:18:08 +01:00