Submit
Path:
~
/
/
proc
/
self
/
root
/
usr
/
share
/
doc
/
cloud-init
/
examples
/
File Content:
part-handler.txt
#part-handler """This is a trivial example part-handler that creates a file with the path specified in the payload. It performs no input checking or error handling. To use it, first save the file you are currently viewing into your current working directory. Then run the following: ``` $ echo '/var/tmp/my_path' > part $ cloud-init devel make-mime -a part-handler.py:part-handler -a part:x-my-path --force > user-data ``` This will create a mime file with the contents of 'part' and the part-handler. You can now pass 'user-data' to your cloud of choice. When run, cloud-init will have created an empty file at /var/tmp/my_path. """ import pathlib from typing import Any from cloudinit.cloud import Cloud def list_types(): """Return a list of mime-types that are handled by this module.""" return ["text/x-my-path"] def handle_part(data: Cloud, ctype: str, filename: str, payload: Any): """Handle a part with the given mime-type. This function will get called multiple times. The first time is to allow any initial setup needed to handle parts. It will then get called once for each part matching the mime-type returned by `list_types`. Finally, it will get called one last time to allow for any final teardown. :data: A `Cloud` instance. This will be the same instance for each call to handle_part. :ctype: '__begin__', '__end__', or the mime-type (for this example 'text/x-my-path') of the part :filename: The filename for the part as defined in the MIME archive, or dynamically generated part if no filename is given :payload: The content of the part. This will be `None` when `ctype` is '__begin__' or '__end__'. """ if ctype == "__begin__": # Any custom setup needed before handling payloads return if ctype == "__end__": # Any custom teardown needed after handling payloads can happen here return # If we've made it here, we're dealing with a real payload, so handle # it appropriately pathlib.Path(payload.strip()).touch()
Edit
Rename
Chmod
Delete
FILE
FOLDER
INFO
Name
Size
Permission
Action
seed
---
0755
boothook.txt
80 bytes
0644
cloud-config-add-apt-repos.txt
1573 bytes
0644
cloud-config-ansible-controller.txt
7361 bytes
0644
cloud-config-ansible-managed.txt
3821 bytes
0644
cloud-config-ansible-pull.txt
334 bytes
0644
cloud-config-apt.txt
12994 bytes
0644
cloud-config-archive-launch-index.txt
802 bytes
0644
cloud-config-archive.txt
239 bytes
0644
cloud-config-boot-cmds.txt
406 bytes
0644
cloud-config-ca-certs.txt
1184 bytes
0644
cloud-config-chef-oneiric.txt
3455 bytes
0644
cloud-config-chef.txt
4203 bytes
0644
cloud-config-datasources.txt
2225 bytes
0644
cloud-config-disk-setup.txt
8912 bytes
0644
cloud-config-gluster.txt
456 bytes
0644
cloud-config-install-packages.txt
383 bytes
0644
cloud-config-launch-index.txt
570 bytes
0644
cloud-config-lxd.txt
1814 bytes
0644
cloud-config-mount-points.txt
1504 bytes
0644
cloud-config-ntp.txt
835 bytes
0644
cloud-config-reporting.txt
335 bytes
0644
cloud-config-run-cmds.txt
963 bytes
0644
cloud-config-ssh-keys.txt
2289 bytes
0644
cloud-config-update-apt.txt
229 bytes
0644
cloud-config-update-packages.txt
93 bytes
0644
cloud-config-user-groups.txt
6901 bytes
0644
cloud-config-wireguard.txt
1183 bytes
0644
cloud-config-write-files.txt
1078 bytes
0644
cloud-config-yum-repo.txt
897 bytes
0644
cloud-config.txt
16536 bytes
0644
include-once.txt
353 bytes
0644
include.txt
434 bytes
0644
kernel-command-line.txt
1029 bytes
0644
network-config-v1-bonded-pair.yaml
428 bytes
0644
network-config-v1-bonded-vlan.yaml
508 bytes
0644
network-config-v1-bridge.yaml
638 bytes
0644
network-config-v1-multiple-vlan.yaml
1208 bytes
0644
network-config-v1-nameserver.yaml
403 bytes
0644
network-config-v1-physical-3-nic.yaml
443 bytes
0644
network-config-v1-physical-dhcp.yaml
100 bytes
0644
network-config-v1-route.yaml
321 bytes
0644
network-config-v1-subnet-dhcp.yaml
151 bytes
0644
network-config-v1-subnet-multiple.yaml
364 bytes
0644
network-config-v1-subnet-routes.yaml
483 bytes
0644
network-config-v1-subnet-static.yaml
348 bytes
0644
network-config-v1-vlan.yaml
253 bytes
0644
part-handler-v2.txt
1562 bytes
0644
part-handler.txt
2081 bytes
0644
plain-ignored.txt
68 bytes
0644
user-script.txt
125 bytes
0644
N4ST4R_ID | Naxtarrr