Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable/antelope] Add name parameter to send_application_name #841

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions charmhelpers/contrib/storage/linux/ceph.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,15 +159,19 @@ def get_osd_settings(relation_name):
return _order_dict_by_key(osd_settings)


def send_application_name(relid=None):
def send_application_name(relid=None, app_name=None):
"""Send the application name down the relation.
:param relid: Relation id to set application name in.
:type relid: str
:param app_name: Application name to send in the relation.
:type app_name: str
"""
if app_name is None:
app_name = application_name()
relation_set(
relation_id=relid,
relation_settings={'application-name': application_name()})
relation_settings={'application-name': app_name})


def send_osd_settings():
Expand Down
5 changes: 5 additions & 0 deletions tests/contrib/storage/test_linux_ceph.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,11 @@ def test_send_application_name(self, application_name):
self.relation_set.assert_called_once_with(
relation_settings={'application-name': 'client'},
relation_id='rid:1')
self.relation_set.reset_mock()
ceph_utils.send_application_name(relid='rid:1', app_name='foo')
self.relation_set.assert_called_once_with(
relation_settings={'application-name': 'foo'},
relation_id='rid:1')

@patch.object(ceph_utils, 'get_osd_settings')
def test_send_osd_settings(self, _get_osd_settings):
Expand Down
Loading