From 83432149e212155469b1e9f06eb0095121377356 Mon Sep 17 00:00:00 2001 From: Ben Howard Date: Mon, 7 Dec 2015 16:48:51 -0700 Subject: Import patches-unapplied version 2.1.2-0ubuntu1 to ubuntu/xenial-proposed Imported using git-ubuntu import. Changelog parent: 04946cba49f19c0b6b876bccdbb36d47334af002 New changelog entries: * New upstream release (LP: #1523715): - Bug fixes for Ubuntu 15.10 on Azure - Enablement for Azure Stack - Dropped patch for systemd job as upstream now includes it. --- azurelinuxagent/metadata.py | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) (limited to 'azurelinuxagent/metadata.py') diff --git a/azurelinuxagent/metadata.py b/azurelinuxagent/metadata.py index 83d4676..5cf4902 100644 --- a/azurelinuxagent/metadata.py +++ b/azurelinuxagent/metadata.py @@ -1,4 +1,4 @@ -# Windows Azure Linux Agent +# Microsoft Azure Linux Agent # # Copyright 2014 Microsoft Corporation # @@ -21,6 +21,7 @@ import os import re import platform import sys +import azurelinuxagent.utils.fileutil as fileutil from azurelinuxagent.future import text def get_distro(): @@ -46,7 +47,7 @@ def get_distro(): AGENT_NAME = "WALinuxAgent" AGENT_LONG_NAME = "Azure Linux Agent" -AGENT_VERSION = '2.1.1' +AGENT_VERSION = '2.1.2' AGENT_LONG_VERSION = "{0}-{1}".format(AGENT_NAME, AGENT_VERSION) AGENT_DESCRIPTION = """\ The Azure Linux Agent supports the provisioning and running of Linux @@ -70,24 +71,12 @@ PY_VERSION_MICRO = sys.version_info[2] Add this walk arround for detecting Snappy Ubuntu Core temporarily, until ubuntu fixed this bug: https://bugs.launchpad.net/snappy/+bug/1481086 """ -def which(program): - # Return path of program for execution if found in path - def is_exe(fpath): - return os.path.isfile(fpath) and os.access(fpath, os.X_OK) - _fpath, _ = os.path.split(program) - if _fpath: - if is_exe(program): - return program - else: - for path in os.environ.get("PATH", "").split(os.pathsep): - path = path.strip('"') - exe_file = os.path.join(path, program) - if is_exe(exe_file): - return exe_file - return None - def is_snappy(): - return which("snappy") + if os.path.exists("/etc/motd"): + motd = fileutil.read_file("/etc/motd") + if "snappy" in motd: + return True + return False if is_snappy(): DISTRO_FULL_NAME = "Snappy Ubuntu Core" -- cgit v1.2.3