__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
# Copyright (C) 2022 Microsoft Corporation.
#
# This file is part of cloud-init. See LICENSE file for license information.
import logging
from datetime import datetime, timezone
from typing import Optional
from cloudinit import version
from cloudinit.reporting import handlers, instantiated_handler_registry
from cloudinit.sources.azure import errors
LOG = logging.getLogger(__name__)
def get_kvp_handler() -> Optional[handlers.HyperVKvpReportingHandler]:
"""Get instantiated KVP telemetry handler."""
kvp_handler = instantiated_handler_registry.registered_items.get(
"telemetry"
)
if not isinstance(kvp_handler, handlers.HyperVKvpReportingHandler):
return None
return kvp_handler
def report_via_kvp(report: str) -> bool:
"""Report to host via PROVISIONING_REPORT KVP key."""
kvp_handler = get_kvp_handler()
if kvp_handler is None:
LOG.debug("KVP handler not enabled, skipping host report.")
return False
kvp_handler.write_key("PROVISIONING_REPORT", report)
return True
def report_success_to_host(*, vm_id: Optional[str]) -> bool:
report = errors.encode_report(
[
"result=success",
f"agent=Cloud-Init/{version.version_string()}",
f"timestamp={datetime.now(timezone.utc).isoformat()}",
f"vm_id={vm_id}",
]
)
return report_via_kvp(report)
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| __pycache__ | Folder | 0755 |
|
|
| __init__.py | File | 0 B | 0644 |
|
| errors.py | File | 7.07 KB | 0644 |
|
| identity.py | File | 2.91 KB | 0644 |
|
| imds.py | File | 7.29 KB | 0644 |
|
| kvp.py | File | 1.36 KB | 0644 |
|