relation-get failing with 'permission denied'

Bug #1239681 reported by Stuart Bishop
20
This bug affects 2 people
Affects Status Importance Assigned to Milestone
juju-core
Fix Released
Critical
William Reade
postgresql (Juju Charms Collection)
Fix Released
Undecided
Unassigned

Bug Description

The PostgreSQL test suite is no longer passing with Juju 1.16 and the local provider, with relation-get failing with 'permission denied' exceptions under some circumstances. It was working fine with Juju 1.14

./test.py -vv PostgreSQLCharmTestCase.test_failover_election seems to trigger it every time. I haven't yet isolated the trigger.

error: permission denied
Traceback (most recent call last):
  File "/var/lib/juju/agents/unit-psql-0/charm/hooks/db-relation-changed", line 153, in <module>
    hooks.execute(sys.argv)
  File "/var/lib/juju/agents/unit-psql-0/charm/hooks/charmhelpers/core/hookenv.py", line 322, in execute
    self._hooks[hook_name]()
  File "/var/lib/juju/agents/unit-psql-0/charm/hooks/db-relation-changed", line 149, in rebuild_hook
    return rebuild_all_relations()
  File "/var/lib/juju/agents/unit-psql-0/charm/hooks/db-relation-changed", line 58, in rebuild_all_relations
    for _, relid, unit, relation in all_relations(relation_types=['db']):
  File "/var/lib/juju/agents/unit-psql-0/charm/hooks/db-relation-changed", line 43, in all_relations
    unit=unit, rid=relid)
  File "/var/lib/juju/agents/unit-psql-0/charm/hooks/charmhelpers/core/hookenv.py", line 42, in wrapper
    res = func(*args, **kwargs)
  File "/var/lib/juju/agents/unit-psql-0/charm/hooks/charmhelpers/core/hookenv.py", line 174, in relation_get
    return json.loads(subprocess.check_output(_args))
  File "/usr/lib/python2.7/subprocess.py", line 544, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['relation-get', '--format=json', '-r', u'db:23', '-', u'postgresql/0']' returned non-zero exit status 1
failed: exit status 1

Related branches

Revision history for this message
Stuart Bishop (stub) wrote :

I won't be able to look at this further for the next two weeks.

Revision history for this message
Dave Cheney (dave-cheney) wrote : Re: [Bug 1239681] Re: relation-get failing with 'permission denied'

is your relation really called u'db ?

On Tue, Oct 15, 2013 at 12:05 AM, Stuart Bishop
<email address hidden> wrote:
> I won't be able to look at this further for the next two weeks.
>
> --
> You received this bug notification because you are subscribed to juju-
> core.
> Matching subscriptions: MOAR JUJU SPAM!
> https://bugs.launchpad.net/bugs/1239681
>
> Title:
> relation-get failing with 'permission denied'
>
> Status in juju-core:
> New
> Status in “postgresql-psql” package in Juju Charms Collection:
> New
>
> Bug description:
> The PostgreSQL test suite is no longer passing with Juju 1.16 and the
> local provider, with relation-get failing with 'permission denied'
> exceptions under some circumstances. It was working fine with Juju
> 1.14
>
> ./test.py -vv PostgreSQLCharmTestCase.test_failover_election seems to
> trigger it every time. I haven't yet isolated the trigger.
>
> error: permission denied
> Traceback (most recent call last):
> File "/var/lib/juju/agents/unit-psql-0/charm/hooks/db-relation-changed", line 153, in <module>
> hooks.execute(sys.argv)
> File "/var/lib/juju/agents/unit-psql-0/charm/hooks/charmhelpers/core/hookenv.py", line 322, in execute
> self._hooks[hook_name]()
> File "/var/lib/juju/agents/unit-psql-0/charm/hooks/db-relation-changed", line 149, in rebuild_hook
> return rebuild_all_relations()
> File "/var/lib/juju/agents/unit-psql-0/charm/hooks/db-relation-changed", line 58, in rebuild_all_relations
> for _, relid, unit, relation in all_relations(relation_types=['db']):
> File "/var/lib/juju/agents/unit-psql-0/charm/hooks/db-relation-changed", line 43, in all_relations
> unit=unit, rid=relid)
> File "/var/lib/juju/agents/unit-psql-0/charm/hooks/charmhelpers/core/hookenv.py", line 42, in wrapper
> res = func(*args, **kwargs)
> File "/var/lib/juju/agents/unit-psql-0/charm/hooks/charmhelpers/core/hookenv.py", line 174, in relation_get
> return json.loads(subprocess.check_output(_args))
> File "/usr/lib/python2.7/subprocess.py", line 544, in check_output
> raise CalledProcessError(retcode, cmd, output=output)
> subprocess.CalledProcessError: Command '['relation-get', '--format=json', '-r', u'db:23', '-', u'postgresql/0']' returned non-zero exit status 1
> failed: exit status 1
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/juju-core/+bug/1239681/+subscriptions

Revision history for this message
Kapil Thangavelu (hazmat) wrote :

dave that's just python repr formatting of a unicode string, on the cli its just
relation-get --format=json -r db:23 - postgresql/0

Curtis Hovey (sinzui)
tags: added: regression
Changed in juju-core:
status: New → Triaged
importance: Undecided → High
Stuart Bishop (stub)
affects: postgresql-psql (Juju Charms Collection) → postgresql (Juju Charms Collection)
Revision history for this message
Stuart Bishop (stub) wrote :

Updates to the PG charm or juju mean I can no longer reproduce this.

Changed in postgresql (Juju Charms Collection):
status: New → Incomplete
Revision history for this message
Stuart Bishop (stub) wrote :

No, just hitting me less frequently now.

Changed in postgresql (Juju Charms Collection):
status: Incomplete → Triaged
Curtis Hovey (sinzui)
Changed in juju-core:
milestone: none → 1.18.0
Revision history for this message
Kapil Thangavelu (hazmat) wrote :

Confirmed this was fixed in revno 2330 which was released with 1.17.3

Changed in juju-core:
status: Triaged → Fix Committed
assignee: nobody → William Reade (fwereade)
Curtis Hovey (sinzui)
Changed in juju-core:
milestone: 1.18.0 → 1.17.4
Curtis Hovey (sinzui)
Changed in juju-core:
status: Fix Committed → Fix Released
Revision history for this message
Kapil Thangavelu (hazmat) wrote :

i got a report of this happening with 1.17.4 (unit log below, verified status output that unit is indeed running 1.17.4)

http://paste.ubuntu.com/7041709/

Changed in juju-core:
status: Fix Released → Confirmed
milestone: 1.17.4 → none
Curtis Hovey (sinzui)
Changed in juju-core:
status: Confirmed → Triaged
tags: added: landscape
Curtis Hovey (sinzui)
Changed in juju-core:
milestone: none → 1.18.0
Mark Ramm (mark-ramm)
Changed in juju-core:
importance: High → Critical
John A Meinel (jameinel)
Changed in juju-core:
milestone: 1.18.0 → 1.17.6
Revision history for this message
William Reade (fwereade) wrote :

http://paste.ubuntu.com/7041709/ appears to show a perfectly proper rejection of an attempt to read arbitrary settings. If (around line 57 of the paste) there was a call to "relation-list -r cfgm:11" to get the remote units actually in that relation, followed by a "relation-get -r cfgm:11 ..." that named one of those units, then the "permission denied" would be unexpected. As it is, though, not a bug.

I'll mark it "incomplete" to leave a window for clarification, but in the absence of same I'll be setting it back to "fix released" for 1.17.4 later today.

Changed in juju-core:
status: Triaged → Incomplete
Revision history for this message
Kapil Thangavelu (hazmat) wrote :

so confirmed that the dup bug from ls team was actually resolved in 1.17, and that the issue that caused this bug to be reopened was actually a charm bug. sorry for the noise, marking this resolved/committed.. its technically already a fix released.

Changed in juju-core:
status: Incomplete → Fix Committed
Curtis Hovey (sinzui)
Changed in juju-core:
status: Fix Committed → Fix Released
Stuart Bishop (stub)
Changed in postgresql (Juju Charms Collection):
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.