/
usr
/
lib
/
python3
/
dist-packages
/
cloudinit
/
/usr/lib/python3/dist-packages/cloudinit
mkdir
upload
Name
Size
Mode
Actions
analyze/
-
0755
rm
cmd/
-
0755
rm
config/
-
0755
rm
distros/
-
0755
rm
filters/
-
0755
rm
handlers/
-
0755
rm
log/
-
0755
rm
mergers/
-
0755
rm
net/
-
0755
rm
reporting/
-
0755
rm
sources/
-
0755
rm
__pycache__/
-
0755
rm
apport.py
8496
0644
edit
dl
rm
atomic_helper.py
2860
0644
edit
dl
rm
cloud.py
3296
0644
edit
dl
rm
dmi.py
8002
0644
edit
dl
rm
event.py
2051
0644
edit
dl
rm
features.py
5763
0644
edit
dl
rm
gpg.py
8186
0644
edit
dl
rm
helpers.py
16547
0644
edit
dl
rm
importer.py
2485
0644
edit
dl
rm
lifecycle.py
7979
0644
edit
dl
rm
netinfo.py
24646
0644
edit
dl
rm
performance.py
3175
0644
edit
dl
rm
persistence.py
2583
0644
edit
dl
rm
registry.py
1022
0644
edit
dl
rm
safeyaml.py
10349
0644
edit
dl
rm
settings.py
2172
0644
edit
dl
rm
signal_handler.py
3027
0644
edit
dl
rm
simpletable.py
1976
0644
edit
dl
rm
socket.py
5991
0644
edit
dl
rm
ssh_util.py
22983
0644
edit
dl
rm
stages.py
42526
0644
edit
dl
rm
subp.py
12658
0644
edit
dl
rm
templater.py
7930
0644
edit
dl
rm
temp_utils.py
3013
0644
edit
dl
rm
type_utils.py
703
0644
edit
dl
rm
url_helper.py
39164
0644
edit
dl
rm
user_data.py
14784
0644
edit
dl
rm
util.py
92907
0644
edit
dl
rm
version.py
564
0644
edit
dl
rm
warnings.py
3853
0644
edit
dl
rm
__init__.py
0
0644
edit
dl
rm
Edit:
/usr/lib/python3/dist-packages/cloudinit/event.py
(2051B)
# This file is part of cloud-init. See LICENSE file for license information. """Classes and functions related to event handling.""" import logging from enum import Enum from typing import Dict, Set 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
Save
cmd:
run