converge: Index | Files | Directories

package pkg

import ""


Package Files


func GetExitCode Uses

func GetExitCode(err error) (uint32, error)

GetExitCode returns the exit code of an error

type ExecCaller Uses

type ExecCaller struct{}

ExecCaller is a dummy struct to handle wrapping exec.Command in the SysCaller interface.

func (ExecCaller) Run Uses

func (e ExecCaller) Run(cmd string) ([]byte, error)

Run executes `cmd` as a /bin/sh script and returns the output and error

type Package Uses

type Package struct {
    // name of the package
    Name string `export:"name"`

    // package state; one of "present" or "absent"
    State  State `export:"state"`
    PkgMgr PackageManager

Package is an API for package state

func (*Package) Apply Uses

func (p *Package) Apply(context.Context) (resource.TaskStatus, error)

Apply desired package state

func (*Package) Check Uses

func (p *Package) Check(context.Context, resource.Renderer) (resource.TaskStatus, error)

Check if the package has to be 'present', or 'absent'

func (*Package) PackageState Uses

func (p *Package) PackageState() State

PackageState returns a State ("present","absent") based on whether a package is installed or not.

type PackageManager Uses

type PackageManager interface {
    // If the package is installed, returns the version and true, otherwise
    // returns an empty string and false.
    InstalledVersion(string) (PackageVersion, bool)

    // Installs a package, returning an error if something went wrong
    InstallPackage(string) (string, error)

    // Removes a package, returning an error if something went wrong
    RemovePackage(string) (string, error)

PackageManager describes an interface for managing packages and helps make `Check` and `Apply` testable.

type PackageVersion Uses

type PackageVersion string

PackageVersion is a type alias for a string, since various packages may use different naming conventions

type State Uses

type State string

State type for Package

const (
    // StatePresent indicates the package should be present
    StatePresent State = "present"

    // StateAbsent indicates the package should be absent
    StateAbsent State = "absent"

type SysCaller Uses

type SysCaller interface {
    Run(string) ([]byte, error)

SysCaller allows us to mock exec.Command



Package pkg imports 5 packages (graph) and is imported by 2 packages. Updated 2016-12-25. Refresh now. Tools for package owners.