Merge lp:~lool/ubuntu-location-provider-here/dbus-activation-fix into lp:ubuntu-location-provider-here

Proposed by Loïc Minier
Status: Merged
Approved by: Manuel de la Peña
Approved revision: 19
Merged at revision: 18
Proposed branch: lp:~lool/ubuntu-location-provider-here/dbus-activation-fix
Merge into: lp:ubuntu-location-provider-here
Diff against target: 63 lines (+23/-10)
2 files modified
usr/bin/herepositioning-license-accepted (+11/-7)
usr/share/ubuntu-location-provider-here/functions (+12/-3)
To merge this branch: bzr merge lp:~lool/ubuntu-location-provider-here/dbus-activation-fix
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Manuel de la Peña (community) Approve
Review via email: mp+239252@code.launchpad.net

Commit message

Use org.freedesktop.Accounts.FindUserByName(); this makes sure the user object is properly created when we list properties on it; LP: #1384321.

Description of the change

Use org.freedesktop.Accounts.FindUserByName(); this makes sure the user object is properly created when we list properties on it; LP: #1384321.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Manuel de la Peña (mandel) :
review: Needs Fixing
19. By Loïc Minier

s/pathes/paths/

Revision history for this message
Manuel de la Peña (mandel) :
review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'usr/bin/herepositioning-license-accepted'
2--- usr/bin/herepositioning-license-accepted 2014-09-17 14:18:33 +0000
3+++ usr/bin/herepositioning-license-accepted 2014-10-22 19:29:30 +0000
4@@ -33,15 +33,19 @@
5 USERNAME="$1"
6 USERNAME="${USERNAME:-phablet}"
7
8-if ! uid="$(id -u $USERNAME)"; then
9- die "User $USERNAME not found" >&2
10+# NB: this triggers DBus activation in case Account Service wasn't running
11+if ! user="$(ofa_dbus /org/freedesktop/Accounts \
12+ org.freedesktop.Accounts.FindUserByName \
13+ "string:$USERNAME")"; then
14+ die "Couldn't find user $USERNAME in AccountService"
15 fi
16
17-if ! data="$(dbus_do org.freedesktop.Accounts \
18- /org/freedesktop/Accounts/User$uid \
19- org.freedesktop.DBus.Properties.GetAll \
20- string:com.ubuntu.location.providers.here.AccountsService)"; then
21- die "Couldn't read AccountService properties for uid $uid"
22+userpath="$(echo "$user" | dbus_object_paths)"
23+
24+if ! data="$(ofa_dbus "$userpath" \
25+ org.freedesktop.DBus.Properties.GetAll \
26+ string:com.ubuntu.location.providers.here.AccountsService)"; then
27+ die "Couldn't read HERE AccountService properties for user path $userpath"
28 fi
29
30 if [ "$(get_dbus_prop "$data" "boolean" "LicenseAccepted")" = "true" ]; then
31
32=== modified file 'usr/share/ubuntu-location-provider-here/functions'
33--- usr/share/ubuntu-location-provider-here/functions 2014-09-17 14:18:33 +0000
34+++ usr/share/ubuntu-location-provider-here/functions 2014-10-22 19:29:30 +0000
35@@ -18,7 +18,16 @@
36 dbus_do "org.ofono" "$@"
37 }
38
39-# DBus object pathes of oFono modems, one per line; bails out if oFono isn't
40+ofa_dbus() {
41+ dbus_do "org.freedesktop.Accounts" "$@"
42+}
43+
44+# stdin: DBus reply, stdout: DBus object paths, one per line
45+dbus_object_paths() {
46+ sed -n 's/^ *object path "\(.*\)"$/\1/p'
47+}
48+
49+# DBus object paths of oFono modems, one per line; bails out if oFono isn't
50 # available
51 get_modems() {
52 local modems
53@@ -26,8 +35,8 @@
54 if ! modems="$(ofono_dbus / org.ofono.Manager.GetModems)"; then
55 return 1
56 fi
57- # convert to /ril_0 etc. object pathes
58- echo "$modems" | sed -n 's/^ *object path "\(.*\)"$/\1/p'
59+ # convert to /ril_0 etc. object paths
60+ echo "$modems" | dbus_object_paths
61 }
62
63 # extracts value of a property from a DBus reply; variant is the type

Subscribers

People subscribed via source and target branches