Merge lp://qastaging/~thedac/charms/precise/block-storage-broker/configure-repository into lp://qastaging/charms/block-storage-broker

Proposed by David Ames
Status: Merged
Merged at revision: 53
Proposed branch: lp://qastaging/~thedac/charms/precise/block-storage-broker/configure-repository
Merge into: lp://qastaging/charms/block-storage-broker
Diff against target: 54 lines (+19/-3)
2 files modified
hooks/hooks.py (+3/-2)
hooks/util.py (+16/-1)
To merge this branch: bzr merge lp://qastaging/~thedac/charms/precise/block-storage-broker/configure-repository
Reviewer Review Type Date Requested Status
Stuart Bishop (community) Approve
Review via email: mp+226721@code.qastaging.launchpad.net

Description of the change

Currently the addition of the cloud-archive:havana apt

This error out when using trusty: 'cloud-archive only supported on precise'

Allow configuration of apt repository. Default to cloud-archive:havana but allow "" when using trusty.

To post a comment you must log in.
Revision history for this message
Tom Haddon (mthaddon) wrote :

I'm not massively happy about the default being cloud-archive:havana. This seems like it's going to be a gotcha for anyone using trusty, which before too long will be everyone (I assume). If we know precise requires cloud-archive:havana but trusty doesn't, couldn't we check /etc/lsb-release and act accordingly?

54. By David Ames

Fixes for trusty. Determine series. Handle bareword in volume-show.

Revision history for this message
David Ames (thedac) wrote :

Per Tom's request I have checked for the running series and set the extra repo only when not running trusty.

Also fixed the malformed string error

volume-show had the bare word null as seen below causing the error.
[{"device": "/dev/vdc", "server_id": "6b2d686b-972e-46b8-ba32-db03b6e14ddd", "volume_id":
"a1d3c1e5-3807-4c12-a339-20125c376335", "host_name": null, "id": "a1d3c1e5-3807-4c12-a339-20125c376335"}]

Traceback (most recent call last):
  File "hooks/block-storage-relation-changed", line 144, in <module>
    hooks.execute(sys.argv)
  File
"/var/lib/juju/agents/unit-block-storage-broker-0/charm/hooks/charmhelpers/core/hookenv.py",
line 381, in execute
    self._hooks[hook_name]()
  File "hooks/block-storage-relation-changed", line 128, in
block_storage_relation_changed
    volume_label=volume_label)
  File
"/var/lib/juju/agents/unit-block-storage-broker-0/charm/hooks/util.py",
line 159, in attach_volume
    volume_id = self.get_volume_id(volume_label)
  File
"/var/lib/juju/agents/unit-block-storage-broker-0/charm/hooks/util.py",
line 93, in get_volume_id
    volumes = self.describe_volumes()
  File
"/var/lib/juju/agents/unit-block-storage-broker-0/charm/hooks/util.py",
line 83, in describe_volumes
    return method(volume_id)
  File
"/var/lib/juju/agents/unit-block-storage-broker-0/charm/hooks/util.py",
line 427, in _nova_describe_volumes
    result[volume].update(self._nova_volume_show(volume))
  File
"/var/lib/juju/agents/unit-block-storage-broker-0/charm/hooks/util.py",
line 386, in _nova_volume_show
    attachments = literal_eval(value)
  File "/usr/lib/python2.7/ast.py", line 80, in literal_eval
    return _convert(node_or_string)
  File "/usr/lib/python2.7/ast.py", line 60, in _convert
    return list(map(_convert, node.elts))
  File "/usr/lib/python2.7/ast.py", line 63, in _convert
    in zip(node.keys, node.values))
  File "/usr/lib/python2.7/ast.py", line 62, in <genexpr>
    return dict((_convert(k), _convert(v)) for k, v
  File "/usr/lib/python2.7/ast.py", line 79, in _convert
    raise ValueError('malformed string')
ValueError: malformed string

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

I've also got conditionals on the series, so the helper should one day end up in charm-helpers (core/host.py probably). I'm also doing something similar in the PG charm, requiring icehouse with precise, and have the same approach. I would like to know the difference between cloud:havana and cloud-archive:havana, and when one should be chosen over the other.

This branch is good to land. I'd like a comment on the 'null' replacement, as this is unobvious, but as the entire helper is uncommented it wouldn't help much.

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

Oh, and looking back at the original proposal, if there is a next time you can use the standard install_sources() stuff from charmhelpers.fetch rather than your own arbitrary config item.

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

Jumped the gun sorry. I've identified things that need fixing.

You should be testing for 'if get_running_series() == "precise"', rather than '!= "trusty"', or this charm will break with Utopic and later.

I don't think we should be adding the repo unless hookenv.config('provider') == 'nova'.

test_install_adds_apt_source_and_installs_novaclient() now fails under trusty. This test can be duplicated, with util.get_running_series() mocked, so we test both precise and non-precise behavior.

review: Needs Fixing
55. By David Ames

More intelligence in selecting series

Revision history for this message
David Ames (thedac) wrote :

Fixed the code to be more intelligent about series.

For the life of me I cannot figure out how to mock the get_running_series() function.

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

lp:~stub/charms/precise/block-storage-broker/configure-repository has tests. I didn't bother to update the test to use the modern standard 'mock' library rather than the dead mocker library. Good to land with the tests.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches

to all changes: