nmcli: allow adding 'generic' connections via 'nmcli con add' (rh #1263185)

https://bugzilla.redhat.com/show_bug.cgi?id=1263185
This commit is contained in:
Jiří Klimeš 2015-09-15 14:56:32 +02:00
parent b36fdfe7a1
commit 0211fc9bcf
2 changed files with 50 additions and 1 deletions

View File

@ -8,7 +8,7 @@
%define ppp_version %(rpm -q ppp-devel >/dev/null && rpm -q --qf '%%{version}' ppp-devel || echo -n bad)
%define snapshot %{nil}
%define release_version 4
%define release_version 5
%define realversion 1.0.6
%define epoch_version 1
@ -91,6 +91,7 @@ Patch1: 0001-config-bugfix-parse-commandline-options-into-correct.patch
Patch2: 0003-vpn-connection-fix-unsetting-the-gateway.patch
Patch3: 0004-device-don-t-reset-NM_UNMANAGED_DEFAULT-when-platfor.patch
Patch4: 0001-test-fix-duplicate-test-names.patch
Patch5: rh1263185-nmcli-con-add-generic.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -372,6 +373,7 @@ by nm-connection-editor and nm-applet in a non-graphical environment.
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%build
@ -690,6 +692,9 @@ fi
%endif
%changelog
* Tue Sep 15 2015 Jiří Klimeš <jklimes@redhat.com> - 1:1.0.6-5
- nmcli: allow adding 'generic' connections via 'nmcli con add' (rh #1263185)
* Tue Sep 8 2015 Lubomir Rintel <lrintel@redhat.com> - 1:1.0.6-4
- Fix build & test with newer glib
- Actually apply patch forgotten in a previous release

View File

@ -0,0 +1,44 @@
From b46ed879198e911521373391c27982034699dfe5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Tue, 10 Feb 2015 15:33:35 +0100
Subject: [PATCH] nmcli: allow adding 'generic' connections via nmcli
connection add
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
'nmcli connection edit' already allows adding and editing generic connections
(added by 2a2af5825a6db62e7a88bb249cf7876551ed7fa3).
(cherry picked from commit 0ff9b75387b7ac2fd0235b23699990834426c467)
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
clients/cli/connections.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/clients/cli/connections.c b/clients/cli/connections.c
index 8d138bd..3c95c03 100644
--- a/clients/cli/connections.c
+++ b/clients/cli/connections.c
@@ -4006,6 +4006,7 @@ complete_connection_by_type (NMConnection *connection,
GError **error)
{
NMSettingConnection *s_con;
+ NMSettingGeneric *s_generic;
NMSettingWired *s_wired;
NMSettingInfiniband *s_infiniband;
NMSettingWireless *s_wifi;
@@ -5232,6 +5233,10 @@ cleanup_olpc:
if (!success)
return FALSE;
+ } else if (!strcmp (con_type, NM_SETTING_GENERIC_SETTING_NAME)) {
+ /* Add 'generic' setting */
+ s_generic = (NMSettingGeneric *) nm_setting_generic_new ();
+ nm_connection_add_setting (connection, NM_SETTING (s_generic));
} else {
g_set_error (error, NMCLI_ERROR, NMC_RESULT_ERROR_USER_INPUT,
_("Error: '%s' is not a valid connection type."),
--
2.1.0