Skip to content
Draft
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
2 changes: 1 addition & 1 deletion .github/workflows/e2e-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
- name: Output KVP telemetry
if: always()
run: |
docker exec azureinit-provisioning-agent cat /var/lib/hyperv/.kvp_pool_1
docker exec azure-testing-server cat /tmp/testinit.kvp_pool_1

- name: Output Azure-init log
if: always()
Expand Down
1 change: 1 addition & 0 deletions testinit/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ services:
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw
- /run/dbus/system_bus_socket:/run/dbus/system_bus_socket:rw
- /var/lib/hyperv:/var/lib/hyperv:rw
stdin_open: true
tty: true
container_name: azureinit-provisioning-agent
Expand Down
6 changes: 4 additions & 2 deletions testinit/testing-server/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ services:
- SYS_MODULE
ports:
- "80:80"
volumes:
- /var/lib/hyperv:/var/lib/hyperv:rw
networks:
imds-network:
ipv4_address: 169.254.169.254
wireserver-network:
ipv4_address: 168.63.129.16
healthcheck:
test: ["CMD", "curl", "-f", "-H", "Metadata: true", "http://localhost:80/metadata/instance?api-version=2021-02-01"]
test: [ "CMD", "curl", "-f", "-H", "Metadata: true", "http://localhost:80/metadata/instance?api-version=2021-02-01" ]
interval: 30s
timeout: 10s
retries: 3
Expand All @@ -30,7 +32,7 @@ networks:
config:
- subnet: 169.254.0.0/16
gateway: 169.254.0.1

wireserver-network:
driver: bridge
name: wireserver-network
Expand Down
20 changes: 20 additions & 0 deletions testinit/testing-server/wireserver_handler.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from http.server import BaseHTTPRequestHandler
import time
import json
import os
import xml.etree.ElementTree as ET

from utils import logger
Expand Down Expand Up @@ -54,6 +55,23 @@ def load_responses(cls):
logger.info("Outputting loaded custom WireServer responses")
logger.info(json.dumps(cls._responses, indent=2))

def store_kvp_file(self):
kvp_file_path = "/var/lib/hyperv/.kvp_pool_1"
output_file_path = "/tmp/testinit.kvp_pool_1"

if os.path.exists(kvp_file_path):
with open(kvp_file_path, "r") as f:
kvp_data = f.read()

# Write to output file, overwriting if it exists since this gets
# called multiple times with a failure.
with open(output_file_path, "w") as f:
f.write(kvp_data)

logger.info(f"KVP data written to {output_file_path}")
else:
logger.info("KVP file not found")

def write_custom_response(self):
responses_list = self._responses

Expand Down Expand Up @@ -106,6 +124,8 @@ def do_POST(self):
logger.info(f"WireServer POST request: {self.path}")
logger.info(f"POST data: {post_data.decode('utf-8', errors='ignore')}")

self.store_kvp_file()

if self._responses is not None:
self.write_custom_response()
return
Expand Down