mine_init package

Module contents

A container friendly startup routine for Packmaker servers.

Maintained by Routh.IO
packinit.main()[source]
Script entrypoint

mine_init.core module

Main Classes for packinit
class packinit.core.Configuration(*defaults, **kwargs)[source]

Bases: object

The main configuration class for unifying configuration sources in a predictable way.
clear_none_values(dictionary)[source]

Strips None values from incoming dictionaries before merge. :param dictionary: :return:

motd_generate()[source]
Check for the MOTD property and return, else auto-generate and return.
:return: string Message of the day.
class packinit.core.MineInit[source]

Bases: object

The main class for the packinit executable.
static arg_dict(args)[source]
Arg dict generator.
Returns:
build_parser()[source]
Build the main argparser for the application and return as an object.
:return: object argparser
setup_logging()[source]
Setup logging
:return: logging.Logger instance
start()[source]
Starts and updates a Minecraft instance.
:param args: object argparse arguments object.
:return:

mine_init.utils module

Utilities for packinit
class packinit.utils.BufferingSMTPHandler(mail_server, mail_port, src_email, dest_email, capacity)[source]

Bases: logging.handlers.BufferingHandler

A log handler that buffers messages into memory to deliver them as a single email.
flush()[source]

Override to implement custom flushing behaviour.

This version just zaps the buffer to empty.

send_email(subject, description, cc_list=None)[source]
Send email by calling flush after setting some last minute details.
:param subject: string Subject for outgoing email
:param description: string Opening paragraph for email
:param cc_list: list List of emails to CC for this
:return: void
class packinit.utils.JavaRunner(server_dir, pack_dir, java_params)[source]

Bases: object

Launches the Minecraft server
get_pack_data()[source]
Gets the packs info from packmaker and returns it as a dict.
:return: dict Packmaker pack data
main()[source]
After server has initialized, wait for it to exit or CTRL-C to be called.
signal_handler(_signal, _frame)[source]
document me please.
start_jvm(java_params)[source]
Starts the minecraft server.
:return: Minecraft server process.
class packinit.utils.LogPipe[source]

Bases: threading.Thread

Build a logging thread for subprocesses.
close()[source]
Close the write end of the pipe.
fileno()[source]
Return the write file descriptor of the pipe
run()[source]
Run the thread, logging everything.
class packinit.utils.MakeFileHandler(filename, mode='a', encoding=None, delay=0)[source]

Bases: logging.FileHandler

A file handler class that ensures the logging dir is precreated
class packinit.utils.PackFileUpdater(source, dest)[source]

Bases: object

Updates files in from a pack distribution to a server volume.
sync()[source]
Sync the /dist/pack/server directory with the /server directory.
:return: boolean This always returns true, for now.
class packinit.utils.PackManager(build_dir, cache_dir)[source]

Bases: object

Manages a Packmaker installation.
install_pack()[source]
Spawns a subprocess to preinstall the Packmaker pack.

:return: boolean True or False based on success.
class packinit.utils.PropertyFileManager(filename, properties)[source]

Bases: object

Manages server.properties files.
read()[source]
Loads the server.properties file into memory.
set_property(name, value)[source]
Updates a property in the file contents if it has changed.
:param name:
:param value:
update_properties()[source]
Checks properties dictionary and feeds them to set_property()
:return: boolean True or false based on success.
write()[source]
Saves the updated file contents to server.properties
:return: void