Merge lp:~adam-collard/landscape-client/drop-dbus into lp:~landscape/landscape-client/trunk

Proposed by Adam Collard
Status: Merged
Approved by: Adam Collard
Approved revision: 929
Merged at revision: 930
Proposed branch: lp:~adam-collard/landscape-client/drop-dbus
Merge into: lp:~landscape/landscape-client/trunk
Diff against target: 979 lines (+29/-626)
28 files modified
Makefile (+0/-7)
README (+3/-7)
dbus-1/landscape.conf (+0/-50)
debian/changelog (+6/-0)
debian/control (+2/-2)
debian/landscape-client.install (+0/-3)
debian/landscape-client.manpages (+0/-1)
debian/landscape-client.postinst (+0/-11)
debian/landscape-common.postinst (+3/-3)
debian/landscape-common.prerm (+1/-1)
debian/rules (+0/-18)
debian/source.lintian-overrides (+1/-12)
dev/run-piuparts (+0/-14)
landscape/broker/exchange.py (+1/-2)
landscape/lib/bpickle_dbus.py (+0/-65)
landscape/service.py (+0/-6)
landscape/tests/test_service.py (+0/-9)
landscape/tests/test_textmessage.py (+0/-112)
landscape/textmessage.py (+0/-103)
landscape/watchdog.py (+2/-4)
man/landscape-client.1 (+5/-5)
man/landscape-config.1 (+2/-2)
man/landscape-message.1 (+0/-51)
man/landscape-message.txt (+0/-32)
man/landscape-sysinfo.1 (+2/-2)
scripts/landscape-dbus-proxy (+0/-91)
scripts/landscape-message (+0/-8)
setup.py (+1/-5)
To merge this branch: bzr merge lp:~adam-collard/landscape-client/drop-dbus
Reviewer Review Type Date Requested Status
🤖 Landscape Builder test results Approve
Free Ekanayaka (community) Approve
Alberto Donato (community) Approve
Review via email: mp+314990@code.launchpad.net

Commit message

Remove dead dbus code and textmessage (confirmed not supported in server for ~2 years).

Drive-by fixes for lintian complaints.

Description of the change

Remove dead dbus code and textmessage (confirmed not supported in server for ~2 years).

Drive-by fixes for lintian complaints.

Testing instructions:
 * make check
 * make package
 * Install package locally, confirm server integration tests pass

To post a comment you must log in.
928. By Adam Collard

Merge from trunk

Revision history for this message
🤖 Landscape Builder (landscape-builder) :
review: Abstain (executing tests)
Revision history for this message
🤖 Landscape Builder (landscape-builder) wrote :

Command: TRIAL_ARGS=-j4 make check
Result: Success
Revno: 928
Branch: lp:~adam-collard/landscape-client/drop-dbus
Jenkins: https://ci.lscape.net/job/latch-test-precise/855/

review: Approve (test results)
Revision history for this message
Alberto Donato (ack) wrote :

+1

One nit inline

review: Approve
Revision history for this message
Free Ekanayaka (free.ekanayaka) wrote :

I can't see anything harmful, so KIWF! +1

review: Approve
929. By Adam Collard

Drop unnecesary variable for use_dhpython2 since we always use it.

Revision history for this message
Adam Collard (adam-collard) :
Revision history for this message
🤖 Landscape Builder (landscape-builder) :
review: Abstain (executing tests)
Revision history for this message
🤖 Landscape Builder (landscape-builder) wrote :

Command: TRIAL_ARGS=-j4 make check
Result: Success
Revno: 929
Branch: lp:~adam-collard/landscape-client/drop-dbus
Jenkins: https://ci.lscape.net/job/latch-test-precise/856/

review: Approve (test results)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'Makefile'
--- Makefile 2016-06-17 00:17:50 +0000
+++ Makefile 2017-01-18 09:59:00 +0000
@@ -23,12 +23,6 @@
23 $(PYTHON) setup.py build_ext -i23 $(PYTHON) setup.py build_ext -i
2424
25check: build25check: build
26 @if [ -z "$$DBUS_SESSION_BUS_ADDRESS" ]; then \
27 OUTPUT=`dbus-daemon --print-address=1 --print-pid=1 --session --fork`; \
28 export DBUS_SESSION_BUS_ADDRESS=`echo $$OUTPUT | cut -f1 -d ' '`; \
29 DBUS_PID=`echo $$OUTPUT | cut -f2 -d ' '`; \
30 trap "kill $$DBUS_PID" EXIT; \
31 fi; \
32 if [ -z "$$DISPLAY" ]; then \26 if [ -z "$$DISPLAY" ]; then \
33 xvfb-run $(TEST_COMMAND); \27 xvfb-run $(TEST_COMMAND); \
34 else \28 else \
@@ -60,7 +54,6 @@
60manpages:54manpages:
61 LC_ALL=C ${TXT2MAN} -P Landscape -s 1 -t landscape-client < man/landscape-client.txt > man/landscape-client.155 LC_ALL=C ${TXT2MAN} -P Landscape -s 1 -t landscape-client < man/landscape-client.txt > man/landscape-client.1
62 LC_ALL=C ${TXT2MAN} -P Landscape -s 1 -t landscape-config < man/landscape-config.txt > man/landscape-config.156 LC_ALL=C ${TXT2MAN} -P Landscape -s 1 -t landscape-config < man/landscape-config.txt > man/landscape-config.1
63 LC_ALL=C ${TXT2MAN} -P Landscape -s 1 -t landscape-message < man/landscape-message.txt > man/landscape-message.1
64 LC_ALL=C ${TXT2MAN} -P Landscape -s 1 -t landscape-sysinfo < man/landscape-sysinfo.txt > man/landscape-sysinfo.157 LC_ALL=C ${TXT2MAN} -P Landscape -s 1 -t landscape-sysinfo < man/landscape-sysinfo.txt > man/landscape-sysinfo.1
6558
66origtarball: sdist59origtarball: sdist
6760
=== modified file 'README'
--- README 2012-03-05 14:11:42 +0000
+++ README 2017-01-18 09:59:00 +0000
@@ -23,13 +23,9 @@
2323
24== Developing ==24== Developing ==
2525
26To run the full test suite, you must have a dbus session bus26To run the full test suite, run the following command:
27running. If you don't have one (for example, if you're running the27
28tests in an ssh session), run the following command:28make check
29
30export DBUS_SESSION_BUS_ADDRESS=`dbus-daemon --print-address=1 --session --fork`
31
32Then your tests should pass.
3329
34When you want to test the landscape client manually without management30When you want to test the landscape client manually without management
35features, you can simply run:31features, you can simply run:
3632
=== removed directory 'dbus-1'
=== removed file 'dbus-1/landscape.conf'
--- dbus-1/landscape.conf 2013-05-20 07:28:42 +0000
+++ dbus-1/landscape.conf 1970-01-01 00:00:00 +0000
@@ -1,50 +0,0 @@
1<!DOCTYPE busconfig PUBLIC
2 "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
3 "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
4<busconfig>
5
6 <policy user="landscape">
7 <allow own="com.canonical.landscape.Broker" />
8 <allow own="com.canonical.landscape.Monitor" />
9
10 <allow send_destination="com.canonical.landscape.Broker" />
11 <allow receive_sender="com.canonical.landscape.Broker" />
12
13 <allow send_destination="com.canonical.landscape.Monitor" />
14 <allow receive_sender="com.canonical.landscape.Monitor" />
15
16 <allow send_destination="com.canonical.landscape.Manager" />
17 <allow receive_sender="com.canonical.landscape.Manager" />
18
19 </policy>
20
21 <policy user="root">
22 <allow own="com.canonical.landscape.Manager" />
23
24 <allow send_destination="com.canonical.landscape.Broker" />
25 <allow receive_sender="com.canonical.landscape.Broker" />
26
27 <allow send_destination="com.canonical.landscape.Monitor" />
28 <allow receive_sender="com.canonical.landscape.Monitor" />
29
30 <allow send_destination="com.canonical.landscape.Manager" />
31 <allow receive_sender="com.canonical.landscape.Manager" />
32 </policy>
33
34 <policy context="default">
35 <deny own="com.canonical.landscape.Broker" />
36 <deny own="com.canonical.landscape.Monitor" />
37 <deny own="com.canonical.landscape.Manager" />
38
39 <deny send_destination="com.canonical.landscape.Broker" />
40 <deny receive_sender="com.canonical.landscape.Broker" />
41
42 <deny send_destination="com.canonical.landscape.Monitor" />
43 <deny receive_sender="com.canonical.landscape.Monitor" />
44
45 <deny send_destination="com.canonical.landscape.Manager" />
46 <deny receive_sender="com.canonical.landscape.Manager" />
47
48 </policy>
49
50</busconfig>
510
=== modified file 'debian/changelog'
--- debian/changelog 2016-12-20 17:31:16 +0000
+++ debian/changelog 2017-01-18 09:59:00 +0000
@@ -1,3 +1,9 @@
1landscape-client (16.08+bzr925-0ubuntu0) xenial; urgency=medium
2
3 * New local test build
4
5 -- Adam Collard <adam.collard@canonical.com> Wed, 18 Jan 2017 09:11:33 +0000
6
1landscape-client (16.08-0ubuntu1) UNRELEASED; urgency=medium7landscape-client (16.08-0ubuntu1) UNRELEASED; urgency=medium
28
3 * New trunk build9 * New trunk build
410
=== modified file 'debian/control'
--- debian/control 2016-03-23 08:14:06 +0000
+++ debian/control 2017-01-18 09:59:00 +0000
@@ -25,7 +25,7 @@
25Suggests: ${extra:Suggests}25Suggests: ${extra:Suggests}
26Breaks: landscape-client-ui (<< 16.04), landscape-client-ui-install (<< 16.04)26Breaks: landscape-client-ui (<< 16.04), landscape-client-ui-install (<< 16.04)
27Replaces: landscape-client-ui (<< 16.04), landscape-client-ui-install (<< 16.04)27Replaces: landscape-client-ui (<< 16.04), landscape-client-ui-install (<< 16.04)
28Description: The Landscape administration system client - Common files28Description: Landscape administration system client - Common files
29 Landscape is a web-based tool for managing Ubuntu systems. This29 Landscape is a web-based tool for managing Ubuntu systems. This
30 package is necessary if you want your machine to be managed in a30 package is necessary if you want your machine to be managed in a
31 Landscape account.31 Landscape account.
@@ -41,7 +41,7 @@
41 python-pycurl,41 python-pycurl,
42 landscape-common (= ${binary:Version})42 landscape-common (= ${binary:Version})
43Suggests: ${extra:Suggests}43Suggests: ${extra:Suggests}
44Description: The Landscape administration system client44Description: Landscape administration system client
45 Landscape is a web-based tool for managing Ubuntu systems. This45 Landscape is a web-based tool for managing Ubuntu systems. This
46 package is necessary if you want your machine to be managed in a46 package is necessary if you want your machine to be managed in a
47 Landscape account.47 Landscape account.
4848
=== modified file 'debian/landscape-client.install'
--- debian/landscape-client.install 2016-01-07 10:45:00 +0000
+++ debian/landscape-client.install 2017-01-18 09:59:00 +0000
@@ -2,11 +2,8 @@
2usr/bin/landscape-client2usr/bin/landscape-client
3usr/bin/landscape-config3usr/bin/landscape-config
4usr/bin/landscape-manager4usr/bin/landscape-manager
5usr/bin/landscape-message
6usr/bin/landscape-monitor5usr/bin/landscape-monitor
7usr/bin/landscape-package-changer6usr/bin/landscape-package-changer
8usr/bin/landscape-package-reporter7usr/bin/landscape-package-reporter
9usr/bin/landscape-release-upgrader8usr/bin/landscape-release-upgrader
10usr/bin/landscape-dbus-proxy
11usr/lib/landscape9usr/lib/landscape
12etc/dbus-1/system.d/landscape.conf
1310
=== modified file 'debian/landscape-client.manpages'
--- debian/landscape-client.manpages 2012-09-26 14:04:47 +0000
+++ debian/landscape-client.manpages 2017-01-18 09:59:00 +0000
@@ -1,3 +1,2 @@
1man/landscape-client.11man/landscape-client.1
2man/landscape-config.12man/landscape-config.1
3man/landscape-message.1
43
=== modified file 'debian/landscape-client.postinst' (properties changed: -x to +x)
--- debian/landscape-client.postinst 2016-08-15 15:22:40 +0000
+++ debian/landscape-client.postinst 2017-01-18 09:59:00 +0000
@@ -98,17 +98,6 @@
98 dpkg-statoverride --update --add root landscape 4754 $apt_update98 dpkg-statoverride --update --add root landscape 4754 $apt_update
99 fi99 fi
100100
101 # Check if we're upgrading from a D-Bus version like the client in the
102 # lucid archives.
103 if ! [ -z $2 ]; then
104 if dpkg --compare-versions $2 lt 1.5.1; then
105 # Launch a proxy service that will forward requests over DBus
106 # from the old package-changer to the new AMP-based broker. This
107 # is a one-off only needed for the DBus->AMP upgrade
108 start-stop-daemon -x /usr/bin/landscape-dbus-proxy -b -c landscape -u landscape -S
109 fi
110 fi
111
112 # In response to bug 1508110 we need to trigger a complete update of101 # In response to bug 1508110 we need to trigger a complete update of
113 # user information. The flag file will be removed by the client when102 # user information. The flag file will be removed by the client when
114 # the update completes.103 # the update completes.
115104
=== modified file 'debian/landscape-common.postinst' (properties changed: -x to +x)
--- debian/landscape-common.postinst 2016-09-16 09:58:18 +0000
+++ debian/landscape-common.postinst 2017-01-18 09:59:00 +0000
@@ -41,14 +41,14 @@
41 if [ "$RET" = "Cache sysinfo in /etc/motd" ]; then41 if [ "$RET" = "Cache sysinfo in /etc/motd" ]; then
42 rm -f $PROFILE_LOCATION 2>/dev/null || true42 rm -f $PROFILE_LOCATION 2>/dev/null || true
43 ln -sf $WRAPPER $UPDATE_MOTD_LOCATION43 ln -sf $WRAPPER $UPDATE_MOTD_LOCATION
44 /usr/sbin/update-motd 2>/dev/null || true44 update-motd 2>/dev/null || true
45 elif [ "$RET" = "Run sysinfo on every login" ]; then45 elif [ "$RET" = "Run sysinfo on every login" ]; then
46 rm -f $UPDATE_MOTD_LOCATION 2>/dev/null || true46 rm -f $UPDATE_MOTD_LOCATION 2>/dev/null || true
47 /usr/sbin/update-motd 2>/dev/null || true47 update-motd 2>/dev/null || true
48 ln -sf $WRAPPER $PROFILE_LOCATION48 ln -sf $WRAPPER $PROFILE_LOCATION
49 else49 else
50 rm -f $UPDATE_MOTD_LOCATION 2>/dev/null || true50 rm -f $UPDATE_MOTD_LOCATION 2>/dev/null || true
51 /usr/sbin/update-motd 2>/dev/null || true51 update-motd 2>/dev/null || true
52 rm -f $PROFILE_LOCATION || true52 rm -f $PROFILE_LOCATION || true
53 fi53 fi
5454
5555
=== modified file 'debian/landscape-common.prerm' (properties changed: -x to +x)
--- debian/landscape-common.prerm 2016-09-16 10:05:55 +0000
+++ debian/landscape-common.prerm 2017-01-18 09:59:00 +0000
@@ -21,7 +21,7 @@
21 remove|upgrade|deconfigure)21 remove|upgrade|deconfigure)
22 dpkg-divert --remove --package landscape-common --rename /etc/update-motd.d/90-updates-available22 dpkg-divert --remove --package landscape-common --rename /etc/update-motd.d/90-updates-available
23 rm -f /etc/update-motd.d/50-landscape-sysinfo 2>/dev/null || true23 rm -f /etc/update-motd.d/50-landscape-sysinfo 2>/dev/null || true
24 /usr/sbin/update-motd 2>/dev/null || true24 update-motd 2>/dev/null || true
25 rm -f /etc/profile.d/landscape-sysinfo.sh 2>/dev/null || true25 rm -f /etc/profile.d/landscape-sysinfo.sh 2>/dev/null || true
26 ;;26 ;;
2727
2828
=== modified file 'debian/rules'
--- debian/rules 2016-07-06 12:08:20 +0000
+++ debian/rules 2017-01-18 09:59:00 +0000
@@ -1,12 +1,6 @@
1#!/usr/bin/make -f1#!/usr/bin/make -f
22
3dist_release := $(shell lsb_release -cs)3dist_release := $(shell lsb_release -cs)
4ifneq ($(dist_release),dapper)
5 use_pycentral = yes
6endif
7ifeq (,$(filter $(dist_release), hardy lucid))
8 use_dhpython2 = yes
9endif
104
11dh_extra_flags = -plandscape-common -plandscape-client5dh_extra_flags = -plandscape-common -plandscape-client
126
@@ -92,19 +86,7 @@
92 echo "extra:Depends=libpam-systemd" >> $(landscape_client_substvars)86 echo "extra:Depends=libpam-systemd" >> $(landscape_client_substvars)
93endif87endif
9488
95ifeq ($(use_dhpython2),yes)
96 dh_python2 --no-guessing-versions89 dh_python2 --no-guessing-versions
97else
98 ifeq ($(use_pycentral),yes)
99 ifneq (,$(py_setup_install_args))
100 DH_PYCENTRAL=include-links dh_pycentral
101 else
102 DH_PYCENTRAL=nomove dh_pycentral
103 endif
104 else
105 dh_python
106 endif
107endif
108 dh_installdeb $(dh_extra_flags)90 dh_installdeb $(dh_extra_flags)
109 dh_gencontrol $(dh_extra_flags)91 dh_gencontrol $(dh_extra_flags)
110 dh_md5sums $(dh_extra_flags)92 dh_md5sums $(dh_extra_flags)
11193
=== modified file 'debian/source.lintian-overrides'
--- debian/source.lintian-overrides 2012-05-28 19:45:04 +0000
+++ debian/source.lintian-overrides 2017-01-18 09:59:00 +0000
@@ -1,15 +1,4 @@
1# we use dh_python or dh_python2 depending on the ubuntu release1# we use dh_python or dh_python2 depending on the ubuntu release
2# the package is being built on, this is detected dynamically2# the package is being built on, this is detected dynamically
3# in the rules file3# in the rules file
4landscape-client source: dh_python-is-obsolete4landscape-client source: dh_python-is-obsolete
5
6# the package has to build on lucid, where the standards version
7# is 3.8.2
8landscape-client source: ancient-standards-version
9
10# it's a bug that should be fixed in quantal
11landscape-client source: unknown-field-in-dsc original-maintainer
12
13# this is only used in a very specific client upgrade from
14# the dbus to the amp version
15landscape-client: start-stop-daemon-in-maintainer-script postinst:130
16\ No newline at end of file5\ No newline at end of file
176
=== modified file 'dev/run-piuparts'
--- dev/run-piuparts 2014-10-29 11:18:17 +0000
+++ dev/run-piuparts 2017-01-18 09:59:00 +0000
@@ -24,17 +24,6 @@
24}24}
2525
26#26#
27# Check if X is running, if not abort because we would make X crash (D-Bus!)
28#
29if pidof X > /dev/null; then
30 cat <<EOF
31It appears you're running an X session. This script would kill your session
32due to landscape-client reloading dbus in its postinst script. Quitting now.
33EOF
34 exit 1
35fi
36
37#
38# Check we have piuparts >= 0.3627# Check we have piuparts >= 0.36
39#28#
40PIUPARTS_VERSION=$(sudo piuparts --version 2>/dev/null| cut -f 2 -d " ")29PIUPARTS_VERSION=$(sudo piuparts --version 2>/dev/null| cut -f 2 -d " ")
@@ -140,10 +129,7 @@
140 -I "/var/lib/.*" \129 -I "/var/lib/.*" \
141 -I "/usr/lib/python2.6/dist-packages/twisted.*" \130 -I "/usr/lib/python2.6/dist-packages/twisted.*" \
142 -i /etc/X11 \131 -i /etc/X11 \
143 -i /etc/dbus-1 \
144 -i /etc/dbus-1/system.d \
145 -I "/usr/lib/python2.4/site-packages/apt.*" \132 -I "/usr/lib/python2.4/site-packages/apt.*" \
146 -I "/usr/lib/python2.4/site-packages/dbus.*" \
147 -I "/usr/lib/python2.5/site-packages/twisted.*" \133 -I "/usr/lib/python2.5/site-packages/twisted.*" \
148 -b ${BASETGZ} \134 -b ${BASETGZ} \
149 ${SOURCE}_${VERSION}_${ARCH}.changes135 ${SOURCE}_${VERSION}_${ARCH}.changes
150136
=== modified file 'landscape/broker/exchange.py'
--- landscape/broker/exchange.py 2015-01-12 09:27:02 +0000
+++ landscape/broker/exchange.py 2017-01-18 09:59:00 +0000
@@ -833,8 +833,7 @@
833 handler(message)833 handler(message)
834834
835 def register_client_accepted_message_type(self, type):835 def register_client_accepted_message_type(self, type):
836 # stringify the type because it's a dbus.String. It should work836 # stringify the type for sanity and less confusing logs.
837 # anyway, but this is just for sanity and less confusing logs.
838 self._client_accepted_types.add(str(type))837 self._client_accepted_types.add(str(type))
839838
840 def get_client_accepted_message_types(self):839 def get_client_accepted_message_types(self):
841840
=== removed file 'landscape/lib/bpickle_dbus.py'
--- landscape/lib/bpickle_dbus.py 2012-03-06 09:17:51 +0000
+++ landscape/lib/bpickle_dbus.py 1970-01-01 00:00:00 +0000
@@ -1,65 +0,0 @@
1"""
2Different versions of the Python DBus bindings return different types
3to represent integers, strings, lists, etc. Older versions return
4builtin Python types: C{int}, C{str}, C{list}, etc. Newer versions
5return DBus-specific wrappers: C{Int16}, C{String}, C{Array}, etc.
6Failures occur when DBus types are used because bpickle doesn't know
7that an C{Int16} is really an C{int} and that an C{Array} is really a
8C{list}.
9
10L{install} and L{uninstall} can install and remove extensions that
11make bpickle work with DBus types.
12"""
13
14import dbus
15
16from landscape.lib import bpickle
17
18
19def install():
20 """Install bpickle extensions for DBus types."""
21 for type, function in get_dbus_types():
22 bpickle.dumps_table[type] = function
23
24
25def uninstall():
26 """Uninstall bpickle extensions for DBus types."""
27 for type, function in get_dbus_types():
28 del bpickle.dumps_table[type]
29
30
31def dumps_utf8string(obj):
32 """
33 Convert the specified L{dbus.types.UTF8String} to bpickle's
34 representation for C{unicode} data.
35 """
36 return "u%s:%s" % (len(obj), obj)
37
38
39def dumps_double(obj):
40 """
41 Convert a dbus.types.Double into a floating point representation.
42 """
43 return "f%r;" % float(obj)
44
45
46def get_dbus_types():
47 """
48 Generator yields C{(type, bpickle_function)} for available DBus
49 types.
50 """
51 for (type_name, function) in [("Boolean", bpickle.dumps_bool),
52 ("Int16", bpickle.dumps_int),
53 ("UInt16", bpickle.dumps_int),
54 ("Int32", bpickle.dumps_int),
55 ("UInt32", bpickle.dumps_int),
56 ("Int64", bpickle.dumps_int),
57 ("UInt64", bpickle.dumps_int),
58 ("Double", dumps_double),
59 ("Array", bpickle.dumps_list),
60 ("Dictionary", bpickle.dumps_dict),
61 ("String", bpickle.dumps_unicode),
62 ("UTF8String", dumps_utf8string)]:
63 type = getattr(dbus.types, type_name, None)
64 if type is not None:
65 yield type, function
660
=== modified file 'landscape/service.py'
--- landscape/service.py 2013-05-14 22:57:15 +0000
+++ landscape/service.py 2017-01-18 09:59:00 +0000
@@ -27,12 +27,6 @@
2727
28 def __init__(self, config):28 def __init__(self, config):
29 self.config = config29 self.config = config
30 try:
31 from landscape.lib import bpickle_dbus
32 except ImportError:
33 pass
34 else:
35 bpickle_dbus.install()
36 self.reactor = self.reactor_factory()30 self.reactor = self.reactor_factory()
37 if self.persist_filename:31 if self.persist_filename:
38 self.persist = get_versioned_persist(self)32 self.persist = get_versioned_persist(self)
3933
=== modified file 'landscape/tests/test_service.py'
--- landscape/tests/test_service.py 2016-08-17 20:31:48 +0000
+++ landscape/tests/test_service.py 2017-01-18 09:59:00 +0000
@@ -1,6 +1,5 @@
1import logging1import logging
2import signal2import signal
3import mock
43
5from twisted.internet import reactor4from twisted.internet import reactor
6from twisted.internet.task import deferLater5from twisted.internet.task import deferLater
@@ -53,14 +52,6 @@
53 service = TestService(self.config)52 service = TestService(self.config)
54 self.assertFalse(hasattr(service, "persist"))53 self.assertFalse(hasattr(service, "persist"))
5554
56 @mock.patch("landscape.lib.bpickle_dbus.install")
57 def test_install_bpickle_dbus(self, mock_install):
58 """
59 A L{LandscapeService} installs the DBus extensions of bpickle.
60 """
61 TestService(self.config)
62 mock_install.assert_called_once_with()
63
64 def test_usr1_rotates_logs(self):55 def test_usr1_rotates_logs(self):
65 """56 """
66 SIGUSR1 should cause logs to be reopened.57 SIGUSR1 should cause logs to be reopened.
6758
=== removed file 'landscape/tests/test_textmessage.py'
--- landscape/tests/test_textmessage.py 2012-03-05 14:11:42 +0000
+++ landscape/tests/test_textmessage.py 1970-01-01 00:00:00 +0000
@@ -1,112 +0,0 @@
1import sys
2
3from landscape.textmessage import (
4 AcceptedTypeError, EmptyMessageError, got_accepted_types, get_message,
5 send_message)
6from landscape.tests.helpers import (
7 LandscapeTest, FakeBrokerServiceHelper, StandardIOHelper)
8
9
10class SendMessageTest(LandscapeTest):
11
12 helpers = [StandardIOHelper, FakeBrokerServiceHelper]
13
14 def test_send_message(self):
15 """
16 L{send_message} should send a message of type
17 C{text-message} to the landscape dbus messaging service.
18 """
19 service = self.broker_service
20 service.message_store.set_accepted_types(["text-message"])
21
22 result = send_message(u"Hi there!", self.remote)
23
24 def got_result(result):
25 messages = service.message_store.get_pending_messages()
26 self.assertEqual(len(messages), 1)
27 self.assertMessage(messages[0], {"type": "text-message",
28 "message": u"Hi there!"})
29 self.assertTrue(service.exchanger.is_urgent())
30 return result.addCallback(got_result)
31
32 def test_got_accepted_types_without_text_message_type(self):
33 """
34 If 'text-message' isn't in the list of accepted types an
35 L{AcceptedTypeError} is raised.
36 """
37 self.assertRaises(AcceptedTypeError, got_accepted_types, (),
38 self.remote, ())
39
40 def test_got_accepted_types(self):
41 """
42 If 'text-message' is an accepted type a message should be
43 retrieved from the user and sent to the broker.
44 """
45 service = self.broker_service
46 service.message_store.set_accepted_types(["text-message"])
47
48 input = u"Foobl\N{HIRAGANA LETTER A}"
49 self.stdin.write(input.encode("UTF-8"))
50 self.stdin.seek(0, 0)
51
52 def got_result(result):
53 messages = service.message_store.get_pending_messages()
54 self.assertEqual(len(messages), 1)
55 self.assertMessage(messages[0],
56 {"type": "text-message",
57 "message": u"Foobl\N{HIRAGANA LETTER A}"})
58
59 d = got_accepted_types(["text-message"], self.remote, ())
60 d.addCallback(got_result)
61 return d
62
63
64class ScriptTest(LandscapeTest):
65
66 helpers = [StandardIOHelper]
67
68 def test_get_message(self):
69 """
70 A message should be properly decoded from the command line arguments.
71 """
72 message = get_message(
73 ["landscape-message",
74 u"\N{HIRAGANA LETTER A}".encode(sys.stdin.encoding), "a!"])
75 self.assertEqual(message, u"\N{HIRAGANA LETTER A} a!")
76
77 def test_get_message_stdin(self):
78 """
79 If no arguments are specified then the message should be read
80 from stdin.
81 """
82 input = u"Foobl\N{HIRAGANA LETTER A}"
83 self.stdin.write(input.encode("UTF-8"))
84 self.stdin.seek(0, 0)
85 message = get_message(["landscape-message"])
86 self.assertEqual(self.stdout.getvalue(),
87 "Please enter your message, and send EOF "
88 "(Control + D after newline) when done.\n")
89 self.assertEqual(message, input)
90
91 def test_get_empty_message_stdin(self):
92 """
93 If no arguments are specified then the message should be read
94 from stdin.
95 """
96 self.assertRaises(EmptyMessageError,
97 get_message, ["landscape-message"])
98
99 def test_get_message_without_encoding(self):
100 """
101 If sys.stdin.encoding is None, it's likely a pipe, so try to
102 decode it as UTF-8 by default.
103 """
104 encoding = sys.stdin.encoding
105 sys.stdin.encoding = None
106 try:
107 message = get_message(
108 ["landscape-message",
109 u"\N{HIRAGANA LETTER A}".encode("UTF-8"), "a!"])
110 finally:
111 sys.stdin.encoding = encoding
112 self.assertEqual(message, u"\N{HIRAGANA LETTER A} a!")
1130
=== removed file 'landscape/textmessage.py'
--- landscape/textmessage.py 2013-05-21 08:37:08 +0000
+++ landscape/textmessage.py 1970-01-01 00:00:00 +0000
@@ -1,103 +0,0 @@
1"""
2Support code for the C{landscape-message} utility, which sends a text
3message to the Landscape web UI via the landscape-client's dbus
4messaging service (see L{landscape.plugins.dbus_message}).
5"""
6
7import sys
8
9from landscape.lib.log import log_failure
10from landscape.reactor import LandscapeReactor
11from landscape.broker.amp import RemoteBrokerConnector
12from landscape.deployment import Configuration
13
14
15class AcceptedTypeError(Exception):
16 """
17 Raised when a message is sent without 'text-message' being an
18 accepted type.
19 """
20
21
22class EmptyMessageError(Exception):
23 """Raised when an empty message is provied."""
24
25
26def send_message(text, broker):
27 """Add a message to the queue via a remote broker.
28
29 The message is of type C{text-message}.
30
31 @param broker: A connected L{RemoteBroker} object to use to send
32 the message.
33 @return: A L{Deferred} which will fire with the result of the send.
34 """
35 def got_session_id(session_id):
36 response = broker.send_message(message, session_id, True)
37 return response
38
39 message = {"type": "text-message", "message": text}
40 result = broker.get_session_id()
41 result.addCallback(got_session_id)
42 return result
43
44
45def got_result(result):
46 print u"Message sent."
47
48
49def get_message(args):
50 encoding = sys.stdin.encoding or "UTF-8"
51 if len(args) < 2:
52 print ("Please enter your message, and send EOF (Control + D after "
53 "newline) when done.")
54 message = sys.stdin.read().decode(encoding)
55 else:
56 message = u" ".join([x.decode(encoding) for x in args[1:]])
57 if not message:
58 raise EmptyMessageError("Text messages may not be empty.")
59 return message
60
61
62def got_accepted_types(accepted_types, broker, args):
63 if not "text-message" in accepted_types:
64 raise AcceptedTypeError("Text messages may not be created. Is "
65 "Landscape Client registered with the server?")
66 message = get_message(args)
67 d = send_message(message, broker)
68 d.addCallback(got_result)
69 return d
70
71
72def run(args=sys.argv):
73 """Send a message to Landscape.
74
75 This function runs a Twisted reactor, prints various status
76 messages, and exits the process.
77 """
78 reactor = LandscapeReactor()
79 config = Configuration()
80 config.load(args)
81
82 def got_connection(broker):
83 result = broker.get_accepted_message_types()
84 return result.addCallback(got_accepted_types, broker, args)
85
86 def got_error(failure):
87 log_failure(failure)
88
89 connector = RemoteBrokerConnector(reactor, config)
90 result = connector.connect()
91 result.addCallback(got_connection)
92 result.addErrback(got_error)
93 result.addBoth(lambda x: connector.disconnect())
94
95 # For some obscure reason our LandscapeReactor.stop method calls
96 # reactor.crash() instead of reactor.stop(), which doesn't work
97 # here. Maybe LandscapeReactor.stop should simply use reactor.stop().
98 result.addBoth(lambda ignored: reactor.call_later(
99 0, reactor._reactor.stop))
100
101 reactor.run()
102
103 return result
1040
=== modified file 'landscape/watchdog.py'
--- landscape/watchdog.py 2014-07-10 19:16:56 +0000
+++ landscape/watchdog.py 2017-01-18 09:59:00 +0000
@@ -58,8 +58,6 @@
58 @cvar program: The name of the executable program that will start this58 @cvar program: The name of the executable program that will start this
59 daemon.59 daemon.
60 @cvar username: The name of the user to switch to, by default.60 @cvar username: The name of the user to switch to, by default.
61 @cvar service: The DBus service name that the program will be expected to
62 listen on.
63 @cvar max_retries: The maximum number of retries before giving up when61 @cvar max_retries: The maximum number of retries before giving up when
64 trying to connect to the watched daemon.62 trying to connect to the watched daemon.
65 @cvar factor: The factor by which the delay between subsequent connection63 @cvar factor: The factor by which the delay between subsequent connection
@@ -184,7 +182,7 @@
184 def is_running(self):182 def is_running(self):
185 # FIXME Error cases may not be handled in the best possible way183 # FIXME Error cases may not be handled in the best possible way
186 # here. We're basically return False if any error happens from the184 # here. We're basically return False if any error happens from the
187 # dbus ping.185 # AMP ping.
188 return self._connect_and_call("ping")186 return self._connect_and_call("ping")
189187
190 def wait(self):188 def wait(self):
@@ -375,7 +373,7 @@
375 def start(self):373 def start(self):
376 """374 """
377 Start all daemons. The broker will be started first, and no other375 Start all daemons. The broker will be started first, and no other
378 daemons will be started before it is running and responding to DBUS376 daemons will be started before it is running and responding to AMP
379 messages.377 messages.
380378
381 @return: A deferred which fires when all services have successfully379 @return: A deferred which fires when all services have successfully
382380
=== modified file 'man/landscape-client.1'
--- man/landscape-client.1 2014-07-10 19:16:56 +0000
+++ man/landscape-client.1 2017-01-18 09:59:00 +0000
@@ -1,5 +1,5 @@
1.\"Text automatically generated by txt2man1.\" Text automatically generated by txt2man
2.TH landscape-client 1 "10 July 2014" "" ""2.TH landscape-client 1 "05 January 2017" "" ""
3.SH NAME3.SH NAME
4\fBlandscape-client \fP- Landscape system client4\fBlandscape-client \fP- Landscape system client
5\fB5\fB
@@ -33,12 +33,12 @@
33\fB-c\fP FILE, \fB--config\fP=FILE33\fB-c\fP FILE, \fB--config\fP=FILE
34Use config from this file (any command line 34Use config from this file (any command line
35\fIoptions\fP override settings from the file). (default:35\fIoptions\fP override settings from the file). (default:
36'/etc/landscape/client.conf')36\(cq/etc/landscape/client.conf')
37.TP37.TP
38.B38.B
39\fB-d\fP PATH, \fB--data-path\fP=PATH39\fB-d\fP PATH, \fB--data-path\fP=PATH
40The directory to store data files in (default:40The directory to store data files in (default:
41'/var/lib/landscape/client/').41\(cq/var/lib/landscape/client/').
42.TP42.TP
43.B43.B
44\fB-q\fP, \fB--quiet\fP44\fB-q\fP, \fB--quiet\fP
@@ -47,7 +47,7 @@
47.B47.B
48\fB-l\fP FILE, \fB--log-dir\fP=FILE48\fB-l\fP FILE, \fB--log-dir\fP=FILE
49The directory to write log files to (default:49The directory to write log files to (default:
50'/var/log/landscape').50\(cq/var/log/landscape').
51.TP51.TP
52.B52.B
53\fB--log-level\fP=LOG_LEVEL53\fB--log-level\fP=LOG_LEVEL
5454
=== modified file 'man/landscape-config.1'
--- man/landscape-config.1 2014-07-10 19:16:56 +0000
+++ man/landscape-config.1 2017-01-18 09:59:00 +0000
@@ -1,5 +1,5 @@
1.\"Text automatically generated by txt2man1.\" Text automatically generated by txt2man
2.TH landscape-config 1 "10 July 2014" "" ""2.TH landscape-config 1 "05 January 2017" "" ""
3.SH NAME3.SH NAME
4\fBlandscape-config \fP- configure the Landscape management client4\fBlandscape-config \fP- configure the Landscape management client
5\fB5\fB
66
=== removed file 'man/landscape-message.1'
--- man/landscape-message.1 2014-07-10 19:16:56 +0000
+++ man/landscape-message.1 1970-01-01 00:00:00 +0000
@@ -1,51 +0,0 @@
1.\"Text automatically generated by txt2man
2.TH landscape-message 1 "10 July 2014" "" ""
3.SH NAME
4\fBlandscape-message \fP- Send a message to the landscape web interface
5\fB
6.SH SYNOPSIS
7.nf
8.fam C
9\fBlandscape-message\fP [\fIoptions\fP] [\fIMESSAGE\fP] \.\.\.
10
11.fam T
12.fi
13.fam T
14.fi
15.SH DESCRIPTION
16
17Invoking \fBlandscape-message\fP will cause a message to appear in the
18History section for this computer in the Landscape web UI.
19.PP
20If no \fIMESSAGE\fP is specified on the command line, then \fBlandscape-message\fP
21will read the message from STDIN until EOF.
22.RE
23.PP
24
25.SH OPTIONS
26.TP
27.B
28\fB--version\fP
29Show program's version number and exit.
30.TP
31.B
32\fB-h\fP, \fB--help\fP
33Show this help message and exit.
34.TP
35.B
36\fB-b\fP BUS, \fB--bus\fP=BUS
37The DBUS bus to use to send the message.
38.SH EXAMPLES
39
40\fBlandscape-message\fP Hello administrator
41.RE
42.PP
43
44.SH SEE ALSO
45
46landscape-client (1)
47.RE
48.PP
49
50.SH AUTHOR
51Landscape Development Team <landscape-team@canonical.com>
520
=== removed file 'man/landscape-message.txt'
--- man/landscape-message.txt 2012-03-05 14:11:42 +0000
+++ man/landscape-message.txt 1970-01-01 00:00:00 +0000
@@ -1,32 +0,0 @@
1NAME
2 landscape-message - Send a message to the landscape web interface
3
4SYNOPSIS
5 landscape-message [options] [MESSAGE] ...
6
7DESCRIPTION
8
9Invoking landscape-message will cause a message to appear in the
10History section for this computer in the Landscape web UI.
11
12If no MESSAGE is specified on the command line, then landscape-message
13will read the message from STDIN until EOF.
14
15
16OPTIONS
17 --version Show program's version number and exit.
18 -h, --help Show this help message and exit.
19 -b BUS, --bus=BUS The DBUS bus to use to send the message.
20
21EXAMPLES
22
23 landscape-message Hello administrator
24
25
26SEE ALSO
27
28 landscape-client (1)
29
30
31AUTHOR
32 Landscape Development Team <landscape-team@canonical.com>
330
=== modified file 'man/landscape-sysinfo.1'
--- man/landscape-sysinfo.1 2014-07-10 19:16:56 +0000
+++ man/landscape-sysinfo.1 2017-01-18 09:59:00 +0000
@@ -1,5 +1,5 @@
1.\"Text automatically generated by txt2man1.\" Text automatically generated by txt2man
2.TH landscape-sysinfo 1 "10 July 2014" "" ""2.TH landscape-sysinfo 1 "05 January 2017" "" ""
3.SH NAME3.SH NAME
4\fBlandscape-sysinfo \fP- Display a summary of the current system status4\fBlandscape-sysinfo \fP- Display a summary of the current system status
5\fB5\fB
66
=== removed file 'scripts/landscape-dbus-proxy'
--- scripts/landscape-dbus-proxy 2013-06-03 07:23:35 +0000
+++ scripts/landscape-dbus-proxy 1970-01-01 00:00:00 +0000
@@ -1,91 +0,0 @@
1#!/usr/bin/env python
2"""
3This script is needed in case the client is upgrading from a pre-AMP version
4using Dbus as the messaging mechanism (like the landscape-client package from
5the lucid archives).
6This allows the package changer to send package changes to the broker using
7Dbus.
8
9This will only be run for old packages depending on DBus, we don't need to
10depend on DBus in the current version.
11"""
12
13import os
14import dbus
15import dbus.service
16import dbus.glib # This as side effects, don't remove it!
17
18from dbus.service import Object, BusName, method
19
20from twisted.internet import glib2reactor
21glib2reactor.install()
22from twisted.internet import reactor
23
24from landscape.lib.bpickle import loads
25from landscape.lib.lock import lock_path, LockError
26from landscape.reactor import LandscapeReactor
27from landscape.deployment import Configuration
28from landscape.broker.amp import RemoteBrokerConnector
29
30
31BUS_NAME = "com.canonical.landscape.Broker"
32OBJECT_PATH = "/com/canonical/landscape/Broker"
33
34
35def array_to_string(array):
36 """Convert an L{Array} of L{Byte}s (or integers) to a Python str."""
37 result = []
38 for item in array:
39 if item < 0:
40 item = item + 256
41 result.append(chr(item))
42 return "".join(result)
43
44
45class BrokerDBusObject(Object):
46 """A DBus-published object proxying L{RemoteBroker.send_message}.
47
48 It is used when upgrading from a DBus-based version of the Landscape client
49 to the newer AMP-based one, for letting the old package-changer process
50 performing the upgrade communicate with the new version of the client.
51 """
52 bus_name = BUS_NAME
53 object_path = OBJECT_PATH
54
55 def __init__(self, config):
56 super(BrokerDBusObject, self).__init__(BusName(
57 self.bus_name, dbus.SystemBus()), object_path=self.object_path)
58 self.config = config
59
60 @method(BUS_NAME)
61 def send_message(self, message, urgent=True):
62 """Queue the given message in the message exchange."""
63 message = loads(array_to_string(message))
64
65 def cb_connected(broker):
66 result = broker.send_message(message, urgent=True)
67 return result.addCallback(cb_done)
68
69 def cb_done(ignored):
70 return reactor.stop()
71
72 landscape_reactor = LandscapeReactor()
73 connector = RemoteBrokerConnector(landscape_reactor, self.config)
74 connected = connector.connect()
75 connected.addCallback(cb_connected)
76
77
78if __name__ == "__main__":
79 config = Configuration()
80 lock_dir = os.path.join(config.data_path, "package")
81 if os.path.isdir(lock_dir):
82 lock_filename = os.path.join(lock_dir, "changer.lock")
83 try:
84 lock_path(lock_filename)
85 except LockError:
86 # The package-changer is running, this means that we're upgrading from
87 # a non-AMP version and that the upgrade is Landscape driven, so let's
88 # expose the DBus broker proxy to give a chance to the package-changer
89 # to send its result message.
90 remote = BrokerDBusObject(config)
91 reactor.run()
920
=== removed file 'scripts/landscape-message'
--- scripts/landscape-message 2008-09-08 17:49:13 +0000
+++ scripts/landscape-message 1970-01-01 00:00:00 +0000
@@ -1,8 +0,0 @@
1#!/usr/bin/python
2import sys, os
3if os.path.dirname(os.path.abspath(sys.argv[0])) == os.path.abspath("scripts"):
4 sys.path.insert(0, "./")
5
6from landscape.textmessage import run
7
8run()
90
=== modified file 'setup.py'
--- setup.py 2016-01-07 10:45:00 +0000
+++ setup.py 2017-01-18 09:59:00 +0000
@@ -22,18 +22,14 @@
22 "landscape.upgraders",22 "landscape.upgraders",
23 "landscape.user",23 "landscape.user",
24 "landscape.lib"],24 "landscape.lib"],
25 data_files=[
26 ("/etc/dbus-1/system.d/", ["dbus-1/landscape.conf"])],
27 scripts=["scripts/landscape-client",25 scripts=["scripts/landscape-client",
28 "scripts/landscape-config",26 "scripts/landscape-config",
29 "scripts/landscape-message",
30 "scripts/landscape-broker",27 "scripts/landscape-broker",
31 "scripts/landscape-manager",28 "scripts/landscape-manager",
32 "scripts/landscape-monitor",29 "scripts/landscape-monitor",
33 "scripts/landscape-package-changer",30 "scripts/landscape-package-changer",
34 "scripts/landscape-package-reporter",31 "scripts/landscape-package-reporter",
35 "scripts/landscape-release-upgrader",32 "scripts/landscape-release-upgrader",
36 "scripts/landscape-sysinfo",33 "scripts/landscape-sysinfo"],
37 "scripts/landscape-dbus-proxy"],
38 cmdclass={"build": build_extra.build_extra,34 cmdclass={"build": build_extra.build_extra,
39 "clean": clean_build_tree})35 "clean": clean_build_tree})

Subscribers

People subscribed via source and target branches

to all changes: