Merge ~gary-wzl77/snappy-hwe-snaps/+git/easy-openvpn:snap-configuration into ~snappy-hwe-team/snappy-hwe-snaps/+git/easy-openvpn:master

Proposed by Gary.Wang on 2017-09-14
Status: Merged
Approved by: Simon Fels on 2017-09-25
Approved revision: edab983b093cebffd1d2e93ddae6c11a20775e90
Merged at revision: 52d16d16aa0347f567ce32ffd8eff6d5c37f5094
Proposed branch: ~gary-wzl77/snappy-hwe-snaps/+git/easy-openvpn:snap-configuration
Merge into: ~snappy-hwe-team/snappy-hwe-snaps/+git/easy-openvpn:master
Diff against target: 238 lines (+40/-32)
12 files modified
README.md (+3/-3)
bin/configure (+10/-3)
bin/help (+6/-6)
spread/main/add_client/task.yaml (+1/-1)
spread/main/change_natdevice/task.yaml (+2/-2)
spread/main/connect_server/task.yaml (+1/-1)
spread/main/hooks/task.yaml (+10/-9)
spread/main/launch_server/task.yaml (+1/-1)
spread/main/monitor_status/task.yaml (+1/-1)
spread/main/revoke_after_connection/task.yaml (+1/-1)
spread/main/revoke_client/task.yaml (+1/-1)
spread/main/setup_server/task.yaml (+3/-3)
Reviewer Review Type Date Requested Status
Simon Fels Approve on 2017-09-19
System Enablement Bot continuous-integration 2017-09-14 Approve on 2017-09-19
Roberto Mier Escandón  (community) Approve on 2017-09-18
Alfonso Sanchez-Beato Approve on 2017-09-14
Review via email: mp+330724@code.launchpad.net

Commit message

Adjust snap configuration key name to "<category>.<name>".

Description of the change

Adjust snap configuration key name to "<category>.<name>".

To post a comment you must log in.

LGTM

review: Approve

lgtm

review: Approve
Simon Fels (morphis) wrote :

A few last comments here.

review: Needs Fixing
Simon Fels (morphis) wrote :

LGTM

review: Approve
Simon Fels (morphis) wrote :

Not top-approving yet as Gary wanted to merge the documentation MP for easy-openvpn first.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/README.md b/README.md
2index e5c7630..6a6bbc1 100644
3--- a/README.md
4+++ b/README.md
5@@ -34,7 +34,7 @@ If internet connection is over ethernet, you can skip natdevice setup since defa
6 While a wireless connection is established, you need to set it to 'wlan0' accordingly.
7 Note: This fits the scenario where people usually setup a wireless connection on ubuntu core at the first boot.
8
9- $ sudo snap set easy-openvpn natdevice=wlan0
10+ $ sudo snap set easy-openvpn server.natdevice=wlan0
11
12 Setup an openvpn server with host machine IP address
13
14@@ -52,8 +52,8 @@ and update the mount namespaces of the snap in-place without any processes
15 restarting or any other change after connecting interfaces above. But to be safe,
16 we could reload the snap manually with the following commands:
17
18- $ sudo disable easy-openvpn
19- $ sudo enable easy-openvpn
20+ $ sudo snap disable easy-openvpn
21+ $ sudo snap enable easy-openvpn
22
23 ## Use
24
25diff --git a/bin/configure b/bin/configure
26index d1b6d0f..8793b5d 100755
27--- a/bin/configure
28+++ b/bin/configure
29@@ -23,16 +23,23 @@ if ! debug=$(snapctl get debug); then
30 exit 1
31 fi
32
33-if ! nopasswd=$(snapctl get nopasswd); then
34+if ! nopasswd=$(snapctl get server.no-password); then
35 echo "Failed to get nopasswd option."
36 exit 1
37 fi
38
39-if ! natdevice=$(snapctl get natdevice); then
40+if ! natdevice=$(snapctl get server.natdevice); then
41 echo "Failed to get natdevice option."
42 exit 1
43 fi
44
45+# docker-openvpn is only in favor of '1/0', instead of 'true/false'.
46+if [ "$debug" = "true" ]; then
47+ debug=1
48+elif [ "$debug" = "false" ]; then
49+ debug=0
50+fi
51+
52 cat << EOF > $PROFILE
53 export OPENVPN=$SNAP_DATA/openvpn
54 export EASYRSA=$SNAP/usr/local/easyrsa
55@@ -46,7 +53,7 @@ EOF
56
57 # Set default domain common name and call easy-rsa explicitly in batch mode.
58 # It's helpful to execute spread test in non-interactive mode.
59-if [ "$nopasswd" = "1" ]; then
60+if [ "$nopasswd" = "true" ]; then
61 # Ugly, set env var and pass it to ovpn.
62 # export nopass=1 makes more sense but this is the least code changes.
63 cat << EOF >> $PROFILE
64diff --git a/bin/help b/bin/help
65index c2b7cc1..fae2b9a 100755
66--- a/bin/help
67+++ b/bin/help
68@@ -16,17 +16,17 @@
69
70 source ${SNAP_DATA}/easy-openvpn.profile
71
72-DEFAULT_DEBUG=0
73-DEFAULT_NOPASSWD=0
74+DEFAULT_DEBUG=false
75+DEFAULT_NOPASSWD=false
76 DEFAULT_OVPN_NATDEVICE=eth0
77
78 SNAPPY_DEBUG=debug
79-SNAPPY_NOPASSWD=nopasswd
80-SNAPPY_OVPN_NATDEVICE=natdevice
81+SNAPPY_NOPASSWD=server.no-password
82+SNAPPY_OVPN_NATDEVICE=server.natdevice
83
84 KEYS=("DEBUG" "NOPASSWD" "OVPN_NATDEVICE")
85-DESC_DEBUG="Enable debug mode in OpenVPN server if it's set to 1."
86-DESC_NOPASSWD="Enable generating private key without a passphrase during server setup if it's set to 1"
87+DESC_DEBUG="Enable debug mode in OpenVPN server if it's set to false."
88+DESC_NOPASSWD="Enable generating private key without a passphrase during server setup if it's set to false"
89 DESC_OVPN_NATDEVICE="Support to specify nat device, typically it could be eth0(default) or wlan0 if you
90 connect to server over wireless connection"
91
92diff --git a/spread/main/add_client/task.yaml b/spread/main/add_client/task.yaml
93index 989ef52..870be31 100644
94--- a/spread/main/add_client/task.yaml
95+++ b/spread/main/add_client/task.yaml
96@@ -4,7 +4,7 @@ execute: |
97 . $TESTSLIB/utilities.sh
98
99 # so enable to setup server in non-interactive mode
100- sudo snap set easy-openvpn nopasswd=1
101+ sudo snap set easy-openvpn server.no-password='true'
102
103 # setup openvpn server
104 sudo easy-openvpn.setup -u "udp://${SERVER_IP}"
105diff --git a/spread/main/change_natdevice/task.yaml b/spread/main/change_natdevice/task.yaml
106index 6bbdf50..edb3797 100644
107--- a/spread/main/change_natdevice/task.yaml
108+++ b/spread/main/change_natdevice/task.yaml
109@@ -3,11 +3,11 @@ summary: Test change natdevice to 'wlan0'.
110 execute: |
111 . $TESTSLIB/utilities.sh
112 # so enable to setup server in non-interactive mode
113- sudo snap set easy-openvpn nopasswd=1
114+ sudo snap set easy-openvpn server.no-password='true'
115
116 # change natdevice to 'eth0'.
117 # It should be set to 'wlan0' while connecting to a wireless network
118- sudo snap set easy-openvpn natdevice='eth0'
119+ sudo snap set easy-openvpn server.natdevice='eth0'
120
121 # setup openvpn server
122 sudo easy-openvpn.setup -u "udp://${SERVER_IP}"
123diff --git a/spread/main/connect_server/task.yaml b/spread/main/connect_server/task.yaml
124index d1a34ec..412088f 100644
125--- a/spread/main/connect_server/task.yaml
126+++ b/spread/main/connect_server/task.yaml
127@@ -3,7 +3,7 @@ summary: Test connect openvpn server.
128 execute: |
129 . $TESTSLIB/utilities.sh
130 # so enable to setup server in non-interactive mode
131- sudo snap set easy-openvpn nopasswd=1
132+ sudo snap set easy-openvpn server.no-password='true'
133
134 # setup openvpn server
135 sudo easy-openvpn.setup -u "udp://${SERVER_IP}"
136diff --git a/spread/main/hooks/task.yaml b/spread/main/hooks/task.yaml
137index f849977..2b365f7 100644
138--- a/spread/main/hooks/task.yaml
139+++ b/spread/main/hooks/task.yaml
140@@ -1,17 +1,18 @@
141 summary: Test configure hooks.
142
143 execute: |
144- sudo easy-openvpn.help | MATCH ".*'debug', using default value: '0'"
145- sudo easy-openvpn.help | MATCH "'nopasswd', using default value: '0'"
146+ sudo easy-openvpn.help | MATCH ".*'debug', using default value: 'false'"
147+ sudo easy-openvpn.help | MATCH "'server.no-password', using default value: 'false'"
148+ sudo easy-openvpn.help | MATCH "'server.natdevice', using default value: 'eth0'"
149
150- # set 'debug' to 1 and check the value in help command
151- sudo snap set easy-openvpn debug=1
152+ # set 'debug' to 'true' and check the value in help command
153+ sudo snap set easy-openvpn debug='true'
154 sudo easy-openvpn.help | MATCH "'debug' current value set to: '1'.*"
155
156- # set 'nopasswd' to 1 and check the value in help command
157- sudo snap set easy-openvpn nopasswd=1
158- sudo easy-openvpn.help | MATCH "'nopasswd' current value set to: '1'.*"
159+ # set 'no-password' to 'true' and check the value in help command
160+ sudo snap set easy-openvpn server.no-password='true'
161+ sudo easy-openvpn.help | MATCH "'server.no-password' current value set to: 'true'.*"
162
163 # set 'natdevice' to 'wlan0' and check the value in help command
164- sudo snap set easy-openvpn natdevice=wlan0
165- sudo easy-openvpn.help | MATCH "'natdevice' current value set to: 'wlan0'.*"
166+ sudo snap set easy-openvpn server.natdevice=wlan0
167+ sudo easy-openvpn.help | MATCH "'server.natdevice' current value set to: 'wlan0'.*"
168diff --git a/spread/main/launch_server/task.yaml b/spread/main/launch_server/task.yaml
169index 9d04aa5..ad10325 100644
170--- a/spread/main/launch_server/task.yaml
171+++ b/spread/main/launch_server/task.yaml
172@@ -3,7 +3,7 @@ summary: Test launch openvpn server.
173 execute: |
174 . $TESTSLIB/utilities.sh
175 # so enable to setup server in non-interactive mode
176- sudo snap set easy-openvpn nopasswd=1
177+ sudo snap set easy-openvpn server.no-password='true'
178
179 # setup openvpn server
180 sudo easy-openvpn.setup -u "udp://${SERVER_IP}"
181diff --git a/spread/main/monitor_status/task.yaml b/spread/main/monitor_status/task.yaml
182index 0574a89..0fff5ad 100644
183--- a/spread/main/monitor_status/task.yaml
184+++ b/spread/main/monitor_status/task.yaml
185@@ -3,7 +3,7 @@ summary: Test monitor check connection status.
186 execute: |
187 . $TESTSLIB/utilities.sh
188 # so enable to setup server in non-interactive mode
189- sudo snap set easy-openvpn nopasswd=1
190+ sudo snap set easy-openvpn server.no-password='true'
191
192 # setup openvpn server
193 sudo easy-openvpn.setup -u "udp://${SERVER_IP}"
194diff --git a/spread/main/revoke_after_connection/task.yaml b/spread/main/revoke_after_connection/task.yaml
195index 3272fa9..9299bd4 100644
196--- a/spread/main/revoke_after_connection/task.yaml
197+++ b/spread/main/revoke_after_connection/task.yaml
198@@ -3,7 +3,7 @@ summary: Test revoke a client after connection.
199 execute: |
200 . $TESTSLIB/utilities.sh
201 # so enable to setup server in non-interactive mode
202- sudo snap set easy-openvpn nopasswd=1
203+ sudo snap set easy-openvpn server.no-password='true'
204
205 # setup openvpn server
206 sudo easy-openvpn.setup -u "udp://${SERVER_IP}"
207diff --git a/spread/main/revoke_client/task.yaml b/spread/main/revoke_client/task.yaml
208index 48d97db..9000590 100644
209--- a/spread/main/revoke_client/task.yaml
210+++ b/spread/main/revoke_client/task.yaml
211@@ -4,7 +4,7 @@ execute: |
212 . $TESTSLIB/utilities.sh
213
214 # so enable to setup server in non-interactive mode
215- sudo snap set easy-openvpn nopasswd=1
216+ sudo snap set easy-openvpn server.no-password='true'
217
218 # setup openvpn server
219 sudo easy-openvpn.setup -u "udp://${SERVER_IP}"
220diff --git a/spread/main/setup_server/task.yaml b/spread/main/setup_server/task.yaml
221index 0b1b0c4..7514801 100644
222--- a/spread/main/setup_server/task.yaml
223+++ b/spread/main/setup_server/task.yaml
224@@ -3,11 +3,11 @@ summary: Test setup openvpn server.
225 execute: |
226 . $TESTSLIB/utilities.sh
227
228- # set 'nopasswd' to 1 and check the value in help command
229+ # set 'no-password' to 'true' and check the value in help command
230 # so that we can execute spread test in non-interactive mode
231 # without user attention on password input for private key generation.
232- sudo snap set easy-openvpn nopasswd=1
233- sudo easy-openvpn.help | MATCH "'nopasswd' current value set to: '1'.*"
234+ sudo snap set easy-openvpn server.no-password='true'
235+ sudo easy-openvpn.help | MATCH "'server.no-password' current value set to: 'true'.*"
236
237 # setup openvpn server
238 sudo easy-openvpn.setup -u "udp://${SERVER_IP}"

Subscribers

People subscribed via source and target branches

to all changes: