diff --git a/src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c b/src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c index 855ad58e7..cbf26540f 100644 --- a/src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c +++ b/src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c @@ -61,6 +61,24 @@ /*****************************************************************************/ +static void _nm_unused +set_error_unsupported(GError **error, + NMConnection *connection, + const char *name, + gboolean is_setting) +{ + g_set_error(error, + NM_SETTINGS_ERROR, + NM_SETTINGS_ERROR_NOT_SUPPORTED_BY_PLUGIN, + "The ifcfg-rh plugin doesn't support %s '%s'. If you are modifying an existing " + "connection profile saved in ifcfg-rh format, please migrate the connection to " + "keyfile using 'nmcli connection migrate %s' or via the Update2() D-Bus API " + "and try again.", + is_setting ? "setting" : "property", + name, + nm_connection_get_uuid(connection)); +}; + static void save_secret_flags(shvarFile *ifcfg, const char *key, NMSettingSecretFlags flags) { diff --git a/src/libnm-core-public/nm-errors.h b/src/libnm-core-public/nm-errors.h index a4d69c31a..11ce25f15 100644 --- a/src/libnm-core-public/nm-errors.h +++ b/src/libnm-core-public/nm-errors.h @@ -253,6 +253,9 @@ GQuark nm_secret_agent_error_quark(void); * @NM_SETTINGS_ERROR_VERSION_ID_MISMATCH: The profile's VersionId mismatched * and the update is rejected. See the "version-id" argument to Update2() * method. Since 1.44. + * @NM_SETTINGS_ERROR_NOT_SUPPORTED_BY_PLUGIN: the requested operation is not + * supported by the settings plugin currently in use for the specified object. + * Since: 1.44. * * Errors related to the settings/persistent configuration interface of * NetworkManager. @@ -262,15 +265,16 @@ GQuark nm_secret_agent_error_quark(void); * D-Bus errors in that namespace. */ typedef enum { - NM_SETTINGS_ERROR_FAILED = 0, /*< nick=Failed >*/ - NM_SETTINGS_ERROR_PERMISSION_DENIED, /*< nick=PermissionDenied >*/ - NM_SETTINGS_ERROR_NOT_SUPPORTED, /*< nick=NotSupported >*/ - NM_SETTINGS_ERROR_INVALID_CONNECTION, /*< nick=InvalidConnection >*/ - NM_SETTINGS_ERROR_READ_ONLY_CONNECTION, /*< nick=ReadOnlyConnection >*/ - NM_SETTINGS_ERROR_UUID_EXISTS, /*< nick=UuidExists >*/ - NM_SETTINGS_ERROR_INVALID_HOSTNAME, /*< nick=InvalidHostname >*/ - NM_SETTINGS_ERROR_INVALID_ARGUMENTS, /*< nick=InvalidArguments >*/ - NM_SETTINGS_ERROR_VERSION_ID_MISMATCH, /*< nick=VersionIdMismatch >*/ + NM_SETTINGS_ERROR_FAILED = 0, /*< nick=Failed >*/ + NM_SETTINGS_ERROR_PERMISSION_DENIED, /*< nick=PermissionDenied >*/ + NM_SETTINGS_ERROR_NOT_SUPPORTED, /*< nick=NotSupported >*/ + NM_SETTINGS_ERROR_INVALID_CONNECTION, /*< nick=InvalidConnection >*/ + NM_SETTINGS_ERROR_READ_ONLY_CONNECTION, /*< nick=ReadOnlyConnection >*/ + NM_SETTINGS_ERROR_UUID_EXISTS, /*< nick=UuidExists >*/ + NM_SETTINGS_ERROR_INVALID_HOSTNAME, /*< nick=InvalidHostname >*/ + NM_SETTINGS_ERROR_INVALID_ARGUMENTS, /*< nick=InvalidArguments >*/ + NM_SETTINGS_ERROR_VERSION_ID_MISMATCH, /*< nick=VersionIdMismatch >*/ + NM_SETTINGS_ERROR_NOT_SUPPORTED_BY_PLUGIN, /*< nick=NotSupportedByPlugin >*/ } NMSettingsError; GQuark nm_settings_error_quark(void);