Merge lp:~nataliabidart/ubuntuone-client/fix-sso-signal-handling into lp:ubuntuone-client

Proposed by Natalia Bidart
Status: Merged
Approved by: Natalia Bidart
Approved revision: 653
Merged at revision: 653
Proposed branch: lp:~nataliabidart/ubuntuone-client/fix-sso-signal-handling
Merge into: lp:ubuntuone-client
Diff against target: 163 lines (+85/-11)
3 files modified
contrib/testing/testcase.py (+2/-1)
tests/syncdaemon/test_dbus.py (+64/-3)
ubuntuone/syncdaemon/dbus_interface.py (+19/-7)
To merge this branch: bzr merge lp:~nataliabidart/ubuntuone-client/fix-sso-signal-handling
Reviewer Review Type Date Requested Status
Facundo Batista (community) Approve
Rodrigo Moya (community) Approve
John Lenton (community) Approve
Review via email: mp+33636@code.launchpad.net

Commit message

  Signals from SSO dbus service are correctly processed now (using the latest
  API). Also, if the app_name that the signal is sending doesn't match U1
  app_name, the signal is ignored (LP: #623447).

Description of the change

  Signals from SSO dbus service are correctly processed now (using the latest
  API). Also, if the app_name that the signal is sending doesn't match U1
  app_name, the signal is ignored.

To post a comment you must log in.
Revision history for this message
John Lenton (chipaca) wrote :

This works like a charm.

review: Approve
Revision history for this message
Rodrigo Moya (rodrigo-moya) wrote :

Fixed the problems I was having with syncdaemon not connecting

review: Approve
Revision history for this message
Facundo Batista (facundo) wrote :

Like it!

review: Approve
Revision history for this message
dobey (dobey) wrote :
Download full text (15.5 KiB)

The attempt to merge lp:~nataliabidart/ubuntuone-client/fix-sso-signal-handling into lp:ubuntuone-client failed.Below is the output from the failed tests.

/usr/bin/gnome-autogen.sh
checking for autoconf >= 2.53...
  testing autoconf2.50... not found.
  testing autoconf... found 2.67
checking for automake >= 1.10...
  testing automake-1.11... found 1.11.1
checking for libtool >= 1.5...
  testing libtoolize... found 2.2.6b
checking for intltool >= 0.30...
  testing intltoolize... found 0.41.1
checking for pkg-config >= 0.14.0...
  testing pkg-config... found 0.25
Checking for required M4 macros...
Checking for forbidden M4 macros...
Processing ./configure.ac
Running libtoolize...
libtoolize: putting auxiliary files in `.'.
libtoolize: copying file `./ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
libtoolize: copying file `m4/libtool.m4'
libtoolize: copying file `m4/ltoptions.m4'
libtoolize: copying file `m4/ltsugar.m4'
libtoolize: copying file `m4/ltversion.m4'
libtoolize: copying file `m4/lt~obsolete.m4'
Running intltoolize...
Running aclocal-1.11...
Running autoconf...
Running autoheader...
Running automake-1.11...
Running ./configure --with-protocol=/var/cache/tarmac/ubuntuone-storage-protocol/trunk ...
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking for library containing strerror... none required
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking dependency style of gcc... (cached) gcc3
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for ar... a...

Revision history for this message
dobey (dobey) wrote :
Download full text (15.2 KiB)

The attempt to merge lp:~nataliabidart/ubuntuone-client/fix-sso-signal-handling into lp:ubuntuone-client failed.Below is the output from the failed tests.

/usr/bin/gnome-autogen.sh
checking for autoconf >= 2.53...
  testing autoconf2.50... not found.
  testing autoconf... found 2.67
checking for automake >= 1.10...
  testing automake-1.11... found 1.11.1
checking for libtool >= 1.5...
  testing libtoolize... found 2.2.6b
checking for intltool >= 0.30...
  testing intltoolize... found 0.41.1
checking for pkg-config >= 0.14.0...
  testing pkg-config... found 0.25
Checking for required M4 macros...
Checking for forbidden M4 macros...
Processing ./configure.ac
Running libtoolize...
libtoolize: putting auxiliary files in `.'.
libtoolize: copying file `./ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
libtoolize: copying file `m4/libtool.m4'
libtoolize: copying file `m4/ltoptions.m4'
libtoolize: copying file `m4/ltsugar.m4'
libtoolize: copying file `m4/ltversion.m4'
libtoolize: copying file `m4/lt~obsolete.m4'
Running intltoolize...
Running aclocal-1.11...
Running autoconf...
Running autoheader...
Running automake-1.11...
Running ./configure --with-protocol=/var/cache/tarmac/ubuntuone-storage-protocol/trunk ...
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking for library containing strerror... none required
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking dependency style of gcc... (cached) gcc3
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for ar... a...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'contrib/testing/testcase.py'
--- contrib/testing/testcase.py 2010-08-16 22:14:19 +0000
+++ contrib/testing/testcase.py 2010-08-25 17:46:40 +0000
@@ -53,7 +53,8 @@
53FAKED_CREDENTIALS = {'consumer_key': 'faked_consumer_key',53FAKED_CREDENTIALS = {'consumer_key': 'faked_consumer_key',
54 'consumer_secret': 'faked_consumer_secret',54 'consumer_secret': 'faked_consumer_secret',
55 'token': 'faked_token',55 'token': 'faked_token',
56 'token_secret': 'faked_token_secret'}56 'token_secret': 'faked_token_secret',
57 'token_name': 'Test me please'}
5758
5859
59@contextlib.contextmanager60@contextlib.contextmanager
6061
=== modified file 'tests/syncdaemon/test_dbus.py'
--- tests/syncdaemon/test_dbus.py 2010-08-18 17:56:57 +0000
+++ tests/syncdaemon/test_dbus.py 2010-08-25 17:46:40 +0000
@@ -30,6 +30,7 @@
30from contrib.testing.testcase import (30from contrib.testing.testcase import (
31 BaseTwistedTestCase, DBusTwistedTestCase, FakeMain, FAKED_CREDENTIALS,31 BaseTwistedTestCase, DBusTwistedTestCase, FakeMain, FAKED_CREDENTIALS,
32 MementoHandler)32 MementoHandler)
33from ubuntuone.clientdefs import APP_NAME
33from ubuntuone.storageprotocol.sharersp import NotifyShareHolder34from ubuntuone.storageprotocol.sharersp import NotifyShareHolder
34from ubuntuone.syncdaemon import event_queue, states, config35from ubuntuone.syncdaemon import event_queue, states, config
35from ubuntuone.syncdaemon.dbus_interface import (36from ubuntuone.syncdaemon.dbus_interface import (
@@ -2218,7 +2219,7 @@
22182219
2219 def f(*a, **kw):2220 def f(*a, **kw):
2220 """Receive credentials."""2221 """Receive credentials."""
2221 self.dbus_iface._signal_handler(FAKED_CREDENTIALS,2222 self.dbus_iface._signal_handler(APP_NAME, FAKED_CREDENTIALS,
2222 member='CredentialsFound')2223 member='CredentialsFound')
22232224
2224 self.patch(FakedSSOBackend, 'login_or_register_to_get_credentials', f)2225 self.patch(FakedSSOBackend, 'login_or_register_to_get_credentials', f)
@@ -2232,7 +2233,9 @@
22322233
2233 def f(*a, **kw):2234 def f(*a, **kw):
2234 """Receive error signal."""2235 """Receive error signal."""
2235 self.dbus_iface._signal_handler(member='CredentialsError')2236 self.dbus_iface._signal_handler(APP_NAME, 'Error description',
2237 'Detailed error',
2238 member='CredentialsError')
22362239
2237 self.patch(FakedSSOBackend, 'login_or_register_to_get_credentials', f)2240 self.patch(FakedSSOBackend, 'login_or_register_to_get_credentials', f)
2238 d = self.dbus_iface.connect()2241 d = self.dbus_iface.connect()
@@ -2246,7 +2249,8 @@
22462249
2247 def f(*a, **kw):2250 def f(*a, **kw):
2248 """Receive error signal."""2251 """Receive error signal."""
2249 self.dbus_iface._signal_handler(member='AuthorizationDenied')2252 self.dbus_iface._signal_handler(APP_NAME,
2253 member='AuthorizationDenied')
22502254
2251 self.patch(FakedSSOBackend, 'login_or_register_to_get_credentials', f)2255 self.patch(FakedSSOBackend, 'login_or_register_to_get_credentials', f)
2252 d = self.dbus_iface.connect()2256 d = self.dbus_iface.connect()
@@ -2303,6 +2307,63 @@
2303 self.assertEqual(self.events, [('SYS_USER_CONNECT', (),2307 self.assertEqual(self.events, [('SYS_USER_CONNECT', (),
2304 {'access_token': expected})])2308 {'access_token': expected})])
23052309
2310 def test_only_log_if_app_name_is_not_correct_when_credentials_found(self):
2311 """If the app_name is not ours, just log an INFO message."""
2312
2313 def f(*a, **kw):
2314 """Receive wrong app_name."""
2315 self.dbus_iface._signal_handler(APP_NAME * 2,
2316 member='CredentialsFound')
2317
2318 self.patch(FakedSSOBackend, 'login_or_register_to_get_credentials', f)
2319 self.dbus_iface._request_token()
2320
2321 self.assertFalse(self.dbus_iface._deferred.called)
2322 self.assertTrue(self.memento.check_info('CredentialsFound',
2323 APP_NAME * 2))
2324
2325 def test_only_log_if_app_name_is_not_correct_when_credentials_error(self):
2326 """If the app_name is not ours, just log an INFO message."""
2327
2328 def f(*a, **kw):
2329 """Receive a wrong app_name."""
2330 self.dbus_iface._signal_handler(APP_NAME * 2,
2331 member='CredentialsError')
2332
2333 self.patch(FakedSSOBackend, 'login_or_register_to_get_credentials', f)
2334 self.dbus_iface._request_token()
2335
2336 self.assertFalse(self.dbus_iface._deferred.called)
2337 self.assertTrue(self.memento.check_info('CredentialsError',
2338 APP_NAME * 2))
2339
2340 def test_only_log_if_app_name_is_not_correct_when_authorization_denied(self):
2341 """If the app_name is not ours, just log an INFO message."""
2342
2343 def f(*a, **kw):
2344 """Receive a wrong app_name."""
2345 self.dbus_iface._signal_handler(APP_NAME * 2,
2346 member='AuthorizationDenied')
2347
2348 self.patch(FakedSSOBackend, 'login_or_register_to_get_credentials', f)
2349 self.dbus_iface._request_token()
2350
2351 self.assertFalse(self.dbus_iface._deferred.called)
2352 self.assertTrue(self.memento.check_info('AuthorizationDenied',
2353 APP_NAME * 2))
2354
2355 def test_signal_handler_remains_generic(self):
2356 """The signal handler function should be generic."""
2357 self.dbus_iface._signal_handler()
2358 # no failure
2359 self.assertTrue(self.memento.check_debug('member: None',
2360 'app_name: None'))
2361
2362 self.dbus_iface._signal_handler(no_member_kwarg='Test')
2363 # no failure
2364 self.assertTrue(self.memento.check_debug('member: None',
2365 'app_name: None'))
2366
23062367
2307class FolderTests(DBusTwistedTestCase):2368class FolderTests(DBusTwistedTestCase):
2308 """Tests for the Folder object exposed via dbus."""2369 """Tests for the Folder object exposed via dbus."""
23092370
=== modified file 'ubuntuone/syncdaemon/dbus_interface.py'
--- ubuntuone/syncdaemon/dbus_interface.py 2010-08-20 21:09:00 +0000
+++ ubuntuone/syncdaemon/dbus_interface.py 2010-08-25 17:46:40 +0000
@@ -1871,20 +1871,32 @@
18711871
1872 def _signal_handler(self, *args, **kwargs):1872 def _signal_handler(self, *args, **kwargs):
1873 """Generic signal handler."""1873 """Generic signal handler."""
1874 member = kwargs.get('member', None)
1875 app_name = args[0] if len(args) > 0 else None
1874 d = self._deferred1876 d = self._deferred
1875 member = kwargs.get('member', None)1877 logger.debug('Handling DBus signal for member: %r, app_name: %r.',
1876 logger.debug('Handling DBus signals for member %r, with args %r ' \1878 member, app_name)
1877 'and kwargs %r.', member, args, kwargs)1879
1880 if app_name != APP_NAME:
1881 logger.info('Received %s but app_name %s does not match %s, ' \
1882 'exiting.', member, app_name, APP_NAME)
1883 return
1884
1878 if member in ('CredentialsError', 'AuthorizationDenied'):1885 if member in ('CredentialsError', 'AuthorizationDenied'):
1886 logger.warning('%r: %r %r', member, args, kwargs)
1879 if not args:1887 if not args:
1880 d.errback(Failure(NoAccessToken(member)))1888 d.errback(Failure(NoAccessToken(member)))
1881 else:1889 else:
1882 d.errback(Failure(NoAccessToken("%s: %s" %1890 d.errback(Failure(NoAccessToken("%s: %s %s" %
1883 (member, args[0]))))1891 (member, args, kwargs))))
1884 elif member == 'CredentialsFound' and not d.called:1892 elif member == 'CredentialsFound' and not d.called:
1885 d.callback(args[0])1893 credentials = args[1]
1894 logger.info('%r: callbacking with credentials (token_name: %r).',
1895 member, None) # fill token_name later, see bug #623604
1896 d.callback(credentials)
1886 else:1897 else:
1887 logger.debug('_signal_handler: member %r not used.', member)1898 logger.debug('_signal_handler: member %r not used or deferred '
1899 'already called? %r.', member, d.called)
18881900
1889 def _request_token(self):1901 def _request_token(self):
1890 """Request to SSO auth service to fetch the token."""1902 """Request to SSO auth service to fetch the token."""

Subscribers

People subscribed via source and target branches