Merge ~mpontillo/maas:move-network-monitoring-to-maas-common--part1 into maas:master
- Git
- lp:~mpontillo/maas
- move-network-monitoring-to-maas-common--part1
- Merge into master
Proposed by
Mike Pontillo
Status: | Rejected |
---|---|
Rejected by: | Mike Pontillo |
Proposed branch: | ~mpontillo/maas:move-network-monitoring-to-maas-common--part1 |
Merge into: | maas:master |
Diff against target: |
612 lines (+198/-55) 18 files modified
debian/changelog (+7/-0) debian/extras/99-maas-common-sudoers (+4/-0) debian/extras/99-maas-sudoers (+0/-2) debian/maas-common.install (+5/-0) debian/maas-rack-controller.install (+0/-5) debian/maas-rack-controller.lintian-overrides (+2/-1) dev/null (+0/-21) scripts/beacon-monitor (+24/-0) scripts/dhcp-monitor (+20/-0) scripts/multicast-helper (+89/-0) scripts/network-monitor (+21/-0) setup.py (+3/-3) src/provisioningserver/utils/arp.py (+2/-2) src/provisioningserver/utils/beaconing.py (+2/-2) src/provisioningserver/utils/dhcp.py (+2/-2) src/provisioningserver/utils/tests/test_arp.py (+2/-2) src/provisioningserver/utils/tests/test_beaconing.py (+2/-2) utilities/install-sudoers (+13/-13) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
MAAS Maintainers | Pending | ||
Review via email: mp+329400@code.launchpad.net |
Commit message
Packaging: Move scripts to maas-common that are used by the MAAS region controller in addition to the rack.
* Also renames the scripts to remove the redundant "maas-" prefix, and
prevent potential conflicts with the existing package.
Description of the change
This branch looks large, but most of it is just renaming files.
A follow-on branch will add a dependency on python3-
To post a comment you must log in.
Revision history for this message
Mike Pontillo (mpontillo) wrote : | # |
There was an error fetching revisions from git servers. Please try again in a few minutes. If the problem persists, contact Launchpad support.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | diff --git a/debian/changelog b/debian/changelog |
2 | index ed9aba8..ca64683 100644 |
3 | --- a/debian/changelog |
4 | +++ b/debian/changelog |
5 | @@ -1,3 +1,10 @@ |
6 | +maas (2.3.0~alpha3-0ubuntu1) UNRELEASED; urgency=medium |
7 | + |
8 | + * Move scripts to maas-common that are used by the MAAS |
9 | + region controller in addition to the rack. |
10 | + |
11 | + -- Mike Pontillo <mike.pontillo@canonical.com> Tue, 22 Aug 2017 15:28:42 -0700 |
12 | + |
13 | maas (2.3.0~alpha2-6194-g7fb23b0-0ubuntu1) artful; urgency=medium |
14 | |
15 | * New upstream release, 2.3.0 alpha2: |
16 | diff --git a/debian/extras/99-maas-common-sudoers b/debian/extras/99-maas-common-sudoers |
17 | index a4e6542..da4a5af 100644 |
18 | --- a/debian/extras/99-maas-common-sudoers |
19 | +++ b/debian/extras/99-maas-common-sudoers |
20 | @@ -1,6 +1,10 @@ |
21 | maas ALL= NOPASSWD: /usr/bin/lshw |
22 | maas ALL= NOPASSWD: /sbin/blockdev |
23 | |
24 | +# MAAS network monitoring tools. |
25 | +maas ALL= NOPASSWD: /usr/lib/maas/network-monitor |
26 | +maas ALL= NOPASSWD: /usr/lib/maas/beacon-monitor |
27 | + |
28 | # Control of the NTP server: MAAS needs to reconfigure it after editing |
29 | # its configuration file, and start it again if stopped manually. |
30 | maas ALL= NOPASSWD: /bin/systemctl restart ntp |
31 | diff --git a/debian/extras/99-maas-sudoers b/debian/extras/99-maas-sudoers |
32 | index 5d0b0be..c36b644 100644 |
33 | --- a/debian/extras/99-maas-sudoers |
34 | +++ b/debian/extras/99-maas-sudoers |
35 | @@ -11,6 +11,4 @@ maas ALL= NOPASSWD: /bin/systemctl start tgt |
36 | maas ALL= NOPASSWD: /bin/systemctl disable maas-rackd |
37 | maas ALL= NOPASSWD: /bin/systemctl stop maas-rackd |
38 | maas ALL= NOPASSWD: /usr/sbin/maas-rack scan-network * |
39 | -maas ALL= NOPASSWD: /usr/lib/maas/maas-network-monitor |
40 | -maas ALL= NOPASSWD: /usr/lib/maas/maas-beacon-monitor |
41 | maas ALL= NOPASSWD: SETENV: /usr/sbin/tgt-admin, /usr/bin/uec2roottar |
42 | diff --git a/debian/maas-common.install b/debian/maas-common.install |
43 | index a9a647c..aea3a3e 100644 |
44 | --- a/debian/maas-common.install |
45 | +++ b/debian/maas-common.install |
46 | @@ -2,3 +2,8 @@ debian/tmp/usr/share/maas/maas-rsyslog.conf |
47 | debian/extras/99-maas-common-sudoers etc/sudoers.d |
48 | debian/tmp/usr/lib/maas/maas-delete-file |
49 | debian/tmp/usr/lib/maas/maas-write-file |
50 | + |
51 | +# Install network monitoring scripts |
52 | +debian/tmp/usr/lib/maas/network-monitor |
53 | +debian/tmp/usr/lib/maas/beacon-monitor |
54 | +debian/tmp/usr/lib/maas/dhcp-monitor |
55 | diff --git a/debian/maas-rack-controller.install b/debian/maas-rack-controller.install |
56 | index a641331..d448c3a 100644 |
57 | --- a/debian/maas-rack-controller.install |
58 | +++ b/debian/maas-rack-controller.install |
59 | @@ -4,11 +4,6 @@ debian/tmp/usr/bin/uec2roottar |
60 | # Install maas-dhcp-helper |
61 | debian/tmp/usr/sbin/maas-dhcp-helper |
62 | |
63 | -# Install network monitoring scripts |
64 | -debian/tmp/usr/lib/maas/maas-network-monitor |
65 | -debian/tmp/usr/lib/maas/maas-beacon-monitor |
66 | -debian/tmp/usr/lib/maas/maas-dhcp-monitor |
67 | - |
68 | # Install test scripts |
69 | debian/tmp/usr/lib/maas/maas-test-enlistment |
70 | |
71 | diff --git a/debian/maas-rack-controller.lintian-overrides b/debian/maas-rack-controller.lintian-overrides |
72 | index a434dac..6ae74f7 100644 |
73 | --- a/debian/maas-rack-controller.lintian-overrides |
74 | +++ b/debian/maas-rack-controller.lintian-overrides |
75 | @@ -1 +1,2 @@ |
76 | -maas-rack-controller: binary-without-manpage usr/bin/uec2roottar usr/sbin/maas-dhcp-helper usr/lib/maas/maas-network-monitor usr/lib/maas/maas-beacon-monitor usr/lib/maas/maas-dhcp-monitor usr/lib/maas/maas-test-enlistment |
77 | +maas-rack-controller: binary-without-manpage usr/bin/uec2roottar usr/sbin/maas-dhcp-helper usr/lib/maas/maas-test-enlistment |
78 | +maas-common: binary-without-manpage usr/lib/maas/network-monitor usr/lib/maas/beacon-monitor usr/lib/maas/dhcp-monitor |
79 | diff --git a/scripts/beacon-monitor b/scripts/beacon-monitor |
80 | new file mode 100755 |
81 | index 0000000..d06a128 |
82 | --- /dev/null |
83 | +++ b/scripts/beacon-monitor |
84 | @@ -0,0 +1,24 @@ |
85 | +#!/bin/sh -euf |
86 | +# Copyright 2016-2017 Canonical Ltd. This software is licensed under the |
87 | +# GNU Affero General Public License version 3 (see the file LICENSE). |
88 | + |
89 | +# Utility script to wrap `tcpdump`, so that this script can be called with |
90 | +# `sudo` without allowing MAAS access to read arbitrary network traffic. |
91 | +# This script is designed to be as minimal as possible, to prevent arbitrary |
92 | +# code execution. |
93 | + |
94 | +if [ $# -ne 1 ]; then |
95 | + echo "Writes beacon traffic (and beacon traffic on VLANs) to stdout" >&2 |
96 | + echo "using tcpdump's binary PCAP format." >&2 |
97 | + echo "" >&2 |
98 | + echo "Usage:" >&2 |
99 | + echo " $0 <interface>" >&2 |
100 | + exit 32 |
101 | +fi |
102 | + |
103 | +FILTER="udp dst port 5240" |
104 | + |
105 | +exec "${SNAP:-}/usr/sbin/tcpdump" --interface "$1" --direction=in \ |
106 | + --no-promiscuous-mode --packet-buffered --immediate-mode \ |
107 | + --snapshot-length=16384 -n -w - \ |
108 | + "($FILTER) or (vlan and $FILTER)" |
109 | diff --git a/scripts/dhcp-monitor b/scripts/dhcp-monitor |
110 | new file mode 100755 |
111 | index 0000000..450a704 |
112 | --- /dev/null |
113 | +++ b/scripts/dhcp-monitor |
114 | @@ -0,0 +1,20 @@ |
115 | +#!/bin/sh -euf |
116 | +# Copyright 2016 Canonical Ltd. This software is licensed under the |
117 | +# GNU Affero General Public License version 3 (see the file LICENSE). |
118 | + |
119 | +# Utility script to wrap `tcpdump`, so that this script can be called with |
120 | +# `sudo` without allowing MAAS access to read arbitrary network traffic. |
121 | +# This script is designed to be as minimal as possible, to prevent arbitrary |
122 | +# code execution. |
123 | + |
124 | +if [ $# -ne 1 ]; then |
125 | + echo "Write DHCP traffic to stdout using tcpdump's binary PCAP format." >&2 |
126 | + echo "" >&2 |
127 | + echo "Usage:" >&2 |
128 | + echo " $0 <interface>" >&2 |
129 | + exit 32 |
130 | +fi |
131 | + |
132 | +exec /usr/sbin/tcpdump --interface "$1" --no-promiscuous-mode \ |
133 | + --packet-buffered --immediate-mode --snapshot-length=1500 -n -w - \ |
134 | + "udp and (port 67 or port 68) or (vlan and udp and (port 67 or port 68))" |
135 | diff --git a/scripts/maas-beacon-monitor b/scripts/maas-beacon-monitor |
136 | deleted file mode 100755 |
137 | index d06a128..0000000 |
138 | --- a/scripts/maas-beacon-monitor |
139 | +++ /dev/null |
140 | @@ -1,24 +0,0 @@ |
141 | -#!/bin/sh -euf |
142 | -# Copyright 2016-2017 Canonical Ltd. This software is licensed under the |
143 | -# GNU Affero General Public License version 3 (see the file LICENSE). |
144 | - |
145 | -# Utility script to wrap `tcpdump`, so that this script can be called with |
146 | -# `sudo` without allowing MAAS access to read arbitrary network traffic. |
147 | -# This script is designed to be as minimal as possible, to prevent arbitrary |
148 | -# code execution. |
149 | - |
150 | -if [ $# -ne 1 ]; then |
151 | - echo "Writes beacon traffic (and beacon traffic on VLANs) to stdout" >&2 |
152 | - echo "using tcpdump's binary PCAP format." >&2 |
153 | - echo "" >&2 |
154 | - echo "Usage:" >&2 |
155 | - echo " $0 <interface>" >&2 |
156 | - exit 32 |
157 | -fi |
158 | - |
159 | -FILTER="udp dst port 5240" |
160 | - |
161 | -exec "${SNAP:-}/usr/sbin/tcpdump" --interface "$1" --direction=in \ |
162 | - --no-promiscuous-mode --packet-buffered --immediate-mode \ |
163 | - --snapshot-length=16384 -n -w - \ |
164 | - "($FILTER) or (vlan and $FILTER)" |
165 | diff --git a/scripts/maas-dhcp-monitor b/scripts/maas-dhcp-monitor |
166 | deleted file mode 100755 |
167 | index d044d1e..0000000 |
168 | --- a/scripts/maas-dhcp-monitor |
169 | +++ /dev/null |
170 | @@ -1,20 +0,0 @@ |
171 | -#!/bin/sh -euf |
172 | -# Copyright 2016 Canonical Ltd. This software is licensed under the |
173 | -# GNU Affero General Public License version 3 (see the file LICENSE). |
174 | - |
175 | -# Utility script to wrap `tcpdump`, so that this script can be called with |
176 | -# `sudo` without allowing MAAS access to read arbitrary network traffic. |
177 | -# This script is designed to be as minimal as possible, to prevent arbitrary |
178 | -# code execution. |
179 | - |
180 | -if [ $# -ne 1 ]; then |
181 | - echo "Write DHCP traffic to stdout using tcpdump's binary PCAP format." >&2 |
182 | - echo "" >&2 |
183 | - echo "Usage:" >&2 |
184 | - echo " $0 <interface>" >&2 |
185 | - exit 32 |
186 | -fi |
187 | - |
188 | -exec /usr/sbin/tcpdump --interface "$1" --no-promiscuous-mode \ |
189 | - --packet-buffered --immediate-mode --snapshot-length=1500 -n -w - \ |
190 | - "udp and (port 67 or port 68) or (vlan and udp and (port 67 or port 68))" |
191 | diff --git a/scripts/maas-multicast-helper b/scripts/maas-multicast-helper |
192 | deleted file mode 100755 |
193 | index 8e2cfc2..0000000 |
194 | --- a/scripts/maas-multicast-helper |
195 | +++ /dev/null |
196 | @@ -1,89 +0,0 @@ |
197 | -#!/bin/sh -euf |
198 | -# Copyright 2017 Canonical Ltd. This software is licensed under the |
199 | -# GNU Affero General Public License version 3 (see the file LICENSE). |
200 | - |
201 | -# Helper script to join or leave MAAS-reserved multicast groups. |
202 | -# See the IANA registries for more information: |
203 | -# https://www.iana.org/assignments/multicast-addresses/multicast-addresses.xhtml |
204 | -# https://www.iana.org/assignments/ipv6-multicast-addresses/ipv6-multicast-addresses.xhtml |
205 | - |
206 | -IP="/sbin/ip" |
207 | - |
208 | -# Note: The 'ip maddr add <mcast-address> dev <ifname>' command only supports |
209 | -# link-layer multicast addresses. Specifying an IPv4 address will not work. |
210 | -# This is the equivalent of "224.0.0.118". |
211 | -IPV4_GROUP="01:00:5e:00:00:76" |
212 | - |
213 | -# This is the equivalent of the MAAS variable-scope multicast group, and |
214 | -# corresponds to the link-local scoped group "ff02::15a". |
215 | -IPV6_GROUP="33:33:00:00:01:5a" |
216 | - |
217 | -usage() |
218 | -{ |
219 | - echo "Usage: $0 <leave | join> [ifname...]" 1>&2 |
220 | - echo " Attempts to join or leave the MAAS multicast groups." 1>&2 |
221 | - echo " If no interfaces are specified, joins or leaves on all "` |
222 | - `"interfaces." 1>&2 |
223 | -} |
224 | - |
225 | -if [ $# -lt 1 ]; then |
226 | - usage |
227 | - exit 1 |
228 | - |
229 | -fi |
230 | - |
231 | -SUCCESSES=0 |
232 | -FAILURES="" |
233 | - |
234 | -success() |
235 | -{ |
236 | - SUCCESSES=$(($SUCCESSES+1)) |
237 | - echo "$*" |
238 | -} |
239 | - |
240 | -join() |
241 | -{ |
242 | - "$IP" maddr add "$IPV4_GROUP" dev "$1" 2> /dev/null && \ |
243 | - success "$1: joined $IPV4_GROUP" || true |
244 | - "$IP" maddr add "$IPV6_GROUP" dev "$1" 2> /dev/null && \ |
245 | - success "$1: joined $IPV6_GROUP" || true |
246 | -} |
247 | - |
248 | -leave() |
249 | -{ |
250 | - "$IP" maddr del "$IPV4_GROUP" dev "$1" 2> /dev/null && \ |
251 | - success "$1: left $IPV4_GROUP" || true |
252 | - "$IP" maddr del "$IPV6_GROUP" dev "$1" 2> /dev/null && \ |
253 | - success "$1: left $IPV6_GROUP" || true |
254 | -} |
255 | - |
256 | -cmd="$1" |
257 | -shift |
258 | - |
259 | -if [ "$#" -eq 0 ]; then |
260 | - interfaces="$(ip maddr show | awk '/^[0-9]*:/ { print $2 }')" |
261 | -else |
262 | - interfaces="$*" |
263 | -fi |
264 | - |
265 | - |
266 | -if [ "$cmd" = "join" ]; then |
267 | - for ifname in $interfaces; do |
268 | - join "$ifname" |
269 | - done |
270 | -elif [ "$cmd" = "leave" ]; then |
271 | - for ifname in $interfaces; do |
272 | - leave "$ifname" |
273 | - done |
274 | -else |
275 | - usage |
276 | - exit 1 |
277 | -fi |
278 | - |
279 | -if [ $SUCCESSES -eq 0 ]; then |
280 | - echo "$0: $cmd failed. (Try re-running with 'sudo'.)" 1>&2 |
281 | - if [ "$cmd" = "leave" ]; then |
282 | - echo "(This is normal if no groups were joined to begin with.)" 1>&2 |
283 | - fi |
284 | - exit 2 |
285 | -fi |
286 | diff --git a/scripts/maas-network-monitor b/scripts/maas-network-monitor |
287 | deleted file mode 100755 |
288 | index 155f0b8..0000000 |
289 | --- a/scripts/maas-network-monitor |
290 | +++ /dev/null |
291 | @@ -1,21 +0,0 @@ |
292 | -#!/bin/sh -euf |
293 | -# Copyright 2016 Canonical Ltd. This software is licensed under the |
294 | -# GNU Affero General Public License version 3 (see the file LICENSE). |
295 | - |
296 | -# Utility script to wrap `tcpdump`, so that this script can be called with |
297 | -# `sudo` without allowing MAAS access to read arbitrary network traffic. |
298 | -# This script is designed to be as minimal as possible, to prevent arbitrary |
299 | -# code execution. |
300 | - |
301 | -if [ $# -ne 1 ]; then |
302 | - echo "Writes ARP traffic (and ARP traffic on tagged VLANs) to stdout" >&2 |
303 | - echo "using tcpdump's binary PCAP format." >&2 |
304 | - echo "" >&2 |
305 | - echo "Usage:" >&2 |
306 | - echo " $0 <interface>" >&2 |
307 | - exit 32 |
308 | -fi |
309 | - |
310 | -exec "${SNAP:-}/usr/sbin/tcpdump" --interface "$1" --no-promiscuous-mode \ |
311 | - --packet-buffered --immediate-mode --snapshot-length=64 -n -w - \ |
312 | - "arp or (vlan and arp)" |
313 | diff --git a/scripts/multicast-helper b/scripts/multicast-helper |
314 | new file mode 100755 |
315 | index 0000000..8e2cfc2 |
316 | --- /dev/null |
317 | +++ b/scripts/multicast-helper |
318 | @@ -0,0 +1,89 @@ |
319 | +#!/bin/sh -euf |
320 | +# Copyright 2017 Canonical Ltd. This software is licensed under the |
321 | +# GNU Affero General Public License version 3 (see the file LICENSE). |
322 | + |
323 | +# Helper script to join or leave MAAS-reserved multicast groups. |
324 | +# See the IANA registries for more information: |
325 | +# https://www.iana.org/assignments/multicast-addresses/multicast-addresses.xhtml |
326 | +# https://www.iana.org/assignments/ipv6-multicast-addresses/ipv6-multicast-addresses.xhtml |
327 | + |
328 | +IP="/sbin/ip" |
329 | + |
330 | +# Note: The 'ip maddr add <mcast-address> dev <ifname>' command only supports |
331 | +# link-layer multicast addresses. Specifying an IPv4 address will not work. |
332 | +# This is the equivalent of "224.0.0.118". |
333 | +IPV4_GROUP="01:00:5e:00:00:76" |
334 | + |
335 | +# This is the equivalent of the MAAS variable-scope multicast group, and |
336 | +# corresponds to the link-local scoped group "ff02::15a". |
337 | +IPV6_GROUP="33:33:00:00:01:5a" |
338 | + |
339 | +usage() |
340 | +{ |
341 | + echo "Usage: $0 <leave | join> [ifname...]" 1>&2 |
342 | + echo " Attempts to join or leave the MAAS multicast groups." 1>&2 |
343 | + echo " If no interfaces are specified, joins or leaves on all "` |
344 | + `"interfaces." 1>&2 |
345 | +} |
346 | + |
347 | +if [ $# -lt 1 ]; then |
348 | + usage |
349 | + exit 1 |
350 | + |
351 | +fi |
352 | + |
353 | +SUCCESSES=0 |
354 | +FAILURES="" |
355 | + |
356 | +success() |
357 | +{ |
358 | + SUCCESSES=$(($SUCCESSES+1)) |
359 | + echo "$*" |
360 | +} |
361 | + |
362 | +join() |
363 | +{ |
364 | + "$IP" maddr add "$IPV4_GROUP" dev "$1" 2> /dev/null && \ |
365 | + success "$1: joined $IPV4_GROUP" || true |
366 | + "$IP" maddr add "$IPV6_GROUP" dev "$1" 2> /dev/null && \ |
367 | + success "$1: joined $IPV6_GROUP" || true |
368 | +} |
369 | + |
370 | +leave() |
371 | +{ |
372 | + "$IP" maddr del "$IPV4_GROUP" dev "$1" 2> /dev/null && \ |
373 | + success "$1: left $IPV4_GROUP" || true |
374 | + "$IP" maddr del "$IPV6_GROUP" dev "$1" 2> /dev/null && \ |
375 | + success "$1: left $IPV6_GROUP" || true |
376 | +} |
377 | + |
378 | +cmd="$1" |
379 | +shift |
380 | + |
381 | +if [ "$#" -eq 0 ]; then |
382 | + interfaces="$(ip maddr show | awk '/^[0-9]*:/ { print $2 }')" |
383 | +else |
384 | + interfaces="$*" |
385 | +fi |
386 | + |
387 | + |
388 | +if [ "$cmd" = "join" ]; then |
389 | + for ifname in $interfaces; do |
390 | + join "$ifname" |
391 | + done |
392 | +elif [ "$cmd" = "leave" ]; then |
393 | + for ifname in $interfaces; do |
394 | + leave "$ifname" |
395 | + done |
396 | +else |
397 | + usage |
398 | + exit 1 |
399 | +fi |
400 | + |
401 | +if [ $SUCCESSES -eq 0 ]; then |
402 | + echo "$0: $cmd failed. (Try re-running with 'sudo'.)" 1>&2 |
403 | + if [ "$cmd" = "leave" ]; then |
404 | + echo "(This is normal if no groups were joined to begin with.)" 1>&2 |
405 | + fi |
406 | + exit 2 |
407 | +fi |
408 | diff --git a/scripts/network-monitor b/scripts/network-monitor |
409 | new file mode 100755 |
410 | index 0000000..155f0b8 |
411 | --- /dev/null |
412 | +++ b/scripts/network-monitor |
413 | @@ -0,0 +1,21 @@ |
414 | +#!/bin/sh -euf |
415 | +# Copyright 2016 Canonical Ltd. This software is licensed under the |
416 | +# GNU Affero General Public License version 3 (see the file LICENSE). |
417 | + |
418 | +# Utility script to wrap `tcpdump`, so that this script can be called with |
419 | +# `sudo` without allowing MAAS access to read arbitrary network traffic. |
420 | +# This script is designed to be as minimal as possible, to prevent arbitrary |
421 | +# code execution. |
422 | + |
423 | +if [ $# -ne 1 ]; then |
424 | + echo "Writes ARP traffic (and ARP traffic on tagged VLANs) to stdout" >&2 |
425 | + echo "using tcpdump's binary PCAP format." >&2 |
426 | + echo "" >&2 |
427 | + echo "Usage:" >&2 |
428 | + echo " $0 <interface>" >&2 |
429 | + exit 32 |
430 | +fi |
431 | + |
432 | +exec "${SNAP:-}/usr/sbin/tcpdump" --interface "$1" --no-promiscuous-mode \ |
433 | + --packet-buffered --immediate-mode --snapshot-length=64 -n -w - \ |
434 | + "arp or (vlan and arp)" |
435 | diff --git a/setup.py b/setup.py |
436 | index 5182ca5..dffe046 100644 |
437 | --- a/setup.py |
438 | +++ b/setup.py |
439 | @@ -117,9 +117,9 @@ setup( |
440 | ('/usr/sbin', |
441 | ['scripts/maas-dhcp-helper']), |
442 | ('/usr/lib/maas', |
443 | - ['scripts/maas-dhcp-monitor', |
444 | - 'scripts/maas-beacon-monitor', |
445 | - 'scripts/maas-network-monitor', |
446 | + ['scripts/dhcp-monitor', |
447 | + 'scripts/beacon-monitor', |
448 | + 'scripts/network-monitor', |
449 | 'scripts/maas-delete-file', |
450 | 'scripts/maas-test-enlistment', |
451 | 'scripts/maas-write-file']), |
452 | diff --git a/src/provisioningserver/utils/arp.py b/src/provisioningserver/utils/arp.py |
453 | index 8e1f024..70528e7 100644 |
454 | --- a/src/provisioningserver/utils/arp.py |
455 | +++ b/src/provisioningserver/utils/arp.py |
456 | @@ -366,7 +366,7 @@ def add_arguments(parser): |
457 | parser.add_argument( |
458 | '-i', '--input-file', type=str, required=False, |
459 | help="File to read PCAP output from. Use - for stdin. Default is to " |
460 | - "call `sudo /usr/lib/maas/maas-network-monitor` to get input.") |
461 | + "call `sudo /usr/lib/maas/network-monitor` to get input.") |
462 | |
463 | |
464 | def run(args, output=sys.stdout, stdin=sys.stdin, |
465 | @@ -381,7 +381,7 @@ def run(args, output=sys.stdout, stdin=sys.stdin, |
466 | if args.input_file is None: |
467 | if args.interface is None: |
468 | raise ActionScriptError("Required argument: interface") |
469 | - cmd = [get_path("/usr/lib/maas/maas-network-monitor"), args.interface] |
470 | + cmd = [get_path("/usr/lib/maas/network-monitor"), args.interface] |
471 | cmd = sudo(cmd) |
472 | network_monitor = subprocess.Popen( |
473 | cmd, stdin=subprocess.DEVNULL, stdout=subprocess.PIPE) |
474 | diff --git a/src/provisioningserver/utils/beaconing.py b/src/provisioningserver/utils/beaconing.py |
475 | index c28132c..2554725 100644 |
476 | --- a/src/provisioningserver/utils/beaconing.py |
477 | +++ b/src/provisioningserver/utils/beaconing.py |
478 | @@ -339,7 +339,7 @@ def add_arguments(parser): |
479 | parser.add_argument( |
480 | '-i', '--input-file', type=str, required=False, |
481 | help="File to read beaconing output from. Use - for stdin. Default is " |
482 | - "to call `sudo /usr/lib/maas/maas-beacon-monitor` to get input.") |
483 | + "to call `sudo /usr/lib/maas/beacon-monitor` to get input.") |
484 | |
485 | |
486 | def run(args, output=sys.stdout, stdin=sys.stdin, |
487 | @@ -355,7 +355,7 @@ def run(args, output=sys.stdout, stdin=sys.stdin, |
488 | if args.interface is None: |
489 | raise ActionScriptError("Required argument: interface") |
490 | cmd = sudo( |
491 | - [get_path("/usr/lib/maas/maas-beacon-monitor"), args.interface]) |
492 | + [get_path("/usr/lib/maas/beacon-monitor"), args.interface]) |
493 | network_monitor = subprocess.Popen( |
494 | cmd, stdin=subprocess.DEVNULL, stdout=subprocess.PIPE) |
495 | infile = network_monitor.stdout |
496 | diff --git a/src/provisioningserver/utils/dhcp.py b/src/provisioningserver/utils/dhcp.py |
497 | index c912855..84e199a 100644 |
498 | --- a/src/provisioningserver/utils/dhcp.py |
499 | +++ b/src/provisioningserver/utils/dhcp.py |
500 | @@ -244,7 +244,7 @@ def add_arguments(parser): |
501 | parser.add_argument( |
502 | '-i', '--input-file', type=str, required=False, |
503 | help="File to read PCAP output from. Use - for stdin. Default is to " |
504 | - "call `sudo /usr/lib/maas/maas-dhcp-monitor` to get input.") |
505 | + "call `sudo /usr/lib/maas/dhcp-monitor` to get input.") |
506 | |
507 | |
508 | def run(args, output=sys.stdout, stdin=sys.stdin, |
509 | @@ -255,7 +255,7 @@ def run(args, output=sys.stdout, stdin=sys.stdin, |
510 | if args.interface is None: |
511 | raise ActionScriptError("Required argument: interface") |
512 | cmd = sudo( |
513 | - [get_path("/usr/lib/maas/maas-dhcp-monitor"), args.interface]) |
514 | + [get_path("/usr/lib/maas/dhcp-monitor"), args.interface]) |
515 | network_monitor = subprocess.Popen( |
516 | cmd, stdin=subprocess.DEVNULL, stdout=subprocess.PIPE, |
517 | stderr=subprocess.DEVNULL |
518 | diff --git a/src/provisioningserver/utils/tests/test_arp.py b/src/provisioningserver/utils/tests/test_arp.py |
519 | index e8622a5..86ee5ac 100644 |
520 | --- a/src/provisioningserver/utils/tests/test_arp.py |
521 | +++ b/src/provisioningserver/utils/tests/test_arp.py |
522 | @@ -443,7 +443,7 @@ class TestObserveARPCommand(MAASTestCase): |
523 | self.assertThat( |
524 | popen, |
525 | MockCalledOnceWith( |
526 | - ['sudo', '-n', '/usr/lib/maas/maas-network-monitor', 'eth0'], |
527 | + ['sudo', '-n', '/usr/lib/maas/network-monitor', 'eth0'], |
528 | stdin=subprocess.DEVNULL, stdout=subprocess.PIPE)) |
529 | |
530 | def test__calls_subprocess_for_interface_sudo(self): |
531 | @@ -459,7 +459,7 @@ class TestObserveARPCommand(MAASTestCase): |
532 | self.assertThat( |
533 | popen, |
534 | MockCalledOnceWith( |
535 | - ['sudo', '-n', '/usr/lib/maas/maas-network-monitor', 'eth0'], |
536 | + ['sudo', '-n', '/usr/lib/maas/network-monitor', 'eth0'], |
537 | stdin=subprocess.DEVNULL, stdout=subprocess.PIPE)) |
538 | |
539 | def test__checks_for_pipe(self): |
540 | diff --git a/src/provisioningserver/utils/tests/test_beaconing.py b/src/provisioningserver/utils/tests/test_beaconing.py |
541 | index 514b209..708512a 100644 |
542 | --- a/src/provisioningserver/utils/tests/test_beaconing.py |
543 | +++ b/src/provisioningserver/utils/tests/test_beaconing.py |
544 | @@ -234,7 +234,7 @@ class TestObserveBeaconsCommand(MAASTestCase): |
545 | self.assertThat( |
546 | popen, |
547 | MockCalledOnceWith( |
548 | - ['sudo', '-n', '/usr/lib/maas/maas-beacon-monitor', 'eth0'], |
549 | + ['sudo', '-n', '/usr/lib/maas/beacon-monitor', 'eth0'], |
550 | stdin=subprocess.DEVNULL, stdout=subprocess.PIPE)) |
551 | |
552 | def test__calls_subprocess_for_interface_sudo(self): |
553 | @@ -250,7 +250,7 @@ class TestObserveBeaconsCommand(MAASTestCase): |
554 | self.assertThat( |
555 | popen, |
556 | MockCalledOnceWith( |
557 | - ['sudo', '-n', '/usr/lib/maas/maas-beacon-monitor', 'eth0'], |
558 | + ['sudo', '-n', '/usr/lib/maas/beacon-monitor', 'eth0'], |
559 | stdin=subprocess.DEVNULL, stdout=subprocess.PIPE)) |
560 | |
561 | def test__checks_for_pipe(self): |
562 | diff --git a/utilities/install-sudoers b/utilities/install-sudoers |
563 | index ed498d6..9d421e0 100755 |
564 | --- a/utilities/install-sudoers |
565 | +++ b/utilities/install-sudoers |
566 | @@ -2,33 +2,33 @@ |
567 | |
568 | SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" |
569 | |
570 | -echo "Copying /usr/lib/maas/maas-network-monitor..." |
571 | +echo "Copying /usr/lib/maas/network-monitor..." |
572 | sudo mkdir -p /usr/lib/maas |
573 | -sudo cp "$SCRIPT_DIR/../scripts/maas-network-monitor" /usr/lib/maas/maas-network-monitor |
574 | -echo "Copying /usr/lib/maas/maas-dhcp-monitor..." |
575 | -sudo cp "$SCRIPT_DIR/../scripts/maas-dhcp-monitor" /usr/lib/maas/maas-dhcp-monitor |
576 | -echo "Copying /usr/lib/maas/maas-beacon-monitor..." |
577 | -sudo cp "$SCRIPT_DIR/../scripts/maas-beacon-monitor" /usr/lib/maas/maas-beacon-monitor |
578 | +sudo cp "$SCRIPT_DIR/../scripts/network-monitor" /usr/lib/maas/network-monitor |
579 | +echo "Copying /usr/lib/maas/dhcp-monitor..." |
580 | +sudo cp "$SCRIPT_DIR/../scripts/dhcp-monitor" /usr/lib/maas/dhcp-monitor |
581 | +echo "Copying /usr/lib/maas/beacon-monitor..." |
582 | +sudo cp "$SCRIPT_DIR/../scripts/beacon-monitor" /usr/lib/maas/beacon-monitor |
583 | |
584 | SUDOERS_FILE=/etc/sudoers.d/99-maas-dev-$USER |
585 | |
586 | echo "Installing sudoers file: $SUDOERS_FILE" |
587 | cat << EOF | sudo tee $SUDOERS_FILE |
588 | -$USER ALL= NOPASSWD: /usr/lib/maas/maas-network-monitor |
589 | -$USER ALL= NOPASSWD: /usr/lib/maas/maas-dhcp-monitor |
590 | -$USER ALL= NOPASSWD: /usr/lib/maas/maas-beacon-monitor |
591 | +$USER ALL= NOPASSWD: /usr/lib/maas/network-monitor |
592 | +$USER ALL= NOPASSWD: /usr/lib/maas/dhcp-monitor |
593 | +$USER ALL= NOPASSWD: /usr/lib/maas/beacon-monitor |
594 | EOF |
595 | sudo chmod 440 $SUDOERS_FILE |
596 | |
597 | echo "" |
598 | echo "Done. You should now be able to run the following to get raw 'tcpdump' output:" |
599 | -echo " sudo /usr/lib/maas/maas-network-monitor <interface>" |
600 | -echo " sudo /usr/lib/maas/maas-dhcp-monitor <interface>" |
601 | -echo " sudo /usr/lib/maas/maas-beacon-monitor <interface>" |
602 | +echo " sudo /usr/lib/maas/network-monitor <interface>" |
603 | +echo " sudo /usr/lib/maas/dhcp-monitor <interface>" |
604 | +echo " sudo /usr/lib/maas/beacon-monitor <interface>" |
605 | echo "" |
606 | echo "In addition, the following commands should now work in the dev env:" |
607 | echo "Done. You should now be able to do the following to get raw 'tcpdump' output:" |
608 | -echo " sudo /usr/lib/maas/maas-dhcp-monitor <interface>" |
609 | +echo " sudo /usr/lib/maas/dhcp-monitor <interface>" |
610 | echo "In addition, the following command should now work in the dev env:" |
611 | echo " bin/maas-rack observe-arp <interface>" |
612 | echo " bin/maas-rack observe-dhcp <interface>" |
Rejecting in favor of proposing a single branch.