22c103169b
Juju 2.0 provides support for display of the version of an application deployed by a charm in juju status. Insert the os_application_version_set function into the existing assess_status function - this gets called after all hook executions, and periodically after that, so any changes in package versions due to normal system updates will also be reflected in the status output. This review also includes a resync of charm-helpers to pickup hookenv and contrib.openstack support for this feature. Change-Id: I5734e87d39e62c1fb791b0b79ff216e30a784d1f
20 lines
636 B
Python
20 lines
636 B
Python
import platform
|
|
|
|
|
|
def get_platform():
|
|
"""Return the current OS platform.
|
|
|
|
For example: if current os platform is Ubuntu then a string "ubuntu"
|
|
will be returned (which is the name of the module).
|
|
This string is used to decide which platform module should be imported.
|
|
"""
|
|
tuple_platform = platform.linux_distribution()
|
|
current_platform = tuple_platform[0]
|
|
if "Ubuntu" in current_platform:
|
|
return "ubuntu"
|
|
elif "CentOS" in current_platform:
|
|
return "centos"
|
|
else:
|
|
raise RuntimeError("This module is not supported on {}."
|
|
.format(current_platform))
|