provision: github.com/digitalrebar/provision/backend Index | Files | Directories

package backend

import "github.com/digitalrebar/provision/backend"

backend contains the backend code for DigitalRebar Provision. It has the responsibility for saving and loading all the data we need to the backing store, making sure that said models are valid and remain consistent, making sure that all the links between objects remain consistent, and providing any optimizations needed to make things perform at scale.

Index

Package Files

bootenv.go conncache.go conncache_linux.go dataTracker.go dhcpUtils.go doc.go errors.go event.go fs.go interface_resolver.go interfaces.go jobs.go jwt-utils.go lease.go machines.go param.go plugins.go preference.go profiles.go renderData.go requestTracker.go reservation.go stage.go subnet.go task.go template.go user.go workflow.go

Constants

const (
    ValidationError     = "ValidationError"
    TemplateRenderError = "TemplateRenderError"
    StillInUseError     = "StillInUseError"
)

func AddToCache Uses

func AddToCache(l logger.Logger, la, ra net.IP)

AddToCache adds a new remote -> local IP address mapping to the connection cache. If the remote address is already in the cache, its corresponding local address is updates and the timeout is bumped. Mappings that have not been accessed with LocalFor or updated with AddToCache will be evicted if not used for more than 10 minutes.

func BasicContent Uses

func BasicContent() store.Store

func DefaultIP Uses

func DefaultIP(l logger.Logger) net.IP

DefaultIP figures out the IP address of the interface that has the default route. It is used as a fallback IP address when we don't have --static-ip set and we cannot find a local -> remote mapping in the cache.

func Fill Uses

func Fill(t store.KeySaver)

func LocalFor Uses

func LocalFor(l logger.Logger, ra net.IP) net.IP

LocalFor returns the local IP address that has responded to TFTP or HTTP requests for the given remote IP. It also bumps the timeout.

func ModelToBackend Uses

func ModelToBackend(m models.Model) store.KeySaver

func SetLogPublisher Uses

func SetLogPublisher(l *logger.Buffer, pubs *Publishers)

func ValidateDataTrackerStore Uses

func ValidateDataTrackerStore(fileRoot string, backend store.Store, logger logger.Logger) (hard, soft error)

This must be locked with ALL locks on the source datatracker from the caller.

type AuthSaver Uses

type AuthSaver interface {
    AuthKey() string
}

type BootEnv Uses

type BootEnv struct {
    *models.BootEnv
    // contains filtered or unexported fields
}

BootEnv encapsulates the machine-agnostic information needed by the provisioner to set up a boot environment.

swagger:model

func AsBootEnv Uses

func AsBootEnv(o models.Model) *BootEnv

func AsBootEnvs Uses

func AsBootEnvs(o []models.Model) []*BootEnv

func (*BootEnv) AddDynamicTree Uses

func (b *BootEnv) AddDynamicTree()

func (*BootEnv) AfterDelete Uses

func (b *BootEnv) AfterDelete()

func (*BootEnv) AfterSave Uses

func (b *BootEnv) AfterSave()

func (*BootEnv) Backend Uses

func (b *BootEnv) Backend() store.Store

func (*BootEnv) BeforeDelete Uses

func (b *BootEnv) BeforeDelete() error

func (*BootEnv) BeforeSave Uses

func (b *BootEnv) BeforeSave() error

func (*BootEnv) Indexes Uses

func (b *BootEnv) Indexes() map[string]index.Maker

func (*BootEnv) Locks Uses

func (b *BootEnv) Locks(action string) []string

func (*BootEnv) NetBoot Uses

func (b *BootEnv) NetBoot() bool

func (*BootEnv) New Uses

func (b *BootEnv) New() store.KeySaver

func (*BootEnv) OnLoad Uses

func (b *BootEnv) OnLoad() error

func (*BootEnv) Render Uses

func (b *BootEnv) Render(rt *RequestTracker, m *Machine, e models.ErrorAdder) renderers

func (*BootEnv) SaveClean Uses

func (obj *BootEnv) SaveClean() store.KeySaver

func (*BootEnv) SetReadOnly Uses

func (obj *BootEnv) SetReadOnly(b bool)

func (*BootEnv) Validate Uses

func (b *BootEnv) Validate()

type Claim Uses

type Claim struct {
    Scope    string `json:"scope"`
    Action   string `json:"action"`
    Specific string `json:"specific"`
}

Claim is an individial specifier for something we are allowed access to.

func (*Claim) Match Uses

func (c *Claim) Match(scope, action, specific string) bool

Match tests to see if this claim allows access for the specified scope, action, and specific item.

If the Claim has `*` for any field, it matches all possible values for that field.

type DataTracker Uses

type DataTracker struct {
    logger.Logger
    FileRoot            string
    LogRoot             string
    OurAddress          string
    ForceOurAddress     bool
    StaticPort, ApiPort int
    FS                  *FileSystem
    Backend             store.Store

    GlobalProfileName string
    // contains filtered or unexported fields
}

DataTracker represents everything there is to know about acting as a dataTracker.

func NewDataTracker Uses

func NewDataTracker(backend store.Store,
    fileRoot, logRoot, addr string, forceAddr bool,
    staticPort, apiPort int,
    logger logger.Logger,
    defaultPrefs map[string]string,
    publishers *Publishers) *DataTracker

Create a new DataTracker that will use passed store to save all operational data

func (*DataTracker) Backup Uses

func (p *DataTracker) Backup() ([]byte, error)

func (*DataTracker) GetInterfaces Uses

func (dt *DataTracker) GetInterfaces() ([]*models.Interface, error)

func (*DataTracker) GetToken Uses

func (p *DataTracker) GetToken(tokenString string) (*DrpCustomClaims, error)

func (*DataTracker) LocalIP Uses

func (p *DataTracker) LocalIP(remote net.IP) string

func (*DataTracker) LogFor Uses

func (p *DataTracker) LogFor(s string) logger.Logger

func (*DataTracker) Pref Uses

func (p *DataTracker) Pref(name string) (string, error)

func (*DataTracker) Prefs Uses

func (p *DataTracker) Prefs() map[string]string

func (*DataTracker) RenderUnknown Uses

func (p *DataTracker) RenderUnknown(rt *RequestTracker) error

func (*DataTracker) ReplaceBackend Uses

func (p *DataTracker) ReplaceBackend(rt *RequestTracker, st store.Store) (hard, soft error)

Assumes that all locks are held

func (*DataTracker) Request Uses

func (p *DataTracker) Request(l logger.Logger, locks ...string) *RequestTracker

func (*DataTracker) SealClaims Uses

func (p *DataTracker) SealClaims(claims *DrpCustomClaims) (string, error)

func (*DataTracker) SetPrefs Uses

func (p *DataTracker) SetPrefs(rt *RequestTracker, prefs map[string]string) error

type DrpCustomClaims Uses

type DrpCustomClaims struct {
    DrpClaims     []Claim       `json:"drp_claims"`
    GrantorClaims GrantorClaims `json:"grantor_claims"`
    jwt.StandardClaims
}

DrpCustomClaims is a JWT token that contains a list of all the things this token allows access to.

func NewClaim Uses

func NewClaim(user, grantor string, ttl time.Duration) *DrpCustomClaims

NewClaim creates a new, unsigned Token that doesn't allow access to anything. You must call Seal() to turn this into a signed JWT token.

func (*DrpCustomClaims) Add Uses

func (d *DrpCustomClaims) Add(scope, action, specific string) *DrpCustomClaims

Add adds a discrete Claim to our custom Token class.

func (*DrpCustomClaims) AddMachine Uses

func (d *DrpCustomClaims) AddMachine(uuid string) *DrpCustomClaims

Set the specific secrets

func (*DrpCustomClaims) AddSecrets Uses

func (d *DrpCustomClaims) AddSecrets(user, grantor, machine string) *DrpCustomClaims

Set the specific secrets

func (*DrpCustomClaims) GrantorId Uses

func (d *DrpCustomClaims) GrantorId() string

func (*DrpCustomClaims) HasGrantorId Uses

func (d *DrpCustomClaims) HasGrantorId() bool

func (*DrpCustomClaims) HasMachineUuid Uses

func (d *DrpCustomClaims) HasMachineUuid() bool

func (*DrpCustomClaims) HasUserId Uses

func (d *DrpCustomClaims) HasUserId() bool

func (*DrpCustomClaims) MachineUuid Uses

func (d *DrpCustomClaims) MachineUuid() string

func (*DrpCustomClaims) Match Uses

func (d *DrpCustomClaims) Match(scope, action, specific string) bool

Match tests all the claims in this Token to find one that matches.

func (*DrpCustomClaims) Seal Uses

func (d *DrpCustomClaims) Seal(m *JwtManager) (string, error)

Seal turns our custom Token class into a signed JWT Token.

func (*DrpCustomClaims) UserId Uses

func (d *DrpCustomClaims) UserId() string

func (*DrpCustomClaims) ValidateSecrets Uses

func (d *DrpCustomClaims) ValidateSecrets(grantor, user, machine string) bool

type FileSystem Uses

type FileSystem struct {
    sync.Mutex
    // contains filtered or unexported fields
}

FileSystem provides the routines to allow the static HTTP and TFTP services to render templates on demand..

func NewFS Uses

func NewFS(backingFSPath string, logger logger.Logger) *FileSystem

NewFS creates a new initialized filesystem that will fall back to serving files from backingFSPath if there is not a template to be rendered.

func (*FileSystem) AddDynamicFile Uses

func (fs *FileSystem) AddDynamicFile(fsPath string, t func(net.IP) (io.Reader, error))

AddDynamicFile adds a lookaside that handles rendering a file that should be generated on the fly. fsPath is the path where the dynamic lookaside lives, and the passed-in function will be called with the IP address of the system making the request.

func (*FileSystem) AddDynamicTree Uses

func (fs *FileSystem) AddDynamicTree(fsPath string, t func(string) (io.Reader, error))

AddDynamicTree adds a lookaside responsible for wholesale impersonation of a directory tree. fsPath indicates where AddDynamicTree will start handling all read requests, and the passed-in function will be called with the full path to whatever was being requested.

func (*FileSystem) DelDynamicFile Uses

func (fs *FileSystem) DelDynamicFile(fsPath string)

DelDynamicFile removes a lookaside registered for fsPath, if any.

func (*FileSystem) DelDynamicTree Uses

func (fs *FileSystem) DelDynamicTree(fsPath string)

DelDynamicTree removes a lookaside responsible for wholesale impersonation of a directory tree.

func (*FileSystem) Open Uses

func (fs *FileSystem) Open(p string, remoteIP net.IP) (io.Reader, error)

Open tests for the existence of a lookaside for file read request. The returned Reader amd error contains the results of running the lookaside function if one is present. If both the reader and error are nil, FileSystem should fall back to serving a static file.

func (*FileSystem) ServeHTTP Uses

func (fs *FileSystem) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements http.Handler for the FileSystem.

func (*FileSystem) TftpResponder Uses

func (fs *FileSystem) TftpResponder() func(string, net.IP) (io.Reader, error)

TftpResponder returns a function that allows the TFTP midlayer to serve files from the FileSystem.

type GrantorClaims Uses

type GrantorClaims struct {
    GrantorId     string `json:"grantor_id"`
    GrantorSecret string `json:"grantor_secret"`
    UserId        string `json:"user_id"`
    UserSecret    string `json:"user_secret"`
    MachineUuid   string `json:"machine_uuid"`
    MachineSecret string `json:"machine_secret"`
}

Grantor Claims allow for the token to be validated against the granting user, the current user, and the machine. Each of those object can have a secret that if changed on the user object will invalid the token.

This allows for mass revocation at a machine, grantor, or user level.

func (*GrantorClaims) Validate Uses

func (gc *GrantorClaims) Validate(grantor, user, machine string) bool

If present, we should validate them.

type Job Uses

type Job struct {
    *models.Job
    // contains filtered or unexported fields
}

Job represents a task that is running (or has run) on a machine. The job create workflow I envision works like this:

* POST to api/v3/jobs with a body containing {"Machine":

"a-machine-uuid"} If there is no current job, or the current job
is "failed", a new job is created for the Task indexed by
CurrentTask. If the current job is "finished", the machine
CurrentTask is incremented.  If that causes CurrentTask to go
past the end of the Tasks list for the machine, no job is created
and the API returns a 204. If the current job is in the imcomplete
state, that job is returned with a 202.  Otherwise a new job is
created and is returned with a 201. If there is a current job that is neither
"incomplete", "failed", nor "finished", the POST fails.  The new job will be
created with its Previous value set to the machine's CurrentJob,
and the machine's CurrentJob is updated with the UUID of the new
job.

* When a new Job is created, it makes a RenderData for the

templates contained in the Task the job was created against.  The
client will be able to retrieve the rendered templates via GET
from api/v3/jobs/:job-id/templates.

* The client will place or execute the templates based on whether

there is a Path associated with the expanded Template in the
order that the jobs/:id/templates API endpoint returns them in.
As it does so, it will log its progress via POST to jobs/:id/log.

* If any job operation fails, the client will update the job status to "failed".

* If all job operations succeed, the client will update the job status to "finished"

* On provisioner startup, all machine CurrentJobs are set to "failed" if they are not "finished"

swagger:model

func AsJob Uses

func AsJob(o models.Model) *Job

func AsJobs Uses

func AsJobs(o []models.Model) []*Job

func (*Job) AfterSave Uses

func (j *Job) AfterSave()

func (*Job) BeforeDelete Uses

func (j *Job) BeforeDelete() error

func (*Job) BeforeSave Uses

func (j *Job) BeforeSave() error

func (*Job) Indexes Uses

func (j *Job) Indexes() map[string]index.Maker

func (*Job) Locks Uses

func (j *Job) Locks(action string) []string

func (*Job) Log Uses

func (j *Job) Log(rt *RequestTracker, src io.Reader) error

func (*Job) LogPath Uses

func (j *Job) LogPath(rt *RequestTracker) string

func (*Job) New Uses

func (j *Job) New() store.KeySaver

func (*Job) OnChange Uses

func (j *Job) OnChange(oldThing store.KeySaver) error

func (*Job) OnCreate Uses

func (j *Job) OnCreate() error

func (*Job) OnLoad Uses

func (j *Job) OnLoad() error

func (*Job) RenderActions Uses

func (j *Job) RenderActions(rt *RequestTracker) ([]*models.JobAction, error)

func (*Job) SaveClean Uses

func (obj *Job) SaveClean() store.KeySaver

func (*Job) SetReadOnly Uses

func (obj *Job) SetReadOnly(b bool)

func (*Job) UUID Uses

func (j *Job) UUID() string

func (*Job) Validate Uses

func (j *Job) Validate()

type JwtConfig Uses

type JwtConfig struct {
    // digital signing method, defaults to jwt.SigningMethodHS256 (SHA256)
    Method jwt.SigningMethod
}

Config configures a Manager.

type JwtManager Uses

type JwtManager struct {
    // contains filtered or unexported fields
}

Manager is a JSON Web Token (JWT) Provider which create or retrieves tokens with a particular signing key and options.

func NewJwtManager Uses

func NewJwtManager(key []byte, configs ...JwtConfig) *JwtManager

New creates a new Manager which provides JWTs using the given signing key. Defaults to signing with SHA256 HMAC (jwt.SigningMethodHS256)

type Lease Uses

type Lease struct {
    *models.Lease
    // contains filtered or unexported fields
}

Lease models a DHCP Lease swagger:model

func AsLease Uses

func AsLease(o models.Model) *Lease

func AsLeases Uses

func AsLeases(o []models.Model) []*Lease

func FakeLeaseFor Uses

func FakeLeaseFor(rt *RequestTracker,
    strat, token string,
    via []net.IP) (lease *Lease, subnet *Subnet, reservation *Reservation)

FakeLeaseFor returns a lease that has zero duration and that should not be saved. It is intended for use when we are acting as a proxy DHCP server or we are acting as a BINL server.

func FindLease Uses

func FindLease(rt *RequestTracker,
    strat, token string,
    req net.IP) (lease *Lease, subnet *Subnet, reservation *Reservation, err error)

FindLease finds an appropriate matching Lease. If a non-nil error is returned, the DHCP system must NAK the response. If lease and error are nil, the DHCP system must not respond to the request. Otherwise, the lease will be returned with its ExpireTime updated and the Lease saved.

This function should be called in response to a DHCPREQUEST.

func FindOrCreateLease Uses

func FindOrCreateLease(rt *RequestTracker,
    strat, token string,
    req net.IP,
    via []net.IP) (lease *Lease, subnet *Subnet, reservation *Reservation, fresh bool)

FindOrCreateLease will return a lease for the passed information, creating it if it can. If a non-nil Lease is returned, it has been saved and the DHCP system can offer it. If the returned lease is nil, then the DHCP system should not respond.

This function should be called for DHCPDISCOVER.

func (*Lease) BeforeSave Uses

func (l *Lease) BeforeSave() error

func (*Lease) Indexes Uses

func (l *Lease) Indexes() map[string]index.Maker

func (*Lease) Locks Uses

func (l *Lease) Locks(action string) []string

func (*Lease) New Uses

func (l *Lease) New() store.KeySaver

func (*Lease) OnChange Uses

func (l *Lease) OnChange(oldThing store.KeySaver) error

func (*Lease) OnCreate Uses

func (l *Lease) OnCreate() error

func (*Lease) OnLoad Uses

func (l *Lease) OnLoad() error

func (*Lease) Reservation Uses

func (l *Lease) Reservation(rt *RequestTracker) *Reservation

func (*Lease) SaveClean Uses

func (obj *Lease) SaveClean() store.KeySaver

func (*Lease) SetReadOnly Uses

func (obj *Lease) SetReadOnly(b bool)

func (*Lease) Subnet Uses

func (l *Lease) Subnet(rt *RequestTracker) *Subnet

func (*Lease) Validate Uses

func (l *Lease) Validate()

type LeaseNAK Uses

type LeaseNAK error

LeaseNAK is the error that shall be returned when we cannot give a system the IP address it requested. If FindLease or FindOrCreateLease return this as their error, then the DHCP midlayer must NAK the request.

type Machine Uses

type Machine struct {
    *models.Machine
    // contains filtered or unexported fields
}

Machine represents a single bare-metal system that the provisioner should manage the boot environment for. swagger:model

func AsMachine Uses

func AsMachine(o models.Model) *Machine

func AsMachines Uses

func AsMachines(o []models.Model) []*Machine

func (*Machine) AfterDelete Uses

func (n *Machine) AfterDelete()

func (*Machine) AfterSave Uses

func (n *Machine) AfterSave()

func (*Machine) AllowStageChange Uses

func (n *Machine) AllowStageChange()

func (*Machine) BeforeSave Uses

func (n *Machine) BeforeSave() error

func (*Machine) HasProfile Uses

func (n *Machine) HasProfile(name string) bool

func (*Machine) HasTask Uses

func (n *Machine) HasTask(s string) bool

func (*Machine) HexAddress Uses

func (n *Machine) HexAddress() string

HexAddress returns Address in raw hexadecimal format, suitable for pxelinux and elilo usage.

func (*Machine) InRunner Uses

func (obj *Machine) InRunner()

func (*Machine) Indexes Uses

func (n *Machine) Indexes() map[string]index.Maker

func (*Machine) Locks Uses

func (m *Machine) Locks(action string) []string

func (*Machine) New Uses

func (n *Machine) New() store.KeySaver

func (*Machine) OnChange Uses

func (n *Machine) OnChange(oldThing store.KeySaver) error

func (*Machine) OnCreate Uses

func (n *Machine) OnCreate() error

func (*Machine) OnLoad Uses

func (n *Machine) OnLoad() error

func (*Machine) ParameterMaker Uses

func (n *Machine) ParameterMaker(rt *RequestTracker, parameter string) (index.Maker, error)

func (*Machine) Path Uses

func (n *Machine) Path() string

func (*Machine) SaveClean Uses

func (obj *Machine) SaveClean() store.KeySaver

func (*Machine) SetReadOnly Uses

func (obj *Machine) SetReadOnly(b bool)

func (*Machine) ShortName Uses

func (n *Machine) ShortName() string

func (*Machine) Validate Uses

func (n *Machine) Validate()

type Param Uses

type Param struct {
    *models.Param
    // contains filtered or unexported fields
}

Param represents metadata about a Parameter or a Preference. Specifically, it contains a description of what the information is for, detailed documentation about the param, and a JSON schema that the param must match to be considered valid. swagger:model

func AsParam Uses

func AsParam(o models.Model) *Param

func AsParams Uses

func AsParams(o []models.Model) []*Param

func (*Param) BeforeSave Uses

func (p *Param) BeforeSave() error

func (*Param) Indexes Uses

func (p *Param) Indexes() map[string]index.Maker

func (*Param) Locks Uses

func (p *Param) Locks(action string) []string

func (*Param) New Uses

func (p *Param) New() store.KeySaver

func (*Param) OnLoad Uses

func (p *Param) OnLoad() error

func (*Param) SaveClean Uses

func (obj *Param) SaveClean() store.KeySaver

func (*Param) SetReadOnly Uses

func (obj *Param) SetReadOnly(b bool)

func (*Param) Validate Uses

func (p *Param) Validate()

func (*Param) ValidateValue Uses

func (p *Param) ValidateValue(val interface{}) error

type Paramer Uses

type Paramer interface {
    models.Model
    GetParams(Stores, bool) map[string]interface{}
    SetParams(Stores, map[string]interface{}) error
    GetParam(Stores, string, bool) (interface{}, bool)
    SetParam(Stores, string, interface{}) error
}

type Plugin Uses

type Plugin struct {
    *models.Plugin
    // contains filtered or unexported fields
}

Plugin represents a single instance of a running plugin. This contains the configuration need to start this plugin instance. swagger:model

func AsPlugin Uses

func AsPlugin(o models.Model) *Plugin

func AsPlugins Uses

func AsPlugins(o []models.Model) []*Plugin

func (*Plugin) BeforeSave Uses

func (n *Plugin) BeforeSave() error

func (*Plugin) Indexes Uses

func (n *Plugin) Indexes() map[string]index.Maker

func (*Plugin) Key Uses

func (n *Plugin) Key() string

func (*Plugin) Locks Uses

func (m *Plugin) Locks(action string) []string

func (*Plugin) New Uses

func (n *Plugin) New() store.KeySaver

func (*Plugin) OnLoad Uses

func (n *Plugin) OnLoad() error

func (*Plugin) Prefix Uses

func (n *Plugin) Prefix() string

func (*Plugin) SaveClean Uses

func (obj *Plugin) SaveClean() store.KeySaver

func (*Plugin) SetReadOnly Uses

func (obj *Plugin) SetReadOnly(b bool)

func (*Plugin) Validate Uses

func (n *Plugin) Validate()

type Pref Uses

type Pref struct {
    *models.Pref
    // contains filtered or unexported fields
}

Pref tracks a global DigitalRebar Provision preference -- things like the bootenv to use for unknown systems trying to PXE boot to us, the default bootenv for known systems, etc.

func AsPref Uses

func AsPref(v models.Model) *Pref

func (*Pref) Locks Uses

func (p *Pref) Locks(action string) []string

func (*Pref) New Uses

func (p *Pref) New() store.KeySaver

type Profile Uses

type Profile struct {
    *models.Profile
    // contains filtered or unexported fields
}

Profile represents a set of key/values to use in template expansion.

There is one special profile named 'global' that acts as a global set of parameters for the system.

These can be assigned to a machine's profile list. swagger:model

func AsProfile Uses

func AsProfile(o models.Model) *Profile

func AsProfiles Uses

func AsProfiles(o []models.Model) []*Profile

func (*Profile) BeforeDelete Uses

func (p *Profile) BeforeDelete() error

func (*Profile) BeforeSave Uses

func (p *Profile) BeforeSave() error

func (*Profile) Indexes Uses

func (p *Profile) Indexes() map[string]index.Maker

func (*Profile) Locks Uses

func (p *Profile) Locks(action string) []string

func (*Profile) New Uses

func (p *Profile) New() store.KeySaver

func (*Profile) OnLoad Uses

func (p *Profile) OnLoad() error

func (*Profile) SaveClean Uses

func (obj *Profile) SaveClean() store.KeySaver

func (*Profile) SetReadOnly Uses

func (obj *Profile) SetReadOnly(b bool)

func (*Profile) Validate Uses

func (p *Profile) Validate()

type Publisher Uses

type Publisher interface {
    Publish(event *models.Event) error
    Reserve() error
    Release()
    Unload()
}

* NOTE: CRUCIAL: CRITICAL: This could be bad if not adhered. * The Publish, release, and reserve routines must not call loggers * that publish events!

type Publishers Uses

type Publishers struct {
    // contains filtered or unexported fields
}

func NewPublishers Uses

func NewPublishers(logger *log.Logger) *Publishers

func (*Publishers) Add Uses

func (p *Publishers) Add(pp Publisher)

func (*Publishers) List Uses

func (p *Publishers) List() []Publisher

func (*Publishers) Remove Uses

func (p *Publishers) Remove(pp Publisher)

type ReadSizer Uses

type ReadSizer interface {
    io.Reader
    Sizer
}

type RenderData Uses

type RenderData struct {
    Machine *rMachine // The Machine that the template is being rendered for.
    Env     *rBootEnv // The boot environment that provided the template.
    Task    *rTask
    Stage   *rStage
    // contains filtered or unexported fields
}

RenderData is the struct that is passed to templates as a source of parameters and useful methods.

func (*RenderData) ApiURL Uses

func (r *RenderData) ApiURL() string

func (*RenderData) BootParams Uses

func (r *RenderData) BootParams() (string, error)

BootParams is a helper function that expands the BootParams template from the boot environment.

func (*RenderData) CallTemplate Uses

func (r *RenderData) CallTemplate(name string, data interface{}) (ret interface{}, err error)

func (*RenderData) GenerateInfiniteToken Uses

func (r *RenderData) GenerateInfiniteToken() string

func (*RenderData) GenerateProfileToken Uses

func (r *RenderData) GenerateProfileToken(profile string, duration int) string

func (*RenderData) GenerateToken Uses

func (r *RenderData) GenerateToken() string

func (*RenderData) InstallRepos Uses

func (r *RenderData) InstallRepos() []*Repo

func (*RenderData) MachineRepos Uses

func (r *RenderData) MachineRepos() []*Repo

func (*RenderData) Param Uses

func (r *RenderData) Param(key string) (interface{}, error)

Param is a helper function for extracting a parameter from Machine.Params

func (*RenderData) ParamAsJSON Uses

func (r *RenderData) ParamAsJSON(key string) (string, error)

func (*RenderData) ParamAsYAML Uses

func (r *RenderData) ParamAsYAML(key string) (string, error)

func (*RenderData) ParamExists Uses

func (r *RenderData) ParamExists(key string) bool

ParamExists is a helper function for determining the existence of a machine parameter.

func (*RenderData) ParseUrl Uses

func (r *RenderData) ParseUrl(segment, rawUrl string) (string, error)

func (*RenderData) ProvisionerAddress Uses

func (r *RenderData) ProvisionerAddress() string

func (*RenderData) ProvisionerURL Uses

func (r *RenderData) ProvisionerURL() string

func (*RenderData) Repos Uses

func (r *RenderData) Repos(tags ...string) []*Repo

type Repo Uses

type Repo struct {
    Tag            string   `json:"tag"`
    OS             []string `json:"os"`
    URL            string   `json:"url"`
    PackageType    string   `json:"packageType"`
    RepoType       string   `json:"repoType"`
    InstallSource  bool     `json:"installSource"`
    SecuritySource bool     `json:"securitySource"`
    Distribution   string   `json:"distribution"`
    Components     []string `json:"components"`
    // contains filtered or unexported fields
}

func (*Repo) Install Uses

func (rd *Repo) Install() (string, error)

func (*Repo) JoinedComponents Uses

func (rd *Repo) JoinedComponents() string

func (*Repo) Lines Uses

func (rd *Repo) Lines() (string, error)

func (*Repo) R Uses

func (rd *Repo) R() *RenderData

func (*Repo) Target Uses

func (rd *Repo) Target() string

func (*Repo) UrlFor Uses

func (rd *Repo) UrlFor(component string) string

type RequestTracker Uses

type RequestTracker struct {
    *sync.Mutex
    logger.Logger
    // contains filtered or unexported fields
}

func (*RequestTracker) AddParam Uses

func (rt *RequestTracker) AddParam(obj models.Paramer, key string, val interface{}) error

func (*RequestTracker) AllLocked Uses

func (rt *RequestTracker) AllLocked(thunk func(Stores))

func (*RequestTracker) ApiURL Uses

func (rt *RequestTracker) ApiURL(remoteIP net.IP) string

func (*RequestTracker) Create Uses

func (rt *RequestTracker) Create(obj models.Model) (saved bool, err error)

func (*RequestTracker) DelParam Uses

func (rt *RequestTracker) DelParam(obj models.Paramer, key string) (interface{}, error)

func (*RequestTracker) Do Uses

func (rt *RequestTracker) Do(thunk func(Stores))

func (*RequestTracker) FileURL Uses

func (rt *RequestTracker) FileURL(remoteIP net.IP) string

func (*RequestTracker) Find Uses

func (rt *RequestTracker) Find(prefix, key string) models.Model

func (*RequestTracker) FindByIndex Uses

func (rt *RequestTracker) FindByIndex(prefix string, idx index.Maker, key string) models.Model

func (*RequestTracker) GetParam Uses

func (rt *RequestTracker) GetParam(obj models.Paramer, key string, aggregate bool) (interface{}, bool)

func (*RequestTracker) GetParams Uses

func (rt *RequestTracker) GetParams(obj models.Paramer, aggregate bool) map[string]interface{}

func (*RequestTracker) Index Uses

func (rt *RequestTracker) Index(name string) *index.Index

func (*RequestTracker) MachineForMac Uses

func (rt *RequestTracker) MachineForMac(mac string) *Machine

func (*RequestTracker) Patch Uses

func (rt *RequestTracker) Patch(obj models.Model, key string, patch jsonpatch2.Patch) (models.Model, error)

func (*RequestTracker) Publish Uses

func (rt *RequestTracker) Publish(prefix, action, key string, ref interface{}) error

func (*RequestTracker) PublishEvent Uses

func (rt *RequestTracker) PublishEvent(e *models.Event) error

func (*RequestTracker) Remove Uses

func (rt *RequestTracker) Remove(obj models.Model) (removed bool, err error)

func (*RequestTracker) Save Uses

func (rt *RequestTracker) Save(obj models.Model) (saved bool, err error)

func (*RequestTracker) SealClaims Uses

func (rt *RequestTracker) SealClaims(claims *DrpCustomClaims) (string, error)

func (*RequestTracker) SetParam Uses

func (rt *RequestTracker) SetParam(obj models.Paramer, key string, val interface{}) error

func (*RequestTracker) SetParams Uses

func (rt *RequestTracker) SetParams(obj models.Paramer, values map[string]interface{}) error

func (*RequestTracker) Update Uses

func (rt *RequestTracker) Update(obj models.Model) (saved bool, err error)

type Reservation Uses

type Reservation struct {
    *models.Reservation
    // contains filtered or unexported fields
}

Reservation tracks persistent DHCP IP address reservations.

swagger:model

func AsReservation Uses

func AsReservation(o models.Model) *Reservation

func AsReservations Uses

func AsReservations(o []models.Model) []*Reservation

func (*Reservation) BeforeSave Uses

func (r *Reservation) BeforeSave() error

func (*Reservation) Indexes Uses

func (l *Reservation) Indexes() map[string]index.Maker

func (*Reservation) Locks Uses

func (r *Reservation) Locks(action string) []string

func (*Reservation) New Uses

func (r *Reservation) New() store.KeySaver

func (*Reservation) OnChange Uses

func (r *Reservation) OnChange(oldThing store.KeySaver) error

func (*Reservation) OnCreate Uses

func (r *Reservation) OnCreate() error

func (*Reservation) OnLoad Uses

func (r *Reservation) OnLoad() error

func (*Reservation) SaveClean Uses

func (obj *Reservation) SaveClean() store.KeySaver

func (*Reservation) SetReadOnly Uses

func (obj *Reservation) SetReadOnly(b bool)

func (*Reservation) Validate Uses

func (r *Reservation) Validate()

type Sizer Uses

type Sizer interface {
    Size() int64
}

type Stage Uses

type Stage struct {
    *models.Stage
    // contains filtered or unexported fields
}

Stage encapsulates tasks we want to run a machine

swagger:model

func AsStage Uses

func AsStage(o models.Model) *Stage

func AsStages Uses

func AsStages(o []models.Model) []*Stage

func (*Stage) AfterSave Uses

func (s *Stage) AfterSave()

func (*Stage) BeforeDelete Uses

func (s *Stage) BeforeDelete() error

func (*Stage) BeforeSave Uses

func (s *Stage) BeforeSave() error

func (*Stage) HasProfile Uses

func (s *Stage) HasProfile(name string) bool

func (*Stage) HasTask Uses

func (s *Stage) HasTask(ts string) bool

func (*Stage) Indexes Uses

func (s *Stage) Indexes() map[string]index.Maker

func (*Stage) Locks Uses

func (s *Stage) Locks(action string) []string

func (*Stage) New Uses

func (s *Stage) New() store.KeySaver

func (*Stage) OnLoad Uses

func (s *Stage) OnLoad() error

func (*Stage) Render Uses

func (s *Stage) Render(rt *RequestTracker, m *Machine, e models.ErrorAdder) renderers

func (*Stage) SaveClean Uses

func (obj *Stage) SaveClean() store.KeySaver

func (*Stage) SetReadOnly Uses

func (obj *Stage) SetReadOnly(b bool)

func (*Stage) Validate Uses

func (s *Stage) Validate()

type Store Uses

type Store struct {
    sync.Mutex
    index.Index
    // contains filtered or unexported fields
}

dtobjs is an in-memory cache of all the objects we could reference. The implementation of this may need to change from storing a slice of things to a more elaborate datastructure at some point in time. Since that point in time is when the slices are forced out of CPU cache, I am not terribly concerned for now. Until that point is reached, sorting and searching slices is fantastically efficient.

type Stores Uses

type Stores func(string) *Store

type Subnet Uses

type Subnet struct {
    *models.Subnet
    // contains filtered or unexported fields
}

Subnet represents a DHCP Subnet

swagger:model

func AsSubnet Uses

func AsSubnet(o models.Model) *Subnet

func AsSubnets Uses

func AsSubnets(o []models.Model) []*Subnet

func (*Subnet) BeforeSave Uses

func (s *Subnet) BeforeSave() error

func (*Subnet) InActiveRange Uses

func (s *Subnet) InActiveRange(ip net.IP) bool

func (*Subnet) InSubnetRange Uses

func (s *Subnet) InSubnetRange(ip net.IP) bool

func (*Subnet) Indexes Uses

func (s *Subnet) Indexes() map[string]index.Maker

func (*Subnet) LeaseTimeFor Uses

func (s *Subnet) LeaseTimeFor(ip net.IP) time.Duration

func (*Subnet) Locks Uses

func (s *Subnet) Locks(action string) []string

func (*Subnet) New Uses

func (s *Subnet) New() store.KeySaver

func (*Subnet) OnLoad Uses

func (s *Subnet) OnLoad() error

func (*Subnet) SaveClean Uses

func (obj *Subnet) SaveClean() store.KeySaver

func (*Subnet) SetReadOnly Uses

func (obj *Subnet) SetReadOnly(b bool)

func (*Subnet) Validate Uses

func (s *Subnet) Validate()

type Task Uses

type Task struct {
    *models.Task
    // contains filtered or unexported fields
}

Task is a thing that can run on a Machine.

swagger:model

func AsTask Uses

func AsTask(o models.Model) *Task

func AsTasks Uses

func AsTasks(o []models.Model) []*Task

func (*Task) BeforeDelete Uses

func (t *Task) BeforeDelete() error

func (*Task) BeforeSave Uses

func (t *Task) BeforeSave() error

func (*Task) Indexes Uses

func (t *Task) Indexes() map[string]index.Maker

func (*Task) Locks Uses

func (t *Task) Locks(action string) []string

func (*Task) New Uses

func (t *Task) New() store.KeySaver

func (*Task) OnLoad Uses

func (t *Task) OnLoad() error

func (*Task) Render Uses

func (t *Task) Render(rt *RequestTracker, m *Machine, e *models.Error) renderers

func (*Task) SaveClean Uses

func (obj *Task) SaveClean() store.KeySaver

func (*Task) SetReadOnly Uses

func (obj *Task) SetReadOnly(b bool)

func (*Task) Validate Uses

func (t *Task) Validate()

type Template Uses

type Template struct {
    *models.Template
    // contains filtered or unexported fields
}

Template represents a template that will be associated with a boot environment.

swagger:model

func AsTemplate Uses

func AsTemplate(o models.Model) *Template

func AsTemplates Uses

func AsTemplates(o []models.Model) []*Template

func (*Template) AfterSave Uses

func (t *Template) AfterSave()

func (*Template) BeforeDelete Uses

func (t *Template) BeforeDelete() error

func (*Template) BeforeSave Uses

func (t *Template) BeforeSave() error

func (*Template) Indexes Uses

func (p *Template) Indexes() map[string]index.Maker

func (*Template) Locks Uses

func (t *Template) Locks(action string) []string

func (*Template) New Uses

func (t *Template) New() store.KeySaver

func (*Template) OnLoad Uses

func (t *Template) OnLoad() error

func (*Template) SaveClean Uses

func (obj *Template) SaveClean() store.KeySaver

func (*Template) SetReadOnly Uses

func (obj *Template) SetReadOnly(b bool)

func (*Template) Validate Uses

func (t *Template) Validate()

type User Uses

type User struct {
    *models.User
    // contains filtered or unexported fields
}

User is an API user of DigitalRebar Provision swagger:model

func AsUser Uses

func AsUser(o models.Model) *User

func AsUsers Uses

func AsUsers(o []models.Model) []*User

func (*User) BeforeSave Uses

func (u *User) BeforeSave() error

func (*User) ChangePassword Uses

func (u *User) ChangePassword(rt *RequestTracker, newPass string) error

func (*User) Indexes Uses

func (p *User) Indexes() map[string]index.Maker

func (*User) Locks Uses

func (u *User) Locks(action string) []string

func (*User) New Uses

func (u *User) New() store.KeySaver

func (*User) OnLoad Uses

func (u *User) OnLoad() error

func (*User) SaveClean Uses

func (obj *User) SaveClean() store.KeySaver

func (*User) SetReadOnly Uses

func (obj *User) SetReadOnly(b bool)

func (*User) Validate Uses

func (u *User) Validate()

type Workflow Uses

type Workflow struct {
    *models.Workflow
    // contains filtered or unexported fields
}

func AsWorkflow Uses

func AsWorkflow(o models.Model) *Workflow

func AsWorkflows Uses

func AsWorkflows(o []models.Model) []*Workflow

func (*Workflow) BeforeSave Uses

func (w *Workflow) BeforeSave() error

func (*Workflow) Indexes Uses

func (w *Workflow) Indexes() map[string]index.Maker

func (*Workflow) Locks Uses

func (w *Workflow) Locks(action string) []string

func (*Workflow) New Uses

func (w *Workflow) New() store.KeySaver

func (*Workflow) OnLoad Uses

func (w *Workflow) OnLoad() error

func (*Workflow) SaveClean Uses

func (w *Workflow) SaveClean() store.KeySaver

func (*Workflow) SetReadOnly Uses

func (w *Workflow) SetReadOnly(b bool)

func (*Workflow) Validate Uses

func (w *Workflow) Validate()

Directories

PathSynopsis
index

Package backend imports 44 packages (graph) and is imported by 3 packages. Updated 2018-04-27. Refresh now. Tools for package owners.