Documentation ¶
Overview ¶
Package nebraska implements a fake Omaha server based on "nebraska.py".
Index ¶
Constants ¶
const Script = "/opt/tls/fake_omaha/nebraska.py"
Script is the path of nebraska.py. Currently we download and build 'nebraska.py' into drone images at this path. TODO(guocb): Package 'nebraska.py' as part of TLS implementation.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { CriticalUpdate bool `json:"critical_update"` ReturnNoupdateStarting int `json:"return_noupdate_starting"` }
Config is the Nebraska configurations.
type Environment ¶
type Environment interface { // DownloadMetadata downloads update metadata for specified build and type // of payloads from GS to a temporary directory and returns the path of it. // It is the caller's responsibility to remove the temporary directory after // use. DownloadMetadata(ctx context.Context, gsPathPrefix string, payloads []*tls.FakeOmaha_Payload) (string, error) StartNebraska([]string) (Process, error) }
Environment is the runtime dependencies, e.g. networking, etc. of the implementation. The main goal of it is for unit test.
func NewEnvironment ¶
func NewEnvironment() Environment
NewEnvironment returns a new instance of Environment that talks to GS and runs a real nebraska process.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server represents a running instance of 'nebraska.py'.
func NewServer ¶
func NewServer(ctx context.Context, env Environment, gsPathPrefix string, payloads []*tls.FakeOmaha_Payload, updatePayloadsAddress string) (*Server, error)
NewServer starts a Nebraska process and returns a new instance of Server. gsPathPrefix is the GS path to the build of the update, e.g. "gs://chromeos-image-archive/banjo-release/R90-13809.0.0". The update metadata must exist there, so we can download them by appending the file name to this prefix. updatePayloadsAddress is the cache server URL from which we can download payloads, e.g. "http://<server>:<port>/download/banjo-release/R90-13809.0.0".
func (*Server) Close ¶
Close terminates the nebraska server process and cleans up all temp dirs/files. This function is not concurrency safe.
func (*Server) UpdateConfig ¶
UpdateConfig configures the started Nebraska.