relation-get failing with 'permission denied'

Bug #1239681 reported by Stuart Bishop on 2013-10-14
20
This bug affects 2 people
Affects Status Importance Assigned to Milestone
juju-core
Critical
William Reade
postgresql (Juju Charms Collection)
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

Stuart Bishop (stub) wrote :

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

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

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) on 2013-10-22
tags: added: regression
Changed in juju-core:
status: New → Triaged
importance: Undecided → High
Stuart Bishop (stub) on 2013-11-13
affects: postgresql-psql (Juju Charms Collection) → postgresql (Juju Charms Collection)
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
Stuart Bishop (stub) wrote :

No, just hitting me less frequently now.

Changed in postgresql (Juju Charms Collection):
status: Incomplete → Triaged
Curtis Hovey (sinzui) on 2014-02-12
Changed in juju-core:
milestone: none → 1.18.0
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) on 2014-02-27
Changed in juju-core:
milestone: 1.18.0 → 1.17.4
Curtis Hovey (sinzui) on 2014-02-28
Changed in juju-core:
status: Fix Committed → Fix Released
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) on 2014-03-06
Changed in juju-core:
status: Confirmed → Triaged
tags: added: landscape
Curtis Hovey (sinzui) on 2014-03-10
Changed in juju-core:
milestone: none → 1.18.0
Mark Ramm (mark-ramm) on 2014-03-13
Changed in juju-core:
importance: High → Critical
John A Meinel (jameinel) on 2014-03-17
Changed in juju-core:
milestone: 1.18.0 → 1.17.6
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
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) on 2014-03-20
Changed in juju-core:
status: Fix Committed → Fix Released
Stuart Bishop (stub) on 2014-04-01
Changed in postgresql (Juju Charms Collection):
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers