Skip to content

Commit

Permalink
vmaccess updates (#1097)
Browse files Browse the repository at this point in the history
* Added util ffiles to replace waagent.MyDistro

* renamed files and added constants

* updated vmaccess.py

* added ovfutils.py and refactored more code

* made logging selective for testing

* updated error handling for subprocess

* updated error message

* set shell-False explicitly for subprocess.Popen

* updated IOError to OSError

OSError catches more exceptions than IOError

* updated logger.py

* updated logger for tests

* saving work

* Saving work

* updated test method

* Updated method for reset_ssh

* combined catch for different exceptions in one statement

* Updated VMAcces version

* Updated parameters for Iptable update

* Fixed ovf-env.xml import logic

* fixed return code

* Added a new handler util file that doesn't import waagent

* fixed error reporting for cmd

* made logger context global

* fixed missing logs

* fixed typo and bug with invoking openssl

* updated comment

* Revert "updated comment"

This reverts commit d46b1c6.

* updated comment and fixed logic

* changed behavior when no public key is sent, updated log message

Updated the behavior when vmaccess extension tries to add public key
from ovf-env.xml file

Updated log message.

* Addressed comment regarding /etc/waagent.conf

* Fixed typo in distro_utils variable name

* Fixed conversion of public key to ssh-rsa key

* removed opensslutils

* Added fault tolerence to public key generation from ovf-env.xml

* Updated makefile

* Removed the behavior of adding public keys from ovf-env.xml to $Home/.ssh/authorized_keys when no ssh_key is specified

* Fixed makefile to work with EDP pipeline. Fixed spelling in comment
  • Loading branch information
D1v38om83r authored May 15, 2020
1 parent f03f975 commit 5e076e4
Show file tree
Hide file tree
Showing 13 changed files with 2,008 additions and 135 deletions.
18 changes: 15 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ EXTENSIONS = \
CustomScript \
DSC \
OSPatching \
VMAccess \
VMBackup

clean:
Expand All @@ -13,7 +12,8 @@ clean:
init:
@mkdir -p build

build: init $(EXTENSIONS)
build: init $(EXTENSIONS) buildVMAccess


define make-extension-zip
$(eval NAME = $(shell grep -Pom1 "(?<=<Type>)[^<]+" $@/manifest.xml))
Expand All @@ -24,9 +24,21 @@ $(eval VERSION = $(shell grep -Pom1 "(?<=<Version>)[^<]+" $@/manifest.xml))
@find ./Utils -type f | grep -v "/test/" | zip -9 -@ build/$(NAME)-$(VERSION).zip > /dev/null
endef


$(EXTENSIONS):
$(make-extension-zip)
@cd Common/ && echo ./waagentloader.py | zip -9 -@ ../build/$(NAME)-$(VERSION).zip > /dev/null
@cd Common/WALinuxAgent-2.0.16 && echo ./waagent | zip -9 -@ ../../build/$(NAME)-$(VERSION).zip > /dev/null

.PHONY: clean build $(EXTENSIONS)


buildVMAccess:
$(eval NAME = $(shell grep -Pom1 "(?<=<Type>)[^<]+" VMAccess/manifest.xml))
$(eval VERSION = $(shell grep -Pom1 "(?<=<Version>)[^<]+" VMAccess/manifest.xml))
@echo "Building '$(NAME)-$(VERSION).zip' ..."
@cd VMAccess && find . -type f | grep -v "/test/" | grep -v "./references" | zip -9 -@ ../build/$(NAME)-$(VERSION).zip > /dev/null
@zip -9 build/$(NAME)-$(VERSION).zip ./Utils/__init__.py ./Utils/constants.py ./Utils/distroutils.py\
./Utils/extensionutils.py ./Utils/handlerutil2.py ./Utils/logger.py ./Utils/ovfutils.py > /dev/null


.PHONY: clean build $(EXTENSIONS) buildVMAccess
16 changes: 16 additions & 0 deletions Utils/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
LibDir = "/var/lib/waagent"

Openssl = "openssl"
os_release = "/etc/os-release"


class WALAEventOperation:
HeartBeat = "HeartBeat"
Provision = "Provision"
Install = "Install"
UnInstall = "UnInstall"
Disable = "Disable"
Enable = "Enable"
Download = "Download"
Upgrade = "Upgrade"
Update = "Update"
Loading

0 comments on commit 5e076e4

Please sign in to comment.