/
snap
/
core18
/
2979
/
usr
/
lib
/
python3
/
dist-packages
/
cloudinit
/
/snap/core18/2979/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
mergers/
-
0755
rm
net/
-
0755
rm
reporting/
-
0755
rm
sources/
-
0755
rm
__pycache__/
-
0755
rm
apport.py
5881
0644
edit
dl
rm
atomic_helper.py
1417
0644
edit
dl
rm
cloud.py
3574
0644
edit
dl
rm
dhclient_hook.py
2549
0644
edit
dl
rm
dmi.py
6979
0644
edit
dl
rm
event.py
2097
0644
edit
dl
rm
features.py
3146
0644
edit
dl
rm
gpg.py
4424
0644
edit
dl
rm
helpers.py
16828
0644
edit
dl
rm
importer.py
1789
0644
edit
dl
rm
log.py
4432
0644
edit
dl
rm
netinfo.py
23115
0644
edit
dl
rm
patcher.py
1130
0644
edit
dl
rm
persistence.py
2605
0644
edit
dl
rm
registry.py
1045
0644
edit
dl
rm
safeyaml.py
7905
0644
edit
dl
rm
settings.py
2041
0644
edit
dl
rm
signal_handler.py
1826
0644
edit
dl
rm
simpletable.py
1976
0644
edit
dl
rm
ssh_util.py
21211
0644
edit
dl
rm
stages.py
35311
0644
edit
dl
rm
subp.py
13558
0644
edit
dl
rm
templater.py
5965
0644
edit
dl
rm
temp_utils.py
3268
0644
edit
dl
rm
type_utils.py
726
0644
edit
dl
rm
url_helper.py
28628
0644
edit
dl
rm
user_data.py
14841
0644
edit
dl
rm
util.py
92622
0644
edit
dl
rm
version.py
596
0644
edit
dl
rm
warnings.py
3932
0644
edit
dl
rm
__init__.py
0
0644
edit
dl
rm
Edit:
/snap/core18/2979/usr/lib/python3/dist-packages/cloudinit/cloud.py
(3574B)
# Copyright (C) 2012 Canonical Ltd. # Copyright (C) 2012 Hewlett-Packard Development Company, L.P. # Copyright (C) 2012 Yahoo! Inc. # # This file is part of cloud-init. See LICENSE file for license information. import copy import os from typing import Optional from cloudinit import log as logging from cloudinit.distros import Distro from cloudinit.helpers import Paths, Runners from cloudinit.reporting import events from cloudinit.sources import DataSource LOG = logging.getLogger(__name__) # This class is the high level wrapper that provides # access to cloud-init objects without exposing the stage objects # to handler and or module manipulation. It allows for cloud # init to restrict what those types of user facing code may see # and or adjust (which helps avoid code messing with each other) # # It also provides util functions that avoid having to know # how to get a certain member from this submembers as well # as providing a backwards compatible object that can be maintained # while the stages/other objects can be worked on independently... class Cloud: def __init__( self, datasource: DataSource, paths: Paths, cfg: dict, distro: Distro, runners: Runners, reporter: Optional[events.ReportEventStack] = None, ): self.datasource = datasource self.paths = paths self.distro = distro self._cfg = cfg self._runners = runners if reporter is None: reporter = events.ReportEventStack( name="unnamed-cloud-reporter", description="unnamed-cloud-reporter", reporting_enabled=False, ) self.reporter = reporter # If a 'user' manipulates logging or logging services # it is typically useful to cause the logging to be # setup again. def cycle_logging(self): logging.resetLogging() logging.setupLogging(self.cfg) @property def cfg(self): # Ensure that cfg is not indirectly modified return copy.deepcopy(self._cfg) def run(self, name, functor, args, freq=None, clear_on_fail=False): return self._runners.run(name, functor, args, freq, clear_on_fail) def get_template_filename(self, name): fn = self.paths.template_tpl % (name) if not os.path.isfile(fn): LOG.warning( "No template found in %s for template named %s", os.path.dirname(fn), name, ) return None return fn # The rest of these are just useful proxies def get_userdata(self, apply_filter=True): return self.datasource.get_userdata(apply_filter) def get_instance_id(self): return self.datasource.get_instance_id() @property def launch_index(self): return self.datasource.launch_index def get_public_ssh_keys(self): return self.datasource.get_public_ssh_keys() def get_locale(self): return self.datasource.get_locale() def get_hostname(self, fqdn=False, metadata_only=False): return self.datasource.get_hostname( fqdn=fqdn, metadata_only=metadata_only ) def device_name_to_device(self, name): return self.datasource.device_name_to_device(name) def get_ipath_cur(self, name=None): return self.paths.get_ipath_cur(name) def get_cpath(self, name=None): return self.paths.get_cpath(name) def get_ipath(self, name=None): return self.paths.get_ipath(name) # vi: ts=4 expandtab
Save
cmd:
run