osprepare

package
v0.0.0-...-194264a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 8, 2018 License: Apache-2.0 Imports: 8 Imported by: 3

Documentation

Overview

Package osprepare is the Operating System Preparation facility of Ciao, enabling very simple automated configuration of dependencies between various Linux distributions in a sane fashion.

Expressing Dependencies

InstallDeps is used to ensure the presence of mandatory dependencies during the early initialization of Ciao components, and install them via the native package deployment system when they are absent. InstallDeps should be invoked with a PackageRequirements map, which is simply a mapping of operating system IDs to path/package pairs. The function may not yet support all systems, so it is expected that it should perform its function without any outside interference, and should never cause failures or require checking of returns.

The PackageRequirements map (deps.go)

Below is an example of a valid PackageRequirements structure.

var deps = osprepare.PackageRequirements{
	"ubuntu": {
		{"/usr/bin/docker", "docker"},
	},
	"clearlinux": {
		{"/usr/bin/docker", "containers-basic"},
	},
}

As we can see, full paths to the expected locations on the filesystem are given for each OS, and the name of the native package or bundle to install should those files be missing. That is to say, if /usr/bin/docker is missing, on a system that has been identified as Ubuntu, then the 'docker' package would be installed.

The dependencies for each component should be placed into a `deps.go` file, which then facilitates easier maintenance and discoverability of the dependencies for every component.

Verified lack of dependencies

Note that it is also valid to state you have *no* dependencies at all, and that you have verified that each distro requires no additional dependencies to be installed during startup. Just pass an empty pair to the distro ID:

var schedDeps = osprepare.PackageRequirements{
	"clearlinux": {
		{"", ""},
	},
	"fedora": {
		{"", ""},
	},
	"ubuntu": {
		{"", ""},
	},
}

Operating System Identification

Operating Systems are identified via their `os-release` file, a standardized mechanism for identifying Linux distributions. Currently, detection is performed by comparison the lower-case value of the `ID` field to our known implementations, which are:

  • clearlinux
  • ubuntu
  • fedora

Index

Constants

View Source
const (
	MinDockerVersion = "1.11.0"
	MinQemuVersion   = "2.5.0"
)

Minimal versions supported by ciao

Variables

View Source
var BootstrapRequirements = PackageRequirements{
	"ubuntu": {
		{"/usr/bin/ceph", "ceph-common"},
	},
	"fedora": {
		{"/usr/bin/ceph", "ceph-common"},
	},
	"clearlinux": {
		{"/usr/bin/ceph", "storage-cluster"},
	},
}

BootstrapRequirements lists required dependencies for absolutely core functionality across all Ciao components

Functions

func Bootstrap

func Bootstrap(ctx context.Context, logger clogger.CiaoLog)

Bootstrap installs all the core dependencies required to bootstrap the core configuration of all Ciao components

func InstallDeps

func InstallDeps(ctx context.Context, reqs PackageRequirements, logger clogger.CiaoLog)

InstallDeps installs all the dependencies defined in a component specific PackageRequirements in order to enable running the component

Types

type PackageRequirement

type PackageRequirement struct {
	BinaryName  string
	PackageName string
}

PackageRequirement contains the BinaryName expected to exist on the filesystem once PackageName is installed (e.g: { '/usr/bin/qemu-system-x86_64', 'qemu'})

type PackageRequirements

type PackageRequirements map[string][]PackageRequirement

PackageRequirements type allows to create complex mapping to group a set of PackageRequirement to a single key. (e.g:

"ubuntu": {
	{"/usr/bin/docker", "docker"},
},
"clearlinux": {
	{"/usr/bin/docker", "containers-basic"},
},

)

func NewPackageRequirements

func NewPackageRequirements() PackageRequirements

NewPackageRequirements is a PackageRequirements constructor

func (*PackageRequirements) Append

func (cur *PackageRequirements) Append(newReqs PackageRequirements)

Append a list of PackageRequirements to a PackageRequirements list

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL