Update folder structure, and resolve comments

This commit is contained in:
lizzha
2015-08-19 14:48:06 +08:00
parent a1bb4c07a7
commit 0ce339b6df
12 changed files with 22 additions and 30 deletions
+2 -12
View File
@@ -17,29 +17,19 @@
# Requires Python 2.4+ and Openssl 1.0+
#
from azurelinuxagent.metadata import DISTRO_NAME, DISTRO_VERSION
from azurelinuxagent.metadata import DISTRO_NAME, DISTRO_VERSION, DISTRO_FULL_NAME
def get_osutil():
from azurelinuxagent.distro.ubuntu.osutil import Ubuntu1204OSUtil, \
UbuntuOSUtil, \
Ubuntu14xOSUtil, \
UbuntuSnappyOSUtil
import os
import azurelinuxagent.utils.fileutil as fileutil
# TODO: https://bugs.launchpad.net/snappy/+bug/1481086
def is_snappy():
if os.path.exists("/etc/motd"):
motd = fileutil.read_file("/etc/motd")
if "snappy" in motd:
return True
return False
if DISTRO_VERSION == "12.04":
return Ubuntu1204OSUtil()
elif DISTRO_VERSION == "14.04" or DISTRO_VERSION == "14.10":
return Ubuntu14xOSUtil()
elif is_snappy():
elif DISTRO_FULL_NAME == "Snappy Ubuntu Core":
return UbuntuSnappyOSUtil()
else:
return UbuntuOSUtil()
+6 -17
View File
@@ -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():
@@ -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"
-1
View File
@@ -1 +0,0 @@
Place the azurelinuxagent folder here
View File
View File
+1
View File
@@ -0,0 +1 @@
Copy the azurelinuxagent folder here
+13
View File
@@ -0,0 +1,13 @@
### Building the walinuxagent snap package
1. You will need the snappy developer tools on your Ubuntu Developer Desktop:
$ sudo add-apt-repository ppa:snappy-dev/tools
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install snappy-tools
2. Copy the azurelinuxagent folder to snappy/lib
$ cp -rf ../azurelinuxagent snappy/lib
3. Build the snap package under the snappy folder
$ snappy build