bootils package

Bootils offers process boot-strapping utilities that support writing robust application/service launcher and process life-cycle management scripts.

It is comprised of a bootils Python package with building blocks for process and resource management, and a CLI tool named nanny that watches your child process after starting, until it grows up into a stable running state.

Copyright © 2015 1&1 Group <btw-users@googlegroups.com>

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Submodules

bootils.checks module

Check helpers + results.

class bootils.checks.CheckFormatter(formatting=u'text', stream=None, verbose=False)[source]

Bases: object

Emit a sequence of check results.

GLUE = {'yaml': (u'', u'', u''), 'json': (u'[\n', u',\n', u'\n]\n'), 'csv': (u'', u'', u''), 'tap': (u'', u'\n', u'\n'), 'text': (u'', u'\n', u'\n')}
close()[source]

Print any trailing output and clean up resources.

dump(result)[source]

Print a single check result.

write(text)[source]

Unbuffered write of given text to output stream.

class bootils.checks.CheckResult(ok, name, comment, diagnostics)

Bases: tuple

__getnewargs__()

Return self as a plain tuple. Used by copy and pickle.

__getstate__()

Exclude the OrderedDict from pickling

__repr__()

Return a nicely formatted representation string

comment

Alias for field number 2

diagnostics

Alias for field number 3

name

Alias for field number 1

ok

Alias for field number 0

bootils.config module

Configuration utilities.

bootils.config.envvar(name, default=None)[source]

Return an environment variable specific for this application (using a prefix).

bootils.config.version_info(ctx=None)[source]

Return version information just like –version does.

bootils.launcher module

Service launcher and processc control.

class bootils.launcher.LauncherBase(config)[source]

Bases: object

Process launch & management.

init_environ()[source]

Initialize process environment and return its old state.

restore_environ(oldstate)[source]

Restore process environment to previous state as returned by init_environ.

bootils.launcher.check_gid(gid)[source]

Get numerical GID of a group.

Raises:KeyError – Unknown group name.
bootils.launcher.check_uid(uid)[source]

Get numerical UID of a user.

Raises:KeyError – Unknown user name.
bootils.launcher.signal2int(sig_spec)[source]

Convert given signal specification to its integer value.

Parameters:sig_spec (int or str) – Either already an int, a number as a string, or a case-insensitive signal name.
Returns:Signal number.
Return type:int
Raises:ValueError – Bad / unknown signal name, or bad input type.