Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example PR #48

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Example PR #48

wants to merge 1 commit into from

Conversation

kislyuk
Copy link
Owner

@kislyuk kislyuk commented Feb 12, 2024

This PR adds a Python file. For PRs that change files, katalin only comments on newly added (or changed) lines.

from .crypto import get_public_key_from_pair


def add_file_to_cloudinit_manifest(src_path, path, manifest):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested documentation improvement

It looks like this class, method, or function has no docstring.

Suggested change
def add_file_to_cloudinit_manifest(src_path, path, manifest):
def add_file_to_cloudinit_manifest(src_path, path, manifest):
"""
Add a file to a cloud-init manifest.
:param src_path: The path to the source file to be added.
:type src_path: str
:param path: The path of the file within the cloud-init manifest.
:type path: str
:param manifest: The dictionary
representing the cloud-init manifest.
:type manifest: Dict
:return: None. The file is added to the cloud-init
manifest dictionary.
:rtype: None
"""

You can edit or replace the proposed docstring before committing it by clicking the "..." menu.

except UnicodeDecodeError:
manifest[path].update(content=base64.b64encode(gzip_compress_bytes(content)), encoding="gz+b64")

def get_rootfs_skel_dirs(args):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested documentation improvement

It looks like this class, method, or function has no docstring.

Suggested change
def get_rootfs_skel_dirs(args):
def get_rootfs_skel_dirs(args):
"""
Get a list of rootfs_skel directories based on input arguments, expanding the 'auto' argument to include default
aegea skel and rootfs.skel.<command> directories related to configuration files.
:param args: A namespace
containing rootfs_skel_dirs attribute representing a list of rootfs_skel directories.
:type args: argparse.Namespace
:return: A list of rootfs_skel directories to build from.
:rtype: list[str]
"""

You can edit or replace the proposed docstring before committing it by clicking the "..." menu.

logger.debug('No rootfs skel files.')
return list(rootfs_skel_dirs)

def get_bootstrap_files(rootfs_skel_dirs, dest="cloudinit"):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested documentation improvement

It looks like this class, method, or function has no docstring.

Suggested change
def get_bootstrap_files(rootfs_skel_dirs, dest="cloudinit"):
def get_bootstrap_files(rootfs_skel_dirs, dest="cloudinit"):
"""
Retrieve files from rootfs_skel directories and create a manifest or tarfile for cloud initialization.
Parameters:
- rootfs_skel_dirs (List[str]): List of rootfs_skel directories to retrieve files from.
- dest (str): Destination
format, either "cloudinit" for manifest or "tarfile" for tarfile creation.
Returns:
- List[Dict] if destination is
"cloudinit", representing the manifest.
- bytes if destination is "tarfile", containing the tarfile data.
"""

You can edit or replace the proposed docstring before committing it by clicking the "..." menu.

--==BOUNDARY==--
"""

def encode_cloud_config_payload(cloud_config_data, mime_multipart_archive=False, gzip=True):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested documentation improvement

It looks like this class, method, or function has no docstring.

Suggested change
def encode_cloud_config_payload(cloud_config_data, mime_multipart_archive=False, gzip=True):
def encode_cloud_config_payload(cloud_config_data, mime_multipart_archive=False, gzip=True):
"""
Encode Cloud Config Payload function encodes the cloud configuration data into a text/cloud-config format or
compresses and encodes it into a gzip format, based on the specified parameters. It returns the encoded payload
ready to be used in user data.
Parameters:
- cloud_config_data (Dict): Dictionary containing cloud configuration
data.
- mime_multipart_archive (bool): Flag indicating whether to encode the payload as a multipart archive.
- gzip
(bool): Flag indicating whether to compress the payload using gzip.
Returns:
- bytes: Encoded cloud configuration
payload.
"""

You can edit or replace the proposed docstring before committing it by clicking the "..." menu.

slug = "#cloud-config\n" + cloud_config_json
return gzip_compress_bytes(slug.encode()) if gzip else slug

def upload_bootstrap_asset(cloud_config_data, rootfs_skel_dirs):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested documentation improvement

It looks like this class, method, or function has no docstring.

Suggested change
def upload_bootstrap_asset(cloud_config_data, rootfs_skel_dirs):
def upload_bootstrap_asset(cloud_config_data, rootfs_skel_dirs):
"""
Uploads a bootstrap asset to an S3 bucket, encrypts the asset using AES-256-CBC encryption, generates a presigned
URL for the asset, and adds a command to download and decrypt the asset in the user data cloud config.
Parameters:
- cloud_config_data (OrderedDict): The cloud config data dictionary.
- rootfs_skel_dirs (List): List of rootfs skel
directories.
Output:
- None.
"""

You can edit or replace the proposed docstring before committing it by clicking the "..." menu.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant