OXIESEC PANEL
- Current Dir:
/
/
usr
/
lib
/
python3
/
dist-packages
/
cloudinit
Server IP: 10.0.0.4
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
11/20/2022 06:47:16 AM
rwxr-xr-x
📄
__init__.py
0 bytes
05/18/2022 04:04:36 PM
rw-r--r--
📁
__pycache__
-
07/01/2022 06:30:51 AM
rwxr-xr-x
📁
analyze
-
07/01/2022 06:30:50 AM
rwxr-xr-x
📄
apport.py
4.24 KB
05/18/2022 04:04:36 PM
rw-r--r--
📄
atomic_helper.py
1.38 KB
05/18/2022 04:04:36 PM
rw-r--r--
📄
cloud.py
3.5 KB
05/18/2022 04:04:36 PM
rw-r--r--
📁
cmd
-
07/01/2022 06:30:50 AM
rwxr-xr-x
📁
config
-
07/01/2022 06:30:50 AM
rwxr-xr-x
📄
dhclient_hook.py
2.49 KB
05/18/2022 04:04:36 PM
rw-r--r--
📁
distros
-
07/01/2022 06:30:50 AM
rwxr-xr-x
📄
dmi.py
5.65 KB
05/18/2022 04:04:36 PM
rw-r--r--
📄
event.py
2.05 KB
05/18/2022 04:04:36 PM
rw-r--r--
📄
features.py
2.03 KB
05/18/2022 04:04:36 PM
rw-r--r--
📁
filters
-
07/01/2022 06:30:50 AM
rwxr-xr-x
📄
gpg.py
4.32 KB
05/18/2022 04:04:36 PM
rw-r--r--
📁
handlers
-
07/01/2022 06:30:50 AM
rwxr-xr-x
📄
helpers.py
15.74 KB
05/18/2022 04:04:36 PM
rw-r--r--
📄
importer.py
1.44 KB
05/18/2022 04:04:36 PM
rw-r--r--
📄
log.py
4.33 KB
05/18/2022 04:04:36 PM
rw-r--r--
📁
mergers
-
07/01/2022 06:30:50 AM
rwxr-xr-x
📁
net
-
07/01/2022 06:30:50 AM
rwxr-xr-x
📄
netinfo.py
22.57 KB
05/18/2022 04:04:36 PM
rw-r--r--
📄
patcher.py
1.1 KB
05/18/2022 04:04:36 PM
rw-r--r--
📄
persistence.py
2.54 KB
05/18/2022 04:04:36 PM
rw-r--r--
📄
registry.py
1.03 KB
05/18/2022 04:04:36 PM
rw-r--r--
📁
reporting
-
07/01/2022 06:30:50 AM
rwxr-xr-x
📄
safeyaml.py
5.85 KB
05/18/2022 04:04:36 PM
rw-r--r--
📄
serial.py
1.23 KB
05/18/2022 04:04:36 PM
rw-r--r--
📄
settings.py
1.94 KB
05/18/2022 04:04:36 PM
rw-r--r--
📄
signal_handler.py
1.78 KB
05/18/2022 04:04:36 PM
rw-r--r--
📄
simpletable.py
1.94 KB
05/18/2022 04:04:36 PM
rw-r--r--
📁
sources
-
07/01/2022 06:30:50 AM
rwxr-xr-x
📄
ssh_util.py
19.63 KB
05/18/2022 04:04:36 PM
rw-r--r--
📄
stages.py
35.06 KB
05/18/2022 04:04:36 PM
rw-r--r--
📄
subp.py
13.24 KB
05/18/2022 04:04:36 PM
rw-r--r--
📄
temp_utils.py
2.88 KB
05/18/2022 04:04:36 PM
rw-r--r--
📄
templater.py
5.58 KB
05/18/2022 04:04:36 PM
rw-r--r--
📄
type_utils.py
726 bytes
05/18/2022 04:04:36 PM
rw-r--r--
📄
url_helper.py
27.08 KB
05/18/2022 04:04:36 PM
rw-r--r--
📄
user_data.py
14.5 KB
05/18/2022 04:04:36 PM
rw-r--r--
📄
util.py
84.85 KB
05/18/2022 04:04:36 PM
rw-r--r--
📄
version.py
587 bytes
06/15/2022 04:38:21 PM
rw-r--r--
📄
warnings.py
3.84 KB
05/18/2022 04:04:36 PM
rw-r--r--
Editing: event.py
Close
# This file is part of cloud-init. See LICENSE file for license information. """Classes and functions related to event handling.""" from enum import Enum from typing import Dict, Set from cloudinit import log as logging LOG = logging.getLogger(__name__) class EventScope(Enum): # NETWORK is currently the only scope, but we want to leave room to # grow other scopes (e.g., STORAGE) without having to make breaking # changes to the user config NETWORK = "network" def __str__(self): # pylint: disable=invalid-str-returned return self.value class EventType(Enum): """Event types which can generate maintenance requests for cloud-init.""" # Cloud-init should grow support for the follow event types: # HOTPLUG # METADATA_CHANGE # USER_REQUEST BOOT = "boot" BOOT_NEW_INSTANCE = "boot-new-instance" BOOT_LEGACY = "boot-legacy" HOTPLUG = "hotplug" def __str__(self): # pylint: disable=invalid-str-returned return self.value def userdata_to_events(user_config: dict) -> Dict[EventScope, Set[EventType]]: """Convert userdata into update config format defined on datasource. Userdata is in the form of (e.g): {'network': {'when': ['boot']}} DataSource config is in the form of: {EventScope.Network: {EventType.BOOT}} Take the first and return the second """ update_config = {} for scope, scope_list in user_config.items(): try: new_scope = EventScope(scope) except ValueError as e: LOG.warning( "%s! Update data will be ignored for '%s' scope", str(e), scope, ) continue try: new_values = [EventType(x) for x in scope_list["when"]] except ValueError as e: LOG.warning( "%s! Update data will be ignored for '%s' scope", str(e), scope, ) new_values = [] update_config[new_scope] = set(new_values) return update_config # vi: ts=4 expandtab