id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
listlengths
21
1.41k
docstring
stringlengths
6
2.61k
docstring_tokens
listlengths
3
215
sha
stringlengths
40
40
url
stringlengths
85
252
4,000
juju/juju
state/controlleruser.go
setControllerAccess
func (st *State) setControllerAccess(access permission.Access, userGlobalKey string) error { if err := permission.ValidateControllerAccess(access); err != nil { return errors.Trace(err) } op := updatePermissionOp(controllerKey(st.ControllerUUID()), userGlobalKey, access) err := st.db().RunTransaction([]txn.Op{op...
go
func (st *State) setControllerAccess(access permission.Access, userGlobalKey string) error { if err := permission.ValidateControllerAccess(access); err != nil { return errors.Trace(err) } op := updatePermissionOp(controllerKey(st.ControllerUUID()), userGlobalKey, access) err := st.db().RunTransaction([]txn.Op{op...
[ "func", "(", "st", "*", "State", ")", "setControllerAccess", "(", "access", "permission", ".", "Access", ",", "userGlobalKey", "string", ")", "error", "{", "if", "err", ":=", "permission", ".", "ValidateControllerAccess", "(", "access", ")", ";", "err", "!="...
// setAccess changes the user's access permissions on the controller.
[ "setAccess", "changes", "the", "user", "s", "access", "permissions", "on", "the", "controller", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/controlleruser.go#L22-L33
4,001
juju/juju
state/controlleruser.go
controllerUser
func (st *State) controllerUser(user names.UserTag) (userAccessDoc, error) { controllerUser := userAccessDoc{} controllerUsers, closer := st.db().GetCollection(controllerUsersC) defer closer() username := strings.ToLower(user.Id()) err := controllerUsers.FindId(username).One(&controllerUser) if err == mgo.ErrNot...
go
func (st *State) controllerUser(user names.UserTag) (userAccessDoc, error) { controllerUser := userAccessDoc{} controllerUsers, closer := st.db().GetCollection(controllerUsersC) defer closer() username := strings.ToLower(user.Id()) err := controllerUsers.FindId(username).One(&controllerUser) if err == mgo.ErrNot...
[ "func", "(", "st", "*", "State", ")", "controllerUser", "(", "user", "names", ".", "UserTag", ")", "(", "userAccessDoc", ",", "error", ")", "{", "controllerUser", ":=", "userAccessDoc", "{", "}", "\n", "controllerUsers", ",", "closer", ":=", "st", ".", "...
// controllerUser a model userAccessDoc.
[ "controllerUser", "a", "model", "userAccessDoc", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/controlleruser.go#L36-L50
4,002
juju/juju
state/controlleruser.go
removeControllerUser
func (st *State) removeControllerUser(user names.UserTag) error { ops := removeControllerUserOps(st.ControllerUUID(), user) err := st.db().RunTransaction(ops) if err == txn.ErrAborted { err = errors.NewNotFound(nil, fmt.Sprintf("controller user %q does not exist", user.Id())) } if err != nil { return errors.Tr...
go
func (st *State) removeControllerUser(user names.UserTag) error { ops := removeControllerUserOps(st.ControllerUUID(), user) err := st.db().RunTransaction(ops) if err == txn.ErrAborted { err = errors.NewNotFound(nil, fmt.Sprintf("controller user %q does not exist", user.Id())) } if err != nil { return errors.Tr...
[ "func", "(", "st", "*", "State", ")", "removeControllerUser", "(", "user", "names", ".", "UserTag", ")", "error", "{", "ops", ":=", "removeControllerUserOps", "(", "st", ".", "ControllerUUID", "(", ")", ",", "user", ")", "\n", "err", ":=", "st", ".", "...
// RemoveControllerUser removes a user from the database.
[ "RemoveControllerUser", "removes", "a", "user", "from", "the", "database", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/controlleruser.go#L87-L97
4,003
juju/juju
api/backups/info.go
Info
func (c *Client) Info(id string) (*params.BackupsMetadataResult, error) { var result params.BackupsMetadataResult args := params.BackupsInfoArgs{ID: id} if err := c.facade.FacadeCall("Info", args, &result); err != nil { return nil, errors.Trace(err) } return &result, nil }
go
func (c *Client) Info(id string) (*params.BackupsMetadataResult, error) { var result params.BackupsMetadataResult args := params.BackupsInfoArgs{ID: id} if err := c.facade.FacadeCall("Info", args, &result); err != nil { return nil, errors.Trace(err) } return &result, nil }
[ "func", "(", "c", "*", "Client", ")", "Info", "(", "id", "string", ")", "(", "*", "params", ".", "BackupsMetadataResult", ",", "error", ")", "{", "var", "result", "params", ".", "BackupsMetadataResult", "\n", "args", ":=", "params", ".", "BackupsInfoArgs",...
// Info implements the API method.
[ "Info", "implements", "the", "API", "method", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/backups/info.go#L13-L20
4,004
juju/juju
apiserver/facades/client/application/get.go
Get
func (api *APIv5) Get(args params.ApplicationGet) (params.ApplicationGetResults, error) { results, err := api.getConfig(args, describe) if err != nil { return params.ApplicationGetResults{}, err } results.ApplicationConfig = nil return results, nil }
go
func (api *APIv5) Get(args params.ApplicationGet) (params.ApplicationGetResults, error) { results, err := api.getConfig(args, describe) if err != nil { return params.ApplicationGetResults{}, err } results.ApplicationConfig = nil return results, nil }
[ "func", "(", "api", "*", "APIv5", ")", "Get", "(", "args", "params", ".", "ApplicationGet", ")", "(", "params", ".", "ApplicationGetResults", ",", "error", ")", "{", "results", ",", "err", ":=", "api", ".", "getConfig", "(", "args", ",", "describe", ")...
// Get returns the charm configuration for an application. // It zeros out any application config as that was not supported in v5.
[ "Get", "returns", "the", "charm", "configuration", "for", "an", "application", ".", "It", "zeros", "out", "any", "application", "config", "as", "that", "was", "not", "supported", "in", "v5", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/client/application/get.go#L25-L32
4,005
juju/juju
apiserver/facades/client/application/get.go
Get
func (api *APIv4) Get(args params.ApplicationGet) (params.ApplicationGetResults, error) { results, err := api.getConfig(args, describeV4) if err != nil { return params.ApplicationGetResults{}, err } results.ApplicationConfig = nil return results, nil }
go
func (api *APIv4) Get(args params.ApplicationGet) (params.ApplicationGetResults, error) { results, err := api.getConfig(args, describeV4) if err != nil { return params.ApplicationGetResults{}, err } results.ApplicationConfig = nil return results, nil }
[ "func", "(", "api", "*", "APIv4", ")", "Get", "(", "args", "params", ".", "ApplicationGet", ")", "(", "params", ".", "ApplicationGetResults", ",", "error", ")", "{", "results", ",", "err", ":=", "api", ".", "getConfig", "(", "args", ",", "describeV4", ...
// Get returns the charm configuration for an application. // This used the confusing "default" boolean to mean the value was set from // the charm defaults. Needs to be kept for backwards compatibility.
[ "Get", "returns", "the", "charm", "configuration", "for", "an", "application", ".", "This", "used", "the", "confusing", "default", "boolean", "to", "mean", "the", "value", "was", "set", "from", "the", "charm", "defaults", ".", "Needs", "to", "be", "kept", ...
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/client/application/get.go#L37-L44
4,006
juju/juju
state/useraccess.go
AddUser
func (m *Model) AddUser(spec UserAccessSpec) (permission.UserAccess, error) { if err := permission.ValidateModelAccess(spec.Access); err != nil { return permission.UserAccess{}, errors.Annotate(err, "adding model user") } target := userAccessTarget{ uuid: m.UUID(), globalKey: modelGlobalKey, } return m....
go
func (m *Model) AddUser(spec UserAccessSpec) (permission.UserAccess, error) { if err := permission.ValidateModelAccess(spec.Access); err != nil { return permission.UserAccess{}, errors.Annotate(err, "adding model user") } target := userAccessTarget{ uuid: m.UUID(), globalKey: modelGlobalKey, } return m....
[ "func", "(", "m", "*", "Model", ")", "AddUser", "(", "spec", "UserAccessSpec", ")", "(", "permission", ".", "UserAccess", ",", "error", ")", "{", "if", "err", ":=", "permission", ".", "ValidateModelAccess", "(", "spec", ".", "Access", ")", ";", "err", ...
// AddUser adds a new user for the model to the database.
[ "AddUser", "adds", "a", "new", "user", "for", "the", "model", "to", "the", "database", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/useraccess.go#L43-L52
4,007
juju/juju
state/useraccess.go
AddControllerUser
func (st *State) AddControllerUser(spec UserAccessSpec) (permission.UserAccess, error) { if err := permission.ValidateControllerAccess(spec.Access); err != nil { return permission.UserAccess{}, errors.Annotate(err, "adding controller user") } return st.addUserAccess(spec, userAccessTarget{globalKey: controllerGlob...
go
func (st *State) AddControllerUser(spec UserAccessSpec) (permission.UserAccess, error) { if err := permission.ValidateControllerAccess(spec.Access); err != nil { return permission.UserAccess{}, errors.Annotate(err, "adding controller user") } return st.addUserAccess(spec, userAccessTarget{globalKey: controllerGlob...
[ "func", "(", "st", "*", "State", ")", "AddControllerUser", "(", "spec", "UserAccessSpec", ")", "(", "permission", ".", "UserAccess", ",", "error", ")", "{", "if", "err", ":=", "permission", ".", "ValidateControllerAccess", "(", "spec", ".", "Access", ")", ...
// AddControllerUser adds a new user for the current controller to the database.
[ "AddControllerUser", "adds", "a", "new", "user", "for", "the", "current", "controller", "to", "the", "database", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/useraccess.go#L55-L60
4,008
juju/juju
state/useraccess.go
userAccessID
func userAccessID(user names.UserTag) string { username := user.Id() return strings.ToLower(username) }
go
func userAccessID(user names.UserTag) string { username := user.Id() return strings.ToLower(username) }
[ "func", "userAccessID", "(", "user", "names", ".", "UserTag", ")", "string", "{", "username", ":=", "user", ".", "Id", "(", ")", "\n", "return", "strings", ".", "ToLower", "(", "username", ")", "\n", "}" ]
// userAccessID returns the document id of the user access.
[ "userAccessID", "returns", "the", "document", "id", "of", "the", "user", "access", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/useraccess.go#L118-L121
4,009
juju/juju
state/useraccess.go
NewModelUserAccess
func NewModelUserAccess(st *State, userDoc userAccessDoc) (permission.UserAccess, error) { perm, err := st.userPermission(modelKey(userDoc.ObjectUUID), userGlobalKey(strings.ToLower(userDoc.UserName))) if err != nil { return permission.UserAccess{}, errors.Annotate(err, "obtaining model permission") } return newU...
go
func NewModelUserAccess(st *State, userDoc userAccessDoc) (permission.UserAccess, error) { perm, err := st.userPermission(modelKey(userDoc.ObjectUUID), userGlobalKey(strings.ToLower(userDoc.UserName))) if err != nil { return permission.UserAccess{}, errors.Annotate(err, "obtaining model permission") } return newU...
[ "func", "NewModelUserAccess", "(", "st", "*", "State", ",", "userDoc", "userAccessDoc", ")", "(", "permission", ".", "UserAccess", ",", "error", ")", "{", "perm", ",", "err", ":=", "st", ".", "userPermission", "(", "modelKey", "(", "userDoc", ".", "ObjectU...
// NewModelUserAccess returns a new permission.UserAccess for the given userDoc and // current Model.
[ "NewModelUserAccess", "returns", "a", "new", "permission", ".", "UserAccess", "for", "the", "given", "userDoc", "and", "current", "Model", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/useraccess.go#L125-L131
4,010
juju/juju
state/useraccess.go
NewControllerUserAccess
func NewControllerUserAccess(st *State, userDoc userAccessDoc) (permission.UserAccess, error) { perm, err := st.userPermission(controllerKey(st.ControllerUUID()), userGlobalKey(strings.ToLower(userDoc.UserName))) if err != nil { return permission.UserAccess{}, errors.Annotate(err, "obtaining controller permission")...
go
func NewControllerUserAccess(st *State, userDoc userAccessDoc) (permission.UserAccess, error) { perm, err := st.userPermission(controllerKey(st.ControllerUUID()), userGlobalKey(strings.ToLower(userDoc.UserName))) if err != nil { return permission.UserAccess{}, errors.Annotate(err, "obtaining controller permission")...
[ "func", "NewControllerUserAccess", "(", "st", "*", "State", ",", "userDoc", "userAccessDoc", ")", "(", "permission", ".", "UserAccess", ",", "error", ")", "{", "perm", ",", "err", ":=", "st", ".", "userPermission", "(", "controllerKey", "(", "st", ".", "Co...
// NewControllerUserAccess returns a new permission.UserAccess for the given userDoc and // current Controller.
[ "NewControllerUserAccess", "returns", "a", "new", "permission", ".", "UserAccess", "for", "the", "given", "userDoc", "and", "current", "Controller", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/useraccess.go#L135-L141
4,011
juju/juju
state/useraccess.go
UserPermission
func (st *State) UserPermission(subject names.UserTag, target names.Tag) (permission.Access, error) { if err := st.userMayHaveAccess(subject); err != nil { return "", errors.Trace(err) } switch target.Kind() { case names.ModelTagKind, names.ControllerTagKind: access, err := st.UserAccess(subject, target) if ...
go
func (st *State) UserPermission(subject names.UserTag, target names.Tag) (permission.Access, error) { if err := st.userMayHaveAccess(subject); err != nil { return "", errors.Trace(err) } switch target.Kind() { case names.ModelTagKind, names.ControllerTagKind: access, err := st.UserAccess(subject, target) if ...
[ "func", "(", "st", "*", "State", ")", "UserPermission", "(", "subject", "names", ".", "UserTag", ",", "target", "names", ".", "Tag", ")", "(", "permission", ".", "Access", ",", "error", ")", "{", "if", "err", ":=", "st", ".", "userMayHaveAccess", "(", ...
// UserPermission returns the access permission for the passed subject and target.
[ "UserPermission", "returns", "the", "access", "permission", "for", "the", "passed", "subject", "and", "target", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/useraccess.go#L144-L167
4,012
juju/juju
state/useraccess.go
UserAccess
func (st *State) UserAccess(subject names.UserTag, target names.Tag) (permission.UserAccess, error) { if err := st.userMayHaveAccess(subject); err != nil { return permission.UserAccess{}, errors.Trace(err) } var ( userDoc userAccessDoc err error ) switch target.Kind() { case names.ModelTagKind: userD...
go
func (st *State) UserAccess(subject names.UserTag, target names.Tag) (permission.UserAccess, error) { if err := st.userMayHaveAccess(subject); err != nil { return permission.UserAccess{}, errors.Trace(err) } var ( userDoc userAccessDoc err error ) switch target.Kind() { case names.ModelTagKind: userD...
[ "func", "(", "st", "*", "State", ")", "UserAccess", "(", "subject", "names", ".", "UserTag", ",", "target", "names", ".", "Tag", ")", "(", "permission", ".", "UserAccess", ",", "error", ")", "{", "if", "err", ":=", "st", ".", "userMayHaveAccess", "(", ...
// UserAccess returns a new permission.UserAccess for the passed subject and target.
[ "UserAccess", "returns", "a", "new", "permission", ".", "UserAccess", "for", "the", "passed", "subject", "and", "target", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/useraccess.go#L199-L223
4,013
juju/juju
state/useraccess.go
RemoveUserAccess
func (st *State) RemoveUserAccess(subject names.UserTag, target names.Tag) error { switch target.Kind() { case names.ModelTagKind: return errors.Trace(st.removeModelUser(subject)) case names.ControllerTagKind: return errors.Trace(st.removeControllerUser(subject)) } return errors.NotValidf("%q as a target", tar...
go
func (st *State) RemoveUserAccess(subject names.UserTag, target names.Tag) error { switch target.Kind() { case names.ModelTagKind: return errors.Trace(st.removeModelUser(subject)) case names.ControllerTagKind: return errors.Trace(st.removeControllerUser(subject)) } return errors.NotValidf("%q as a target", tar...
[ "func", "(", "st", "*", "State", ")", "RemoveUserAccess", "(", "subject", "names", ".", "UserTag", ",", "target", "names", ".", "Tag", ")", "error", "{", "switch", "target", ".", "Kind", "(", ")", "{", "case", "names", ".", "ModelTagKind", ":", "return...
// RemoveUserAccess removes access for subject to the passed tag.
[ "RemoveUserAccess", "removes", "access", "for", "subject", "to", "the", "passed", "tag", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/useraccess.go#L246-L254
4,014
juju/juju
worker/provisioner/provisioner_task.go
populateMachineMaps
func (task *provisionerTask) populateMachineMaps(ids []string) error { task.instances = make(map[instance.Id]instances.Instance) instances, err := task.broker.AllInstances(task.cloudCallCtx) if err != nil { return errors.Annotate(err, "failed to get all instances from broker") } for _, i := range instances { ...
go
func (task *provisionerTask) populateMachineMaps(ids []string) error { task.instances = make(map[instance.Id]instances.Instance) instances, err := task.broker.AllInstances(task.cloudCallCtx) if err != nil { return errors.Annotate(err, "failed to get all instances from broker") } for _, i := range instances { ...
[ "func", "(", "task", "*", "provisionerTask", ")", "populateMachineMaps", "(", "ids", "[", "]", "string", ")", "error", "{", "task", ".", "instances", "=", "make", "(", "map", "[", "instance", ".", "Id", "]", "instances", ".", "Instance", ")", "\n\n", "...
// populateMachineMaps updates task.instances. Also updates // task.machines map if a list of IDs is given.
[ "populateMachineMaps", "updates", "task", ".", "instances", ".", "Also", "updates", "task", ".", "machines", "map", "if", "a", "list", "of", "IDs", "is", "given", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/provisioner/provisioner_task.go#L337-L372
4,015
juju/juju
worker/provisioner/provisioner_task.go
pendingOrDeadOrMaintain
func (task *provisionerTask) pendingOrDeadOrMaintain(ids []string) (pending, dead, maintain []apiprovisioner.MachineProvisioner, err error) { task.machinesMutex.RLock() defer task.machinesMutex.RUnlock() for _, id := range ids { machine, found := task.machines[id] if !found { logger.Infof("machine %q not foun...
go
func (task *provisionerTask) pendingOrDeadOrMaintain(ids []string) (pending, dead, maintain []apiprovisioner.MachineProvisioner, err error) { task.machinesMutex.RLock() defer task.machinesMutex.RUnlock() for _, id := range ids { machine, found := task.machines[id] if !found { logger.Infof("machine %q not foun...
[ "func", "(", "task", "*", "provisionerTask", ")", "pendingOrDeadOrMaintain", "(", "ids", "[", "]", "string", ")", "(", "pending", ",", "dead", ",", "maintain", "[", "]", "apiprovisioner", ".", "MachineProvisioner", ",", "err", "error", ")", "{", "task", "....
// pendingOrDead looks up machines with ids and returns those that do not // have an instance id assigned yet, and also those that are dead.
[ "pendingOrDead", "looks", "up", "machines", "with", "ids", "and", "returns", "those", "that", "do", "not", "have", "an", "instance", "id", "assigned", "yet", "and", "also", "those", "that", "are", "dead", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/provisioner/provisioner_task.go#L376-L402
4,016
juju/juju
worker/provisioner/provisioner_task.go
findUnknownInstances
func (task *provisionerTask) findUnknownInstances(stopping []instances.Instance) ([]instances.Instance, error) { // Make a copy of the instances we know about. taskInstances := make(map[instance.Id]instances.Instance) for k, v := range task.instances { taskInstances[k] = v } task.machinesMutex.RLock() defer ta...
go
func (task *provisionerTask) findUnknownInstances(stopping []instances.Instance) ([]instances.Instance, error) { // Make a copy of the instances we know about. taskInstances := make(map[instance.Id]instances.Instance) for k, v := range task.instances { taskInstances[k] = v } task.machinesMutex.RLock() defer ta...
[ "func", "(", "task", "*", "provisionerTask", ")", "findUnknownInstances", "(", "stopping", "[", "]", "instances", ".", "Instance", ")", "(", "[", "]", "instances", ".", "Instance", ",", "error", ")", "{", "// Make a copy of the instances we know about.", "taskInst...
// findUnknownInstances finds instances which are not associated with a machine.
[ "findUnknownInstances", "finds", "instances", "which", "are", "not", "associated", "with", "a", "machine", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/provisioner/provisioner_task.go#L473-L503
4,017
juju/juju
worker/provisioner/provisioner_task.go
instancesForDeadMachines
func (task *provisionerTask) instancesForDeadMachines(deadMachines []apiprovisioner.MachineProvisioner) []instances.Instance { var instances []instances.Instance for _, machine := range deadMachines { instId, err := machine.InstanceId() if err == nil { keep, _ := machine.KeepInstance() if keep { logger....
go
func (task *provisionerTask) instancesForDeadMachines(deadMachines []apiprovisioner.MachineProvisioner) []instances.Instance { var instances []instances.Instance for _, machine := range deadMachines { instId, err := machine.InstanceId() if err == nil { keep, _ := machine.KeepInstance() if keep { logger....
[ "func", "(", "task", "*", "provisionerTask", ")", "instancesForDeadMachines", "(", "deadMachines", "[", "]", "apiprovisioner", ".", "MachineProvisioner", ")", "[", "]", "instances", ".", "Instance", "{", "var", "instances", "[", "]", "instances", ".", "Instance"...
// instancesForDeadMachines returns a list of instances.Instance that represent // the list of dead machines running in the provider. Missing machines are // omitted from the list.
[ "instancesForDeadMachines", "returns", "a", "list", "of", "instances", ".", "Instance", "that", "represent", "the", "list", "of", "dead", "machines", "running", "in", "the", "provider", ".", "Missing", "machines", "are", "omitted", "from", "the", "list", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/provisioner/provisioner_task.go#L508-L526
4,018
juju/juju
worker/provisioner/provisioner_task.go
populateAvailabilityZoneMachines
func (task *provisionerTask) populateAvailabilityZoneMachines() error { task.machinesMutex.Lock() defer task.machinesMutex.Unlock() if len(task.availabilityZoneMachines) > 0 { return nil } zonedEnv, ok := task.broker.(providercommon.ZonedEnviron) if !ok { return nil } // In this case, AvailabilityZoneAllo...
go
func (task *provisionerTask) populateAvailabilityZoneMachines() error { task.machinesMutex.Lock() defer task.machinesMutex.Unlock() if len(task.availabilityZoneMachines) > 0 { return nil } zonedEnv, ok := task.broker.(providercommon.ZonedEnviron) if !ok { return nil } // In this case, AvailabilityZoneAllo...
[ "func", "(", "task", "*", "provisionerTask", ")", "populateAvailabilityZoneMachines", "(", ")", "error", "{", "task", ".", "machinesMutex", ".", "Lock", "(", ")", "\n", "defer", "task", ".", "machinesMutex", ".", "Unlock", "(", ")", "\n\n", "if", "len", "(...
// populateAvailabilityZoneMachines fills in the map, availabilityZoneMachines, // if empty, with a current mapping of availability zone to IDs of machines // running in that zone. If the provider does not implement the ZonedEnviron // interface, return nil.
[ "populateAvailabilityZoneMachines", "fills", "in", "the", "map", "availabilityZoneMachines", "if", "empty", "with", "a", "current", "mapping", "of", "availability", "zone", "to", "IDs", "of", "machines", "running", "in", "that", "zone", ".", "If", "the", "provider...
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/provisioner/provisioner_task.go#L756-L803
4,019
juju/juju
worker/provisioner/provisioner_task.go
populateDistributionGroupZoneMap
func (task *provisionerTask) populateDistributionGroupZoneMap(machineIds []string) []*AvailabilityZoneMachine { var dgAvailabilityZoneMachines []*AvailabilityZoneMachine dgSet := set.NewStrings(machineIds...) for _, azm := range task.availabilityZoneMachines { dgAvailabilityZoneMachines = append(dgAvailabilityZone...
go
func (task *provisionerTask) populateDistributionGroupZoneMap(machineIds []string) []*AvailabilityZoneMachine { var dgAvailabilityZoneMachines []*AvailabilityZoneMachine dgSet := set.NewStrings(machineIds...) for _, azm := range task.availabilityZoneMachines { dgAvailabilityZoneMachines = append(dgAvailabilityZone...
[ "func", "(", "task", "*", "provisionerTask", ")", "populateDistributionGroupZoneMap", "(", "machineIds", "[", "]", "string", ")", "[", "]", "*", "AvailabilityZoneMachine", "{", "var", "dgAvailabilityZoneMachines", "[", "]", "*", "AvailabilityZoneMachine", "\n", "dgS...
// populateDistributionGroupZoneMap returns a zone mapping which only includes // machines in the same distribution group. This is used to determine where new // machines in that distribution group should be placed.
[ "populateDistributionGroupZoneMap", "returns", "a", "zone", "mapping", "which", "only", "includes", "machines", "in", "the", "same", "distribution", "group", ".", "This", "is", "used", "to", "determine", "where", "new", "machines", "in", "that", "distribution", "g...
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/provisioner/provisioner_task.go#L808-L820
4,020
juju/juju
worker/provisioner/provisioner_task.go
machineAvailabilityZoneDistribution
func (task *provisionerTask) machineAvailabilityZoneDistribution( machineId string, distGroupMachineIds []string, cons constraints.Value, ) (string, error) { task.machinesMutex.Lock() defer task.machinesMutex.Unlock() if len(task.availabilityZoneMachines) == 0 { return "", nil } // Assign an initial zone to a...
go
func (task *provisionerTask) machineAvailabilityZoneDistribution( machineId string, distGroupMachineIds []string, cons constraints.Value, ) (string, error) { task.machinesMutex.Lock() defer task.machinesMutex.Unlock() if len(task.availabilityZoneMachines) == 0 { return "", nil } // Assign an initial zone to a...
[ "func", "(", "task", "*", "provisionerTask", ")", "machineAvailabilityZoneDistribution", "(", "machineId", "string", ",", "distGroupMachineIds", "[", "]", "string", ",", "cons", "constraints", ".", "Value", ",", ")", "(", "string", ",", "error", ")", "{", "tas...
// machineAvailabilityZoneDistribution returns a suggested availability zone // for the specified machine to start in. // If the current provider does not implement availability zones, "" and no // error will be returned. // Machines are spread across availability zones based on lowest population of // the "available" ...
[ "machineAvailabilityZoneDistribution", "returns", "a", "suggested", "availability", "zone", "for", "the", "specified", "machine", "to", "start", "in", ".", "If", "the", "current", "provider", "does", "not", "implement", "availability", "zones", "and", "no", "error",...
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/provisioner/provisioner_task.go#L832-L879
4,021
juju/juju
worker/provisioner/provisioner_task.go
FilterZones
func (a azMachineFilterSort) FilterZones(cons constraints.Value) azMachineFilterSort { if !cons.HasZones() { return a } logger.Debugf("applying availability zone constraints: %s", strings.Join(*cons.Zones, ", ")) filtered := a[:0] for _, azm := range a { for _, zone := range *cons.Zones { if azm.ZoneName =...
go
func (a azMachineFilterSort) FilterZones(cons constraints.Value) azMachineFilterSort { if !cons.HasZones() { return a } logger.Debugf("applying availability zone constraints: %s", strings.Join(*cons.Zones, ", ")) filtered := a[:0] for _, azm := range a { for _, zone := range *cons.Zones { if azm.ZoneName =...
[ "func", "(", "a", "azMachineFilterSort", ")", "FilterZones", "(", "cons", "constraints", ".", "Value", ")", "azMachineFilterSort", "{", "if", "!", "cons", ".", "HasZones", "(", ")", "{", "return", "a", "\n", "}", "\n\n", "logger", ".", "Debugf", "(", "\"...
// FilterZones returns a new instance consisting of slice members limited to // zones expressed in the input constraints. // Absence of zone constraints leaves the return unfiltered.
[ "FilterZones", "returns", "a", "new", "instance", "consisting", "of", "slice", "members", "limited", "to", "zones", "expressed", "in", "the", "input", "constraints", ".", "Absence", "of", "zone", "constraints", "leaves", "the", "return", "unfiltered", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/provisioner/provisioner_task.go#L889-L905
4,022
juju/juju
worker/provisioner/provisioner_task.go
startMachines
func (task *provisionerTask) startMachines(machines []apiprovisioner.MachineProvisioner) error { if len(machines) == 0 { return nil } // Get the distributionGroups for each machine now to avoid // successive calls to DistributionGroupByMachineId which will // return the same data. machineTags := make([]names.M...
go
func (task *provisionerTask) startMachines(machines []apiprovisioner.MachineProvisioner) error { if len(machines) == 0 { return nil } // Get the distributionGroups for each machine now to avoid // successive calls to DistributionGroupByMachineId which will // return the same data. machineTags := make([]names.M...
[ "func", "(", "task", "*", "provisionerTask", ")", "startMachines", "(", "machines", "[", "]", "apiprovisioner", ".", "MachineProvisioner", ")", "error", "{", "if", "len", "(", "machines", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n\n", "// Get the...
// startMachines starts a goroutine for each specified machine to // start it. Errors from individual start machine attempts will be logged.
[ "startMachines", "starts", "a", "goroutine", "for", "each", "specified", "machine", "to", "start", "it", ".", "Errors", "from", "individual", "start", "machine", "attempts", "will", "be", "logged", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/provisioner/provisioner_task.go#L927-L980
4,023
juju/juju
worker/provisioner/provisioner_task.go
setupToStartMachine
func (task *provisionerTask) setupToStartMachine(machine apiprovisioner.MachineProvisioner, version *version.Number) ( environs.StartInstanceParams, error, ) { pInfo, err := machine.ProvisioningInfo() if err != nil { return environs.StartInstanceParams{}, errors.Annotatef(err, "fetching provisioning info for mach...
go
func (task *provisionerTask) setupToStartMachine(machine apiprovisioner.MachineProvisioner, version *version.Number) ( environs.StartInstanceParams, error, ) { pInfo, err := machine.ProvisioningInfo() if err != nil { return environs.StartInstanceParams{}, errors.Annotatef(err, "fetching provisioning info for mach...
[ "func", "(", "task", "*", "provisionerTask", ")", "setupToStartMachine", "(", "machine", "apiprovisioner", ".", "MachineProvisioner", ",", "version", "*", "version", ".", "Number", ")", "(", "environs", ".", "StartInstanceParams", ",", "error", ",", ")", "{", ...
// setupToStartMachine gathers the necessary information, // based on the specified machine, to create ProvisioningInfo // and StartInstanceParams to be used by startMachine.
[ "setupToStartMachine", "gathers", "the", "necessary", "information", "based", "on", "the", "specified", "machine", "to", "create", "ProvisioningInfo", "and", "StartInstanceParams", "to", "be", "used", "by", "startMachine", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/provisioner/provisioner_task.go#L995-L1037
4,024
juju/juju
worker/provisioner/provisioner_task.go
populateExcludedMachines
func (task *provisionerTask) populateExcludedMachines(machineId string, startInstanceParams environs.StartInstanceParams) error { zonedEnv, ok := task.broker.(providercommon.ZonedEnviron) if !ok { return nil } derivedZones, err := zonedEnv.DeriveAvailabilityZones(task.cloudCallCtx, startInstanceParams) if err !=...
go
func (task *provisionerTask) populateExcludedMachines(machineId string, startInstanceParams environs.StartInstanceParams) error { zonedEnv, ok := task.broker.(providercommon.ZonedEnviron) if !ok { return nil } derivedZones, err := zonedEnv.DeriveAvailabilityZones(task.cloudCallCtx, startInstanceParams) if err !=...
[ "func", "(", "task", "*", "provisionerTask", ")", "populateExcludedMachines", "(", "machineId", "string", ",", "startInstanceParams", "environs", ".", "StartInstanceParams", ")", "error", "{", "zonedEnv", ",", "ok", ":=", "task", ".", "broker", ".", "(", "provid...
// populateExcludedMachines, translates the results of DeriveAvailabilityZones // into availabilityZoneMachines.ExcludedMachineIds for machines not to be used // in the given zone.
[ "populateExcludedMachines", "translates", "the", "results", "of", "DeriveAvailabilityZones", "into", "availabilityZoneMachines", ".", "ExcludedMachineIds", "for", "machines", "not", "to", "be", "used", "in", "the", "given", "zone", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/provisioner/provisioner_task.go#L1042-L1063
4,025
juju/juju
worker/provisioner/provisioner_task.go
gatherCharmLXDProfiles
func (task *provisionerTask) gatherCharmLXDProfiles(instanceId, machineTag string, machineProfiles []string) []string { if names.IsContainerMachine(machineTag) { if manager, ok := task.broker.(container.LXDProfileNameRetriever); ok { if profileNames, err := manager.LXDProfileNames(instanceId); err == nil { re...
go
func (task *provisionerTask) gatherCharmLXDProfiles(instanceId, machineTag string, machineProfiles []string) []string { if names.IsContainerMachine(machineTag) { if manager, ok := task.broker.(container.LXDProfileNameRetriever); ok { if profileNames, err := manager.LXDProfileNames(instanceId); err == nil { re...
[ "func", "(", "task", "*", "provisionerTask", ")", "gatherCharmLXDProfiles", "(", "instanceId", ",", "machineTag", "string", ",", "machineProfiles", "[", "]", "string", ")", "[", "]", "string", "{", "if", "names", ".", "IsContainerMachine", "(", "machineTag", "...
// gatherCharmLXDProfiles consumes the charms LXD Profiles from the different // sources. This includes getting the information from the broker.
[ "gatherCharmLXDProfiles", "consumes", "the", "charms", "LXD", "Profiles", "from", "the", "different", "sources", ".", "This", "includes", "getting", "the", "information", "from", "the", "broker", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/provisioner/provisioner_task.go#L1219-L1230
4,026
juju/juju
worker/provisioner/provisioner_task.go
markMachineFailedInAZ
func (task *provisionerTask) markMachineFailedInAZ(machine apiprovisioner.MachineProvisioner, zone string) (bool, error) { if zone == "" { return false, errors.New("no zone provided") } task.machinesMutex.Lock() defer task.machinesMutex.Unlock() azRemaining := false for _, zoneMachines := range task.availabilit...
go
func (task *provisionerTask) markMachineFailedInAZ(machine apiprovisioner.MachineProvisioner, zone string) (bool, error) { if zone == "" { return false, errors.New("no zone provided") } task.machinesMutex.Lock() defer task.machinesMutex.Unlock() azRemaining := false for _, zoneMachines := range task.availabilit...
[ "func", "(", "task", "*", "provisionerTask", ")", "markMachineFailedInAZ", "(", "machine", "apiprovisioner", ".", "MachineProvisioner", ",", "zone", "string", ")", "(", "bool", ",", "error", ")", "{", "if", "zone", "==", "\"", "\"", "{", "return", "false", ...
// markMachineFailedInAZ moves the machine in zone from MachineIds to FailedMachineIds // in availabilityZoneMachines, report if there are any availability zones not failed for // the specified machine.
[ "markMachineFailedInAZ", "moves", "the", "machine", "in", "zone", "from", "MachineIds", "to", "FailedMachineIds", "in", "availabilityZoneMachines", "report", "if", "there", "are", "any", "availability", "zones", "not", "failed", "for", "the", "specified", "machine", ...
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/provisioner/provisioner_task.go#L1235-L1256
4,027
juju/juju
worker/provisioner/provisioner_task.go
removeMachineFromAZMap
func (task *provisionerTask) removeMachineFromAZMap(machine apiprovisioner.MachineProvisioner) { machineId := machine.Id() task.machinesMutex.Lock() defer task.machinesMutex.Unlock() for _, zoneMachines := range task.availabilityZoneMachines { zoneMachines.MachineIds.Remove(machineId) zoneMachines.FailedMachine...
go
func (task *provisionerTask) removeMachineFromAZMap(machine apiprovisioner.MachineProvisioner) { machineId := machine.Id() task.machinesMutex.Lock() defer task.machinesMutex.Unlock() for _, zoneMachines := range task.availabilityZoneMachines { zoneMachines.MachineIds.Remove(machineId) zoneMachines.FailedMachine...
[ "func", "(", "task", "*", "provisionerTask", ")", "removeMachineFromAZMap", "(", "machine", "apiprovisioner", ".", "MachineProvisioner", ")", "{", "machineId", ":=", "machine", ".", "Id", "(", ")", "\n", "task", ".", "machinesMutex", ".", "Lock", "(", ")", "...
// removeMachineFromAZMap removes the specified machine from availabilityZoneMachines. // It is assumed this is called when the machines are being deleted from state, or failed // provisioning.
[ "removeMachineFromAZMap", "removes", "the", "specified", "machine", "from", "availabilityZoneMachines", ".", "It", "is", "assumed", "this", "is", "called", "when", "the", "machines", "are", "being", "deleted", "from", "state", "or", "failed", "provisioning", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/provisioner/provisioner_task.go#L1281-L1289
4,028
juju/juju
cmd/modelcmd/credentials.go
GetCredentials
func GetCredentials( ctx *cmd.Context, store jujuclient.CredentialGetter, args GetCredentialsParams, ) (_ *cloud.Credential, chosenCredentialName, regionName string, _ error) { credential, credentialName, defaultRegion, err := credentialByName( store, args.Cloud.Name, args.CredentialName, ) if err != nil { r...
go
func GetCredentials( ctx *cmd.Context, store jujuclient.CredentialGetter, args GetCredentialsParams, ) (_ *cloud.Credential, chosenCredentialName, regionName string, _ error) { credential, credentialName, defaultRegion, err := credentialByName( store, args.Cloud.Name, args.CredentialName, ) if err != nil { r...
[ "func", "GetCredentials", "(", "ctx", "*", "cmd", ".", "Context", ",", "store", "jujuclient", ".", "CredentialGetter", ",", "args", "GetCredentialsParams", ",", ")", "(", "_", "*", "cloud", ".", "Credential", ",", "chosenCredentialName", ",", "regionName", "st...
// GetCredentials returns a curated set of credential values for a given cloud. // The credential key values are read from the credentials store and the provider // finalises the values to resolve things like json files. // If region is not specified, the default credential region is used.
[ "GetCredentials", "returns", "a", "curated", "set", "of", "credential", "values", "for", "a", "given", "cloud", ".", "The", "credential", "key", "values", "are", "read", "from", "the", "credentials", "store", "and", "the", "provider", "finalises", "the", "valu...
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/modelcmd/credentials.go#L44-L98
4,029
juju/juju
cmd/modelcmd/credentials.go
FinalizeFileContent
func FinalizeFileContent(credential *cloud.Credential, provider environs.EnvironProvider) (*cloud.Credential, error) { readFile := func(f string) ([]byte, error) { f, err := utils.NormalizePath(f) if err != nil { return nil, errors.Trace(err) } return ioutil.ReadFile(f) } var err error credential, err =...
go
func FinalizeFileContent(credential *cloud.Credential, provider environs.EnvironProvider) (*cloud.Credential, error) { readFile := func(f string) ([]byte, error) { f, err := utils.NormalizePath(f) if err != nil { return nil, errors.Trace(err) } return ioutil.ReadFile(f) } var err error credential, err =...
[ "func", "FinalizeFileContent", "(", "credential", "*", "cloud", ".", "Credential", ",", "provider", "environs", ".", "EnvironProvider", ")", "(", "*", "cloud", ".", "Credential", ",", "error", ")", "{", "readFile", ":=", "func", "(", "f", "string", ")", "(...
// FinalizeFileContent replaces the path content of cloud credentials "file" attribute with its content.
[ "FinalizeFileContent", "replaces", "the", "path", "content", "of", "cloud", "credentials", "file", "attribute", "with", "its", "content", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/modelcmd/credentials.go#L101-L119
4,030
juju/juju
cmd/modelcmd/credentials.go
credentialByName
func credentialByName( store jujuclient.CredentialGetter, cloudName, credentialName string, ) (_ *cloud.Credential, credentialNameUsed string, defaultRegion string, _ error) { cloudCredentials, err := store.CredentialForCloud(cloudName) if err != nil { return nil, "", "", errors.Annotate(err, "loading credentials...
go
func credentialByName( store jujuclient.CredentialGetter, cloudName, credentialName string, ) (_ *cloud.Credential, credentialNameUsed string, defaultRegion string, _ error) { cloudCredentials, err := store.CredentialForCloud(cloudName) if err != nil { return nil, "", "", errors.Annotate(err, "loading credentials...
[ "func", "credentialByName", "(", "store", "jujuclient", ".", "CredentialGetter", ",", "cloudName", ",", "credentialName", "string", ",", ")", "(", "_", "*", "cloud", ".", "Credential", ",", "credentialNameUsed", "string", ",", "defaultRegion", "string", ",", "_"...
// credentialByName returns the credential and default region to use for the // specified cloud, optionally specifying a credential name. If no credential // name is specified, then use the default credential for the cloud if one has // been specified. The credential name is returned also, in case the default // creden...
[ "credentialByName", "returns", "the", "credential", "and", "default", "region", "to", "use", "for", "the", "specified", "cloud", "optionally", "specifying", "a", "credential", "name", ".", "If", "no", "credential", "name", "is", "specified", "then", "use", "the"...
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/modelcmd/credentials.go#L137-L164
4,031
juju/juju
cmd/modelcmd/credentials.go
DetectCredential
func DetectCredential(cloudName string, provider environs.EnvironProvider) (*cloud.CloudCredential, error) { detected, err := provider.DetectCredentials() if err != nil { return nil, errors.Annotatef( err, "detecting credentials for %q cloud provider", cloudName, ) } logger.Tracef("provider detected credenti...
go
func DetectCredential(cloudName string, provider environs.EnvironProvider) (*cloud.CloudCredential, error) { detected, err := provider.DetectCredentials() if err != nil { return nil, errors.Annotatef( err, "detecting credentials for %q cloud provider", cloudName, ) } logger.Tracef("provider detected credenti...
[ "func", "DetectCredential", "(", "cloudName", "string", ",", "provider", "environs", ".", "EnvironProvider", ")", "(", "*", "cloud", ".", "CloudCredential", ",", "error", ")", "{", "detected", ",", "err", ":=", "provider", ".", "DetectCredentials", "(", ")", ...
// DetectCredential detects credentials for the specified cloud type, and, if // exactly one is detected, returns it. // // If no credentials are detected, an error satisfying errors.IsNotFound will // be returned. If more than one credential is detected, ErrMultipleCredentials // will be returned.
[ "DetectCredential", "detects", "credentials", "for", "the", "specified", "cloud", "type", "and", "if", "exactly", "one", "is", "detected", "returns", "it", ".", "If", "no", "credentials", "are", "detected", "an", "error", "satisfying", "errors", ".", "IsNotFound...
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/modelcmd/credentials.go#L172-L187
4,032
juju/juju
cmd/modelcmd/credentials.go
RegisterCredentials
func RegisterCredentials(provider environs.EnvironProvider, args RegisterCredentialsParams) (map[string]*cloud.CloudCredential, error) { if register, ok := provider.(environs.ProviderCredentialsRegister); ok { found, err := register.RegisterCredentials(args.Cloud) if err != nil { return nil, errors.Annotatef( ...
go
func RegisterCredentials(provider environs.EnvironProvider, args RegisterCredentialsParams) (map[string]*cloud.CloudCredential, error) { if register, ok := provider.(environs.ProviderCredentialsRegister); ok { found, err := register.RegisterCredentials(args.Cloud) if err != nil { return nil, errors.Annotatef( ...
[ "func", "RegisterCredentials", "(", "provider", "environs", ".", "EnvironProvider", ",", "args", "RegisterCredentialsParams", ")", "(", "map", "[", "string", "]", "*", "cloud", ".", "CloudCredential", ",", "error", ")", "{", "if", "register", ",", "ok", ":=", ...
// RegisterCredentials returns any credentials that need to be registered for // a provider.
[ "RegisterCredentials", "returns", "any", "credentials", "that", "need", "to", "be", "registered", "for", "a", "provider", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/modelcmd/credentials.go#L197-L212
4,033
juju/juju
container/broker/mocks/apicalls_mock.go
NewMockAPICalls
func NewMockAPICalls(ctrl *gomock.Controller) *MockAPICalls { mock := &MockAPICalls{ctrl: ctrl} mock.recorder = &MockAPICallsMockRecorder{mock} return mock }
go
func NewMockAPICalls(ctrl *gomock.Controller) *MockAPICalls { mock := &MockAPICalls{ctrl: ctrl} mock.recorder = &MockAPICallsMockRecorder{mock} return mock }
[ "func", "NewMockAPICalls", "(", "ctrl", "*", "gomock", ".", "Controller", ")", "*", "MockAPICalls", "{", "mock", ":=", "&", "MockAPICalls", "{", "ctrl", ":", "ctrl", "}", "\n", "mock", ".", "recorder", "=", "&", "MockAPICallsMockRecorder", "{", "mock", "}"...
// NewMockAPICalls creates a new mock instance
[ "NewMockAPICalls", "creates", "a", "new", "mock", "instance" ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/container/broker/mocks/apicalls_mock.go#L29-L33
4,034
juju/juju
container/broker/mocks/apicalls_mock.go
ContainerConfig
func (m *MockAPICalls) ContainerConfig() (params.ContainerConfig, error) { ret := m.ctrl.Call(m, "ContainerConfig") ret0, _ := ret[0].(params.ContainerConfig) ret1, _ := ret[1].(error) return ret0, ret1 }
go
func (m *MockAPICalls) ContainerConfig() (params.ContainerConfig, error) { ret := m.ctrl.Call(m, "ContainerConfig") ret0, _ := ret[0].(params.ContainerConfig) ret1, _ := ret[1].(error) return ret0, ret1 }
[ "func", "(", "m", "*", "MockAPICalls", ")", "ContainerConfig", "(", ")", "(", "params", ".", "ContainerConfig", ",", "error", ")", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ")", "\n", "ret0", ",", "_", ":=", "ret...
// ContainerConfig mocks base method
[ "ContainerConfig", "mocks", "base", "method" ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/container/broker/mocks/apicalls_mock.go#L41-L46
4,035
juju/juju
container/broker/mocks/apicalls_mock.go
ContainerConfig
func (mr *MockAPICallsMockRecorder) ContainerConfig() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerConfig", reflect.TypeOf((*MockAPICalls)(nil).ContainerConfig)) }
go
func (mr *MockAPICallsMockRecorder) ContainerConfig() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerConfig", reflect.TypeOf((*MockAPICalls)(nil).ContainerConfig)) }
[ "func", "(", "mr", "*", "MockAPICallsMockRecorder", ")", "ContainerConfig", "(", ")", "*", "gomock", ".", "Call", "{", "return", "mr", ".", "mock", ".", "ctrl", ".", "RecordCallWithMethodType", "(", "mr", ".", "mock", ",", "\"", "\"", ",", "reflect", "."...
// ContainerConfig indicates an expected call of ContainerConfig
[ "ContainerConfig", "indicates", "an", "expected", "call", "of", "ContainerConfig" ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/container/broker/mocks/apicalls_mock.go#L49-L51
4,036
juju/juju
container/broker/mocks/apicalls_mock.go
GetContainerInterfaceInfo
func (mr *MockAPICallsMockRecorder) GetContainerInterfaceInfo(arg0 interface{}) *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetContainerInterfaceInfo", reflect.TypeOf((*MockAPICalls)(nil).GetContainerInterfaceInfo), arg0) }
go
func (mr *MockAPICallsMockRecorder) GetContainerInterfaceInfo(arg0 interface{}) *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetContainerInterfaceInfo", reflect.TypeOf((*MockAPICalls)(nil).GetContainerInterfaceInfo), arg0) }
[ "func", "(", "mr", "*", "MockAPICallsMockRecorder", ")", "GetContainerInterfaceInfo", "(", "arg0", "interface", "{", "}", ")", "*", "gomock", ".", "Call", "{", "return", "mr", ".", "mock", ".", "ctrl", ".", "RecordCallWithMethodType", "(", "mr", ".", "mock",...
// GetContainerInterfaceInfo indicates an expected call of GetContainerInterfaceInfo
[ "GetContainerInterfaceInfo", "indicates", "an", "expected", "call", "of", "GetContainerInterfaceInfo" ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/container/broker/mocks/apicalls_mock.go#L62-L64
4,037
juju/juju
container/broker/mocks/apicalls_mock.go
GetContainerProfileInfo
func (m *MockAPICalls) GetContainerProfileInfo(arg0 names_v2.MachineTag) ([]*provisioner.LXDProfileResult, error) { ret := m.ctrl.Call(m, "GetContainerProfileInfo", arg0) ret0, _ := ret[0].([]*provisioner.LXDProfileResult) ret1, _ := ret[1].(error) return ret0, ret1 }
go
func (m *MockAPICalls) GetContainerProfileInfo(arg0 names_v2.MachineTag) ([]*provisioner.LXDProfileResult, error) { ret := m.ctrl.Call(m, "GetContainerProfileInfo", arg0) ret0, _ := ret[0].([]*provisioner.LXDProfileResult) ret1, _ := ret[1].(error) return ret0, ret1 }
[ "func", "(", "m", "*", "MockAPICalls", ")", "GetContainerProfileInfo", "(", "arg0", "names_v2", ".", "MachineTag", ")", "(", "[", "]", "*", "provisioner", ".", "LXDProfileResult", ",", "error", ")", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", ...
// GetContainerProfileInfo mocks base method
[ "GetContainerProfileInfo", "mocks", "base", "method" ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/container/broker/mocks/apicalls_mock.go#L67-L72
4,038
juju/juju
container/broker/mocks/apicalls_mock.go
HostChangesForContainer
func (m *MockAPICalls) HostChangesForContainer(arg0 names_v2.MachineTag) ([]network.DeviceToBridge, int, error) { ret := m.ctrl.Call(m, "HostChangesForContainer", arg0) ret0, _ := ret[0].([]network.DeviceToBridge) ret1, _ := ret[1].(int) ret2, _ := ret[2].(error) return ret0, ret1, ret2 }
go
func (m *MockAPICalls) HostChangesForContainer(arg0 names_v2.MachineTag) ([]network.DeviceToBridge, int, error) { ret := m.ctrl.Call(m, "HostChangesForContainer", arg0) ret0, _ := ret[0].([]network.DeviceToBridge) ret1, _ := ret[1].(int) ret2, _ := ret[2].(error) return ret0, ret1, ret2 }
[ "func", "(", "m", "*", "MockAPICalls", ")", "HostChangesForContainer", "(", "arg0", "names_v2", ".", "MachineTag", ")", "(", "[", "]", "network", ".", "DeviceToBridge", ",", "int", ",", "error", ")", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "("...
// HostChangesForContainer mocks base method
[ "HostChangesForContainer", "mocks", "base", "method" ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/container/broker/mocks/apicalls_mock.go#L80-L86
4,039
juju/juju
container/broker/mocks/apicalls_mock.go
PrepareContainerInterfaceInfo
func (m *MockAPICalls) PrepareContainerInterfaceInfo(arg0 names_v2.MachineTag) ([]network.InterfaceInfo, error) { ret := m.ctrl.Call(m, "PrepareContainerInterfaceInfo", arg0) ret0, _ := ret[0].([]network.InterfaceInfo) ret1, _ := ret[1].(error) return ret0, ret1 }
go
func (m *MockAPICalls) PrepareContainerInterfaceInfo(arg0 names_v2.MachineTag) ([]network.InterfaceInfo, error) { ret := m.ctrl.Call(m, "PrepareContainerInterfaceInfo", arg0) ret0, _ := ret[0].([]network.InterfaceInfo) ret1, _ := ret[1].(error) return ret0, ret1 }
[ "func", "(", "m", "*", "MockAPICalls", ")", "PrepareContainerInterfaceInfo", "(", "arg0", "names_v2", ".", "MachineTag", ")", "(", "[", "]", "network", ".", "InterfaceInfo", ",", "error", ")", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ...
// PrepareContainerInterfaceInfo mocks base method
[ "PrepareContainerInterfaceInfo", "mocks", "base", "method" ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/container/broker/mocks/apicalls_mock.go#L94-L99
4,040
juju/juju
container/broker/mocks/apicalls_mock.go
ReleaseContainerAddresses
func (m *MockAPICalls) ReleaseContainerAddresses(arg0 names_v2.MachineTag) error { ret := m.ctrl.Call(m, "ReleaseContainerAddresses", arg0) ret0, _ := ret[0].(error) return ret0 }
go
func (m *MockAPICalls) ReleaseContainerAddresses(arg0 names_v2.MachineTag) error { ret := m.ctrl.Call(m, "ReleaseContainerAddresses", arg0) ret0, _ := ret[0].(error) return ret0 }
[ "func", "(", "m", "*", "MockAPICalls", ")", "ReleaseContainerAddresses", "(", "arg0", "names_v2", ".", "MachineTag", ")", "error", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ")", "\n", "ret0", ",", "_", ...
// ReleaseContainerAddresses mocks base method
[ "ReleaseContainerAddresses", "mocks", "base", "method" ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/container/broker/mocks/apicalls_mock.go#L107-L111
4,041
juju/juju
container/broker/mocks/apicalls_mock.go
SetHostMachineNetworkConfig
func (m *MockAPICalls) SetHostMachineNetworkConfig(arg0 names_v2.MachineTag, arg1 []params.NetworkConfig) error { ret := m.ctrl.Call(m, "SetHostMachineNetworkConfig", arg0, arg1) ret0, _ := ret[0].(error) return ret0 }
go
func (m *MockAPICalls) SetHostMachineNetworkConfig(arg0 names_v2.MachineTag, arg1 []params.NetworkConfig) error { ret := m.ctrl.Call(m, "SetHostMachineNetworkConfig", arg0, arg1) ret0, _ := ret[0].(error) return ret0 }
[ "func", "(", "m", "*", "MockAPICalls", ")", "SetHostMachineNetworkConfig", "(", "arg0", "names_v2", ".", "MachineTag", ",", "arg1", "[", "]", "params", ".", "NetworkConfig", ")", "error", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", ...
// SetHostMachineNetworkConfig mocks base method
[ "SetHostMachineNetworkConfig", "mocks", "base", "method" ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/container/broker/mocks/apicalls_mock.go#L119-L123
4,042
juju/juju
state/sequence.go
sequence
func sequence(mb modelBackend, name string) (int, error) { sequences, closer := mb.db().GetCollection(sequenceC) defer closer() query := sequences.FindId(name) inc := mgo.Change{ Update: bson.M{ "$set": bson.M{ "name": name, "model-uuid": mb.modelUUID(), }, "$inc": bson.M{"counter": 1}, }...
go
func sequence(mb modelBackend, name string) (int, error) { sequences, closer := mb.db().GetCollection(sequenceC) defer closer() query := sequences.FindId(name) inc := mgo.Change{ Update: bson.M{ "$set": bson.M{ "name": name, "model-uuid": mb.modelUUID(), }, "$inc": bson.M{"counter": 1}, }...
[ "func", "sequence", "(", "mb", "modelBackend", ",", "name", "string", ")", "(", "int", ",", "error", ")", "{", "sequences", ",", "closer", ":=", "mb", ".", "db", "(", ")", ".", "GetCollection", "(", "sequenceC", ")", "\n", "defer", "closer", "(", ")"...
// sequence safely increments a database backed sequence, returning // the next value.
[ "sequence", "safely", "increments", "a", "database", "backed", "sequence", "returning", "the", "next", "value", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/sequence.go#L23-L43
4,043
juju/juju
state/sequence.go
sequenceWithMin
func sequenceWithMin(mb modelBackend, name string, minVal int) (int, error) { sequences, closer := mb.db().GetRawCollection(sequenceC) defer closer() updater := newDbSeqUpdater(sequences, mb.modelUUID(), name) return updateSeqWithMin(updater, minVal) }
go
func sequenceWithMin(mb modelBackend, name string, minVal int) (int, error) { sequences, closer := mb.db().GetRawCollection(sequenceC) defer closer() updater := newDbSeqUpdater(sequences, mb.modelUUID(), name) return updateSeqWithMin(updater, minVal) }
[ "func", "sequenceWithMin", "(", "mb", "modelBackend", ",", "name", "string", ",", "minVal", "int", ")", "(", "int", ",", "error", ")", "{", "sequences", ",", "closer", ":=", "mb", ".", "db", "(", ")", ".", "GetRawCollection", "(", "sequenceC", ")", "\n...
// sequenceWithMin safely increments a database backed sequence, // allowing for a minimum value for the sequence to be specified. The // minimum value is used as an initial value for the first use of a // particular sequence. The minimum value will also cause a sequence // value to jump ahead if the minimum is provide...
[ "sequenceWithMin", "safely", "increments", "a", "database", "backed", "sequence", "allowing", "for", "a", "minimum", "value", "for", "the", "sequence", "to", "be", "specified", ".", "The", "minimum", "value", "is", "used", "as", "an", "initial", "value", "for"...
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/sequence.go#L57-L62
4,044
juju/juju
state/sequence.go
Sequences
func (st *State) Sequences() (map[string]int, error) { sequences, closer := st.db().GetCollection(sequenceC) defer closer() var docs []sequenceDoc if err := sequences.Find(nil).All(&docs); err != nil { return nil, errors.Trace(err) } result := make(map[string]int) for _, doc := range docs { result[doc.Name...
go
func (st *State) Sequences() (map[string]int, error) { sequences, closer := st.db().GetCollection(sequenceC) defer closer() var docs []sequenceDoc if err := sequences.Find(nil).All(&docs); err != nil { return nil, errors.Trace(err) } result := make(map[string]int) for _, doc := range docs { result[doc.Name...
[ "func", "(", "st", "*", "State", ")", "Sequences", "(", ")", "(", "map", "[", "string", "]", "int", ",", "error", ")", "{", "sequences", ",", "closer", ":=", "st", ".", "db", "(", ")", ".", "GetCollection", "(", "sequenceC", ")", "\n", "defer", "...
// Sequences returns the model's sequence names and their next values.
[ "Sequences", "returns", "the", "model", "s", "sequence", "names", "and", "their", "next", "values", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/sequence.go#L88-L102
4,045
juju/juju
state/sequence.go
updateSeqWithMin
func updateSeqWithMin(sequence seqUpdater, minVal int) (int, error) { for try := 0; try < maxSeqRetries; try++ { curVal, err := sequence.read() if err != nil { return -1, errors.Annotate(err, "could not read sequence") } if curVal == 0 { // No sequence document exists, create one. ok, err := sequence....
go
func updateSeqWithMin(sequence seqUpdater, minVal int) (int, error) { for try := 0; try < maxSeqRetries; try++ { curVal, err := sequence.read() if err != nil { return -1, errors.Annotate(err, "could not read sequence") } if curVal == 0 { // No sequence document exists, create one. ok, err := sequence....
[ "func", "updateSeqWithMin", "(", "sequence", "seqUpdater", ",", "minVal", "int", ")", "(", "int", ",", "error", ")", "{", "for", "try", ":=", "0", ";", "try", "<", "maxSeqRetries", ";", "try", "++", "{", "curVal", ",", "err", ":=", "sequence", ".", "...
// updateSeqWithMin implements the abstract logic for incrementing a // database backed sequence in a concurrency aware way. // // It is complicated because MongoDB's atomic update primitives don't // provide a way to upsert a counter while also providing an initial // value. Instead, a number of database operations a...
[ "updateSeqWithMin", "implements", "the", "abstract", "logic", "for", "incrementing", "a", "database", "backed", "sequence", "in", "a", "concurrency", "aware", "way", ".", "It", "is", "complicated", "because", "MongoDB", "s", "atomic", "update", "primitives", "don"...
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/sequence.go#L115-L151
4,046
juju/juju
agent/tools/symlinks.go
EnsureSymlinks
func EnsureSymlinks(jujuDir, dir string, commands []string) (err error) { logger.Infof("ensure jujuc symlinks in %s", dir) defer func() { if err != nil { err = errors.Annotatef(err, "cannot initialize commands in %q", dir) } }() isSymlink, err := symlink.IsSymlink(jujuDir) if err != nil { return err } i...
go
func EnsureSymlinks(jujuDir, dir string, commands []string) (err error) { logger.Infof("ensure jujuc symlinks in %s", dir) defer func() { if err != nil { err = errors.Annotatef(err, "cannot initialize commands in %q", dir) } }() isSymlink, err := symlink.IsSymlink(jujuDir) if err != nil { return err } i...
[ "func", "EnsureSymlinks", "(", "jujuDir", ",", "dir", "string", ",", "commands", "[", "]", "string", ")", "(", "err", "error", ")", "{", "logger", ".", "Infof", "(", "\"", "\"", ",", "dir", ")", "\n", "defer", "func", "(", ")", "{", "if", "err", ...
// EnsureSymlinks creates a symbolic link to jujud within dir for each // command. If the commands already exist, this operation does nothing. // If dir is a symbolic link, it will be dereferenced first.
[ "EnsureSymlinks", "creates", "a", "symbolic", "link", "to", "jujud", "within", "dir", "for", "each", "command", ".", "If", "the", "commands", "already", "exist", "this", "operation", "does", "nothing", ".", "If", "dir", "is", "a", "symbolic", "link", "it", ...
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/agent/tools/symlinks.go#L19-L55
4,047
juju/juju
environs/bootstrap/bootstrap.go
Validate
func (p BootstrapParams) Validate() error { if p.AdminSecret == "" { return errors.New("admin-secret is empty") } if p.ControllerConfig.ControllerUUID() == "" { return errors.New("controller configuration has no controller UUID") } if _, hasCACert := p.ControllerConfig.CACert(); !hasCACert { return errors.Ne...
go
func (p BootstrapParams) Validate() error { if p.AdminSecret == "" { return errors.New("admin-secret is empty") } if p.ControllerConfig.ControllerUUID() == "" { return errors.New("controller configuration has no controller UUID") } if _, hasCACert := p.ControllerConfig.CACert(); !hasCACert { return errors.Ne...
[ "func", "(", "p", "BootstrapParams", ")", "Validate", "(", ")", "error", "{", "if", "p", ".", "AdminSecret", "==", "\"", "\"", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "p", ".", "ControllerConfig", ".", "Con...
// Validate validates the bootstrap parameters.
[ "Validate", "validates", "the", "bootstrap", "parameters", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/environs/bootstrap/bootstrap.go#L160-L175
4,048
juju/juju
environs/bootstrap/bootstrap.go
withDefaultControllerConstraints
func withDefaultControllerConstraints(cons constraints.Value) constraints.Value { if !cons.HasInstanceType() && !cons.HasCpuCores() && !cons.HasCpuPower() && !cons.HasMem() { // A default of 3.5GiB will result in machines with up to 4GiB of memory, eg // - 3.75GiB on AWS, Google // - 3.5GiB on Azure // - 4GiB ...
go
func withDefaultControllerConstraints(cons constraints.Value) constraints.Value { if !cons.HasInstanceType() && !cons.HasCpuCores() && !cons.HasCpuPower() && !cons.HasMem() { // A default of 3.5GiB will result in machines with up to 4GiB of memory, eg // - 3.75GiB on AWS, Google // - 3.5GiB on Azure // - 4GiB ...
[ "func", "withDefaultControllerConstraints", "(", "cons", "constraints", ".", "Value", ")", "constraints", ".", "Value", "{", "if", "!", "cons", ".", "HasInstanceType", "(", ")", "&&", "!", "cons", ".", "HasCpuCores", "(", ")", "&&", "!", "cons", ".", "HasC...
// withDefaultControllerConstraints returns the given constraints, // updated to choose a default instance type appropriate for a // controller machine. We use this only if the user does not specify // any constraints that would otherwise control the instance type // selection.
[ "withDefaultControllerConstraints", "returns", "the", "given", "constraints", "updated", "to", "choose", "a", "default", "instance", "type", "appropriate", "for", "a", "controller", "machine", ".", "We", "use", "this", "only", "if", "the", "user", "does", "not", ...
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/environs/bootstrap/bootstrap.go#L182-L192
4,049
juju/juju
environs/bootstrap/bootstrap.go
Bootstrap
func Bootstrap( ctx environs.BootstrapContext, environ environs.BootstrapEnviron, callCtx context.ProviderCallContext, args BootstrapParams, ) error { if err := args.Validate(); err != nil { return errors.Annotate(err, "validating bootstrap parameters") } bootstrapParams := environs.BootstrapParams{ CloudNa...
go
func Bootstrap( ctx environs.BootstrapContext, environ environs.BootstrapEnviron, callCtx context.ProviderCallContext, args BootstrapParams, ) error { if err := args.Validate(); err != nil { return errors.Annotate(err, "validating bootstrap parameters") } bootstrapParams := environs.BootstrapParams{ CloudNa...
[ "func", "Bootstrap", "(", "ctx", "environs", ".", "BootstrapContext", ",", "environ", "environs", ".", "BootstrapEnviron", ",", "callCtx", "context", ".", "ProviderCallContext", ",", "args", "BootstrapParams", ",", ")", "error", "{", "if", "err", ":=", "args", ...
// Bootstrap bootstraps the given environment. The supplied constraints are // used to provision the instance, and are also set within the bootstrapped // environment.
[ "Bootstrap", "bootstraps", "the", "given", "environment", ".", "The", "supplied", "constraints", "are", "used", "to", "provision", "the", "instance", "and", "are", "also", "set", "within", "the", "bootstrapped", "environment", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/environs/bootstrap/bootstrap.go#L538-L566
4,050
juju/juju
environs/bootstrap/bootstrap.go
bootstrapImageMetadata
func bootstrapImageMetadata( environ environs.BootstrapEnviron, bootstrapSeries *string, bootstrapArch string, bootstrapImageId string, customImageMetadata *[]*imagemetadata.ImageMetadata, ) ([]*imagemetadata.ImageMetadata, error) { hasRegion, ok := environ.(simplestreams.HasRegion) if !ok { if bootstrapImage...
go
func bootstrapImageMetadata( environ environs.BootstrapEnviron, bootstrapSeries *string, bootstrapArch string, bootstrapImageId string, customImageMetadata *[]*imagemetadata.ImageMetadata, ) ([]*imagemetadata.ImageMetadata, error) { hasRegion, ok := environ.(simplestreams.HasRegion) if !ok { if bootstrapImage...
[ "func", "bootstrapImageMetadata", "(", "environ", "environs", ".", "BootstrapEnviron", ",", "bootstrapSeries", "*", "string", ",", "bootstrapArch", "string", ",", "bootstrapImageId", "string", ",", "customImageMetadata", "*", "[", "]", "*", "imagemetadata", ".", "Im...
// bootstrapImageMetadata returns the image metadata to use for bootstrapping // the given environment. If the environment provider does not make use of // simplestreams, no metadata will be returned. // // If a bootstrap image ID is specified, image metadata will be synthesised // using that image ID, and the architec...
[ "bootstrapImageMetadata", "returns", "the", "image", "metadata", "to", "use", "for", "bootstrapping", "the", "given", "environment", ".", "If", "the", "environment", "provider", "does", "not", "make", "use", "of", "simplestreams", "no", "metadata", "will", "be", ...
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/environs/bootstrap/bootstrap.go#L714-L796
4,051
juju/juju
environs/bootstrap/bootstrap.go
getBootstrapToolsVersion
func getBootstrapToolsVersion(possibleTools coretools.List) (coretools.List, error) { if len(possibleTools) == 0 { return nil, errors.New("no bootstrap agent binaries available") } var newVersion version.Number newVersion, toolsList := possibleTools.Newest() logger.Infof("newest version: %s", newVersion) bootst...
go
func getBootstrapToolsVersion(possibleTools coretools.List) (coretools.List, error) { if len(possibleTools) == 0 { return nil, errors.New("no bootstrap agent binaries available") } var newVersion version.Number newVersion, toolsList := possibleTools.Newest() logger.Infof("newest version: %s", newVersion) bootst...
[ "func", "getBootstrapToolsVersion", "(", "possibleTools", "coretools", ".", "List", ")", "(", "coretools", ".", "List", ",", "error", ")", "{", "if", "len", "(", "possibleTools", ")", "==", "0", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"",...
// getBootstrapToolsVersion returns the newest tools from the given tools list.
[ "getBootstrapToolsVersion", "returns", "the", "newest", "tools", "from", "the", "given", "tools", "list", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/environs/bootstrap/bootstrap.go#L799-L822
4,052
juju/juju
environs/bootstrap/bootstrap.go
setBootstrapToolsVersion
func setBootstrapToolsVersion(environ environs.Configer, toolsVersion version.Number) error { cfg := environ.Config() if agentVersion, _ := cfg.AgentVersion(); agentVersion != toolsVersion { cfg, err := cfg.Apply(map[string]interface{}{ "agent-version": toolsVersion.String(), }) if err == nil { err = envi...
go
func setBootstrapToolsVersion(environ environs.Configer, toolsVersion version.Number) error { cfg := environ.Config() if agentVersion, _ := cfg.AgentVersion(); agentVersion != toolsVersion { cfg, err := cfg.Apply(map[string]interface{}{ "agent-version": toolsVersion.String(), }) if err == nil { err = envi...
[ "func", "setBootstrapToolsVersion", "(", "environ", "environs", ".", "Configer", ",", "toolsVersion", "version", ".", "Number", ")", "error", "{", "cfg", ":=", "environ", ".", "Config", "(", ")", "\n", "if", "agentVersion", ",", "_", ":=", "cfg", ".", "Age...
// setBootstrapToolsVersion updates the agent-version configuration attribute.
[ "setBootstrapToolsVersion", "updates", "the", "agent", "-", "version", "configuration", "attribute", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/environs/bootstrap/bootstrap.go#L825-L839
4,053
juju/juju
environs/bootstrap/bootstrap.go
findCompatibleTools
func findCompatibleTools(possibleTools coretools.List, version version.Number) (version.Number, coretools.List) { var compatibleTools coretools.List for _, tools := range possibleTools { if isCompatibleVersion(tools.Version.Number, version) { compatibleTools = append(compatibleTools, tools) } } return compat...
go
func findCompatibleTools(possibleTools coretools.List, version version.Number) (version.Number, coretools.List) { var compatibleTools coretools.List for _, tools := range possibleTools { if isCompatibleVersion(tools.Version.Number, version) { compatibleTools = append(compatibleTools, tools) } } return compat...
[ "func", "findCompatibleTools", "(", "possibleTools", "coretools", ".", "List", ",", "version", "version", ".", "Number", ")", "(", "version", ".", "Number", ",", "coretools", ".", "List", ")", "{", "var", "compatibleTools", "coretools", ".", "List", "\n", "f...
// findCompatibleTools finds tools in the list that have the same major, minor // and patch level as jujuversion.Current. // // Build number is not important to match; uploaded tools will have // incremented build number, and we want to match them.
[ "findCompatibleTools", "finds", "tools", "in", "the", "list", "that", "have", "the", "same", "major", "minor", "and", "patch", "level", "as", "jujuversion", ".", "Current", ".", "Build", "number", "is", "not", "important", "to", "match", ";", "uploaded", "to...
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/environs/bootstrap/bootstrap.go#L846-L854
4,054
juju/juju
environs/bootstrap/bootstrap.go
setPrivateMetadataSources
func setPrivateMetadataSources(metadataDir string) ([]*imagemetadata.ImageMetadata, error) { if _, err := os.Stat(metadataDir); err != nil { if !os.IsNotExist(err) { return nil, errors.Annotate(err, "cannot access simplestreams metadata directory") } return nil, errors.NotFoundf("simplestreams metadata source...
go
func setPrivateMetadataSources(metadataDir string) ([]*imagemetadata.ImageMetadata, error) { if _, err := os.Stat(metadataDir); err != nil { if !os.IsNotExist(err) { return nil, errors.Annotate(err, "cannot access simplestreams metadata directory") } return nil, errors.NotFoundf("simplestreams metadata source...
[ "func", "setPrivateMetadataSources", "(", "metadataDir", "string", ")", "(", "[", "]", "*", "imagemetadata", ".", "ImageMetadata", ",", "error", ")", "{", "if", "_", ",", "err", ":=", "os", ".", "Stat", "(", "metadataDir", ")", ";", "err", "!=", "nil", ...
// setPrivateMetadataSources verifies the specified metadataDir exists, // uses it to set the default agent metadata source for agent binaries, // and adds an image metadata source after verifying the contents. If the // directory ends in tools, only the default tools metadata source will be // set. Same for images.
[ "setPrivateMetadataSources", "verifies", "the", "specified", "metadataDir", "exists", "uses", "it", "to", "set", "the", "default", "agent", "metadata", "source", "for", "agent", "binaries", "and", "adds", "an", "image", "metadata", "source", "after", "verifying", ...
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/environs/bootstrap/bootstrap.go#L867-L929
4,055
juju/juju
environs/bootstrap/bootstrap.go
guiArchive
func guiArchive(dataSourceBaseURL string, logProgress func(string)) *coretools.GUIArchive { // The environment variable is only used for development purposes. path := os.Getenv("JUJU_GUI") if path != "" { vers, err := guiVersion(path) if err != nil { logProgress(fmt.Sprintf("Cannot use Juju GUI at %q: %s", pa...
go
func guiArchive(dataSourceBaseURL string, logProgress func(string)) *coretools.GUIArchive { // The environment variable is only used for development purposes. path := os.Getenv("JUJU_GUI") if path != "" { vers, err := guiVersion(path) if err != nil { logProgress(fmt.Sprintf("Cannot use Juju GUI at %q: %s", pa...
[ "func", "guiArchive", "(", "dataSourceBaseURL", "string", ",", "logProgress", "func", "(", "string", ")", ")", "*", "coretools", ".", "GUIArchive", "{", "// The environment variable is only used for development purposes.", "path", ":=", "os", ".", "Getenv", "(", "\"",...
// guiArchive returns information on the GUI archive that will be uploaded // to the controller. Possible errors in retrieving the GUI archive information // do not prevent the model to be bootstrapped. If dataSourceBaseURL is // non-empty, remote GUI archive info is retrieved from simplestreams using it // as the base...
[ "guiArchive", "returns", "information", "on", "the", "GUI", "archive", "that", "will", "be", "uploaded", "to", "the", "controller", ".", "Possible", "errors", "in", "retrieving", "the", "GUI", "archive", "information", "do", "not", "prevent", "the", "model", "...
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/environs/bootstrap/bootstrap.go#L937-L983
4,056
juju/juju
environs/bootstrap/bootstrap.go
hashAndSize
func hashAndSize(path string) (hash string, size int64, err error) { f, err := os.Open(path) if err != nil { return "", 0, errors.Mask(err) } defer f.Close() h := sha256.New() size, err = io.Copy(h, f) if err != nil { return "", 0, errors.Mask(err) } return fmt.Sprintf("%x", h.Sum(nil)), size, nil }
go
func hashAndSize(path string) (hash string, size int64, err error) { f, err := os.Open(path) if err != nil { return "", 0, errors.Mask(err) } defer f.Close() h := sha256.New() size, err = io.Copy(h, f) if err != nil { return "", 0, errors.Mask(err) } return fmt.Sprintf("%x", h.Sum(nil)), size, nil }
[ "func", "hashAndSize", "(", "path", "string", ")", "(", "hash", "string", ",", "size", "int64", ",", "err", "error", ")", "{", "f", ",", "err", ":=", "os", ".", "Open", "(", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ...
// hashAndSize calculates and returns the SHA256 hash and the size of the file // located at the given path.
[ "hashAndSize", "calculates", "and", "returns", "the", "SHA256", "hash", "and", "the", "size", "of", "the", "file", "located", "at", "the", "given", "path", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/environs/bootstrap/bootstrap.go#L1023-L1035
4,057
juju/juju
cmd/juju/crossmodel/list.go
NewListEndpointsCommand
func NewListEndpointsCommand() cmd.Command { listCmd := &listCommand{} listCmd.newAPIFunc = func() (ListAPI, error) { return listCmd.NewApplicationOffersAPI() } listCmd.refreshModels = listCmd.ModelCommandBase.RefreshModels return modelcmd.Wrap(listCmd) }
go
func NewListEndpointsCommand() cmd.Command { listCmd := &listCommand{} listCmd.newAPIFunc = func() (ListAPI, error) { return listCmd.NewApplicationOffersAPI() } listCmd.refreshModels = listCmd.ModelCommandBase.RefreshModels return modelcmd.Wrap(listCmd) }
[ "func", "NewListEndpointsCommand", "(", ")", "cmd", ".", "Command", "{", "listCmd", ":=", "&", "listCommand", "{", "}", "\n", "listCmd", ".", "newAPIFunc", "=", "func", "(", ")", "(", "ListAPI", ",", "error", ")", "{", "return", "listCmd", ".", "NewAppli...
// NewListEndpointsCommand constructs new list endpoint command.
[ "NewListEndpointsCommand", "constructs", "new", "list", "endpoint", "command", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/crossmodel/list.go#L76-L83
4,058
juju/juju
cmd/juju/crossmodel/list.go
convertCharmEndpoints
func convertCharmEndpoints(relations ...charm.Relation) map[string]RemoteEndpoint { if len(relations) == 0 { return nil } output := make(map[string]RemoteEndpoint, len(relations)) for _, one := range relations { output[one.Name] = RemoteEndpoint{one.Name, one.Interface, string(one.Role)} } return output }
go
func convertCharmEndpoints(relations ...charm.Relation) map[string]RemoteEndpoint { if len(relations) == 0 { return nil } output := make(map[string]RemoteEndpoint, len(relations)) for _, one := range relations { output[one.Name] = RemoteEndpoint{one.Name, one.Interface, string(one.Role)} } return output }
[ "func", "convertCharmEndpoints", "(", "relations", "...", "charm", ".", "Relation", ")", "map", "[", "string", "]", "RemoteEndpoint", "{", "if", "len", "(", "relations", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n", "output", ":=", "make", "(", ...
// convertCharmEndpoints takes any number of charm relations and // creates a collection of ui-formatted endpoints.
[ "convertCharmEndpoints", "takes", "any", "number", "of", "charm", "relations", "and", "creates", "a", "collection", "of", "ui", "-", "formatted", "endpoints", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/crossmodel/list.go#L302-L311
4,059
juju/juju
state/controller.go
GetState
func (ctlr *Controller) GetState(modelTag names.ModelTag) (*PooledState, error) { return ctlr.pool.Get(modelTag.Id()) }
go
func (ctlr *Controller) GetState(modelTag names.ModelTag) (*PooledState, error) { return ctlr.pool.Get(modelTag.Id()) }
[ "func", "(", "ctlr", "*", "Controller", ")", "GetState", "(", "modelTag", "names", ".", "ModelTag", ")", "(", "*", "PooledState", ",", "error", ")", "{", "return", "ctlr", ".", "pool", ".", "Get", "(", "modelTag", ".", "Id", "(", ")", ")", "\n", "}...
// GetState returns a new State instance for the specified model. The // connection uses the same credentials and policy as the Controller.
[ "GetState", "returns", "a", "new", "State", "instance", "for", "the", "specified", "model", ".", "The", "connection", "uses", "the", "same", "credentials", "and", "policy", "as", "the", "Controller", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/controller.go#L68-L70
4,060
juju/juju
state/controller.go
Ping
func (ctlr *Controller) Ping() error { if ctlr.pool.SystemState() == nil { return errors.New("pool is closed") } return ctlr.pool.SystemState().Ping() }
go
func (ctlr *Controller) Ping() error { if ctlr.pool.SystemState() == nil { return errors.New("pool is closed") } return ctlr.pool.SystemState().Ping() }
[ "func", "(", "ctlr", "*", "Controller", ")", "Ping", "(", ")", "error", "{", "if", "ctlr", ".", "pool", ".", "SystemState", "(", ")", "==", "nil", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "ctlr", ".", ...
// Ping probes the Controllers's database connection to ensure that it // is still alive.
[ "Ping", "probes", "the", "Controllers", "s", "database", "connection", "to", "ensure", "that", "it", "is", "still", "alive", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/controller.go#L74-L79
4,061
juju/juju
state/controller.go
ControllerConfig
func (st *State) ControllerConfig() (jujucontroller.Config, error) { settings, err := readSettings(st.db(), controllersC, controllerSettingsGlobalKey) if err != nil { return nil, errors.Annotatef(err, "controller %q", st.ControllerUUID()) } return settings.Map(), nil }
go
func (st *State) ControllerConfig() (jujucontroller.Config, error) { settings, err := readSettings(st.db(), controllersC, controllerSettingsGlobalKey) if err != nil { return nil, errors.Annotatef(err, "controller %q", st.ControllerUUID()) } return settings.Map(), nil }
[ "func", "(", "st", "*", "State", ")", "ControllerConfig", "(", ")", "(", "jujucontroller", ".", "Config", ",", "error", ")", "{", "settings", ",", "err", ":=", "readSettings", "(", "st", ".", "db", "(", ")", ",", "controllersC", ",", "controllerSettingsG...
// ControllerConfig returns the config values for the controller.
[ "ControllerConfig", "returns", "the", "config", "values", "for", "the", "controller", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/controller.go#L82-L88
4,062
juju/juju
state/controller.go
checkSpaceIsAvailableToAllControllers
func (st *State) checkSpaceIsAvailableToAllControllers(configSpace string) error { info, err := st.ControllerInfo() if err != nil { return errors.Annotate(err, "cannot get controller info") } var missing []string spaceName := network.SpaceName(configSpace) for _, id := range info.MachineIds { m, err := st.Ma...
go
func (st *State) checkSpaceIsAvailableToAllControllers(configSpace string) error { info, err := st.ControllerInfo() if err != nil { return errors.Annotate(err, "cannot get controller info") } var missing []string spaceName := network.SpaceName(configSpace) for _, id := range info.MachineIds { m, err := st.Ma...
[ "func", "(", "st", "*", "State", ")", "checkSpaceIsAvailableToAllControllers", "(", "configSpace", "string", ")", "error", "{", "info", ",", "err", ":=", "st", ".", "ControllerInfo", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", ...
// checkSpaceIsAvailableToAllControllers checks if each controller machine has // at least one address in the input space. If not, an error is returned.
[ "checkSpaceIsAvailableToAllControllers", "checks", "if", "each", "controller", "machine", "has", "at", "least", "one", "address", "in", "the", "input", "space", ".", "If", "not", "an", "error", "is", "returned", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/controller.go#L157-L179
4,063
juju/juju
provider/oracle/storage_provider.go
Supports
func (s storageProvider) Supports(kind storage.StorageKind) bool { return kind == storage.StorageKindBlock }
go
func (s storageProvider) Supports(kind storage.StorageKind) bool { return kind == storage.StorageKindBlock }
[ "func", "(", "s", "storageProvider", ")", "Supports", "(", "kind", "storage", ".", "StorageKind", ")", "bool", "{", "return", "kind", "==", "storage", ".", "StorageKindBlock", "\n", "}" ]
// Supports is defined on the storage.Provider interface.
[ "Supports", "is", "defined", "on", "the", "storage", ".", "Provider", "interface", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/oracle/storage_provider.go#L43-L45
4,064
juju/juju
provider/oracle/storage_provider.go
DefaultPools
func (s storageProvider) DefaultPools() []*storage.Config { latencyPool, _ := storage.NewConfig("oracle-latency", oracleStorageProviderType, map[string]interface{}{ oracleVolumeType: latencyPool, }) return []*storage.Config{latencyPool} }
go
func (s storageProvider) DefaultPools() []*storage.Config { latencyPool, _ := storage.NewConfig("oracle-latency", oracleStorageProviderType, map[string]interface{}{ oracleVolumeType: latencyPool, }) return []*storage.Config{latencyPool} }
[ "func", "(", "s", "storageProvider", ")", "DefaultPools", "(", ")", "[", "]", "*", "storage", ".", "Config", "{", "latencyPool", ",", "_", ":=", "storage", ".", "NewConfig", "(", "\"", "\"", ",", "oracleStorageProviderType", ",", "map", "[", "string", "]...
// DefaultPools is defined on the storage.Provider interface.
[ "DefaultPools", "is", "defined", "on", "the", "storage", ".", "Provider", "interface", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/oracle/storage_provider.go#L64-L69
4,065
juju/juju
core/model/generation.go
ValidateBranchName
func ValidateBranchName(name string) error { if name == "" { return errors.NotValidf("empty branch name") } if name == GenerationMaster { return errors.NotValidf("branch name %q", GenerationMaster) } return nil }
go
func ValidateBranchName(name string) error { if name == "" { return errors.NotValidf("empty branch name") } if name == GenerationMaster { return errors.NotValidf("branch name %q", GenerationMaster) } return nil }
[ "func", "ValidateBranchName", "(", "name", "string", ")", "error", "{", "if", "name", "==", "\"", "\"", "{", "return", "errors", ".", "NotValidf", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "name", "==", "GenerationMaster", "{", "return", "errors", "...
// ValidateBranchName returns an error if the input name is not suitable for // identifying a new in-flight branch.
[ "ValidateBranchName", "returns", "an", "error", "if", "the", "input", "name", "is", "not", "suitable", "for", "identifying", "a", "new", "in", "-", "flight", "branch", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/core/model/generation.go#L19-L27
4,066
juju/juju
state/imagestorage/image.go
NewStorage
func NewStorage( session *mgo.Session, modelUUID string, ) Storage { blobDb := session.DB(ImagesDB) metadataCollection := blobDb.C(imagemetadataC) return &imageStorage{ modelUUID, metadataCollection, blobDb, } }
go
func NewStorage( session *mgo.Session, modelUUID string, ) Storage { blobDb := session.DB(ImagesDB) metadataCollection := blobDb.C(imagemetadataC) return &imageStorage{ modelUUID, metadataCollection, blobDb, } }
[ "func", "NewStorage", "(", "session", "*", "mgo", ".", "Session", ",", "modelUUID", "string", ",", ")", "Storage", "{", "blobDb", ":=", "session", ".", "DB", "(", "ImagesDB", ")", "\n", "metadataCollection", ":=", "blobDb", ".", "C", "(", "imagemetadataC",...
// NewStorage constructs a new Storage that stores image blobs // in an "osimages" database. Image metadata is also stored in this // database in the "imagemetadata" collection.
[ "NewStorage", "constructs", "a", "new", "Storage", "that", "stores", "image", "blobs", "in", "an", "osimages", "database", ".", "Image", "metadata", "is", "also", "stored", "in", "this", "database", "in", "the", "imagemetadata", "collection", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/imagestorage/image.go#L43-L54
4,067
juju/juju
state/imagestorage/image.go
AddImage
func (s *imageStorage) AddImage(r io.Reader, metadata *Metadata) (resultErr error) { session := s.blobDb.Session.Copy() defer session.Close() managedStorage := s.getManagedStorage(session) path := imagePath(metadata.Kind, metadata.Series, metadata.Arch, metadata.SHA256) if err := managedStorage.PutForBucket(s.mode...
go
func (s *imageStorage) AddImage(r io.Reader, metadata *Metadata) (resultErr error) { session := s.blobDb.Session.Copy() defer session.Close() managedStorage := s.getManagedStorage(session) path := imagePath(metadata.Kind, metadata.Series, metadata.Arch, metadata.SHA256) if err := managedStorage.PutForBucket(s.mode...
[ "func", "(", "s", "*", "imageStorage", ")", "AddImage", "(", "r", "io", ".", "Reader", ",", "metadata", "*", "Metadata", ")", "(", "resultErr", "error", ")", "{", "session", ":=", "s", ".", "blobDb", ".", "Session", ".", "Copy", "(", ")", "\n", "de...
// AddImage is defined on the Storage interface.
[ "AddImage", "is", "defined", "on", "the", "Storage", "interface", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/imagestorage/image.go#L83-L166
4,068
juju/juju
state/imagestorage/image.go
ListImages
func (s *imageStorage) ListImages(filter ImageFilter) ([]*Metadata, error) { metadataDocs, err := s.listImageMetadataDocs(s.modelUUID, filter.Kind, filter.Series, filter.Arch) if err != nil { return nil, errors.Annotate(err, "cannot list image metadata") } result := make([]*Metadata, len(metadataDocs)) for i, me...
go
func (s *imageStorage) ListImages(filter ImageFilter) ([]*Metadata, error) { metadataDocs, err := s.listImageMetadataDocs(s.modelUUID, filter.Kind, filter.Series, filter.Arch) if err != nil { return nil, errors.Annotate(err, "cannot list image metadata") } result := make([]*Metadata, len(metadataDocs)) for i, me...
[ "func", "(", "s", "*", "imageStorage", ")", "ListImages", "(", "filter", "ImageFilter", ")", "(", "[", "]", "*", "Metadata", ",", "error", ")", "{", "metadataDocs", ",", "err", ":=", "s", ".", "listImageMetadataDocs", "(", "s", ".", "modelUUID", ",", "...
// ListImages is defined on the Storage interface.
[ "ListImages", "is", "defined", "on", "the", "Storage", "interface", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/imagestorage/image.go#L169-L188
4,069
juju/juju
state/imagestorage/image.go
DeleteImage
func (s *imageStorage) DeleteImage(metadata *Metadata) (resultErr error) { session := s.blobDb.Session.Copy() defer session.Close() managedStorage := s.getManagedStorage(session) path := imagePath(metadata.Kind, metadata.Series, metadata.Arch, metadata.SHA256) if err := managedStorage.RemoveForBucket(s.modelUUID, ...
go
func (s *imageStorage) DeleteImage(metadata *Metadata) (resultErr error) { session := s.blobDb.Session.Copy() defer session.Close() managedStorage := s.getManagedStorage(session) path := imagePath(metadata.Kind, metadata.Series, metadata.Arch, metadata.SHA256) if err := managedStorage.RemoveForBucket(s.modelUUID, ...
[ "func", "(", "s", "*", "imageStorage", ")", "DeleteImage", "(", "metadata", "*", "Metadata", ")", "(", "resultErr", "error", ")", "{", "session", ":=", "s", ".", "blobDb", ".", "Session", ".", "Copy", "(", ")", "\n", "defer", "session", ".", "Close", ...
// DeleteImage is defined on the Storage interface.
[ "DeleteImage", "is", "defined", "on", "the", "Storage", "interface", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/imagestorage/image.go#L191-L215
4,070
juju/juju
state/imagestorage/image.go
Image
func (s *imageStorage) Image(kind, series, arch string) (*Metadata, io.ReadCloser, error) { metadataDoc, err := s.imageMetadataDoc(s.modelUUID, kind, series, arch) if err != nil { return nil, nil, err } session := s.blobDb.Session.Copy() managedStorage := s.getManagedStorage(session) image, err := s.imageBlob(m...
go
func (s *imageStorage) Image(kind, series, arch string) (*Metadata, io.ReadCloser, error) { metadataDoc, err := s.imageMetadataDoc(s.modelUUID, kind, series, arch) if err != nil { return nil, nil, err } session := s.blobDb.Session.Copy() managedStorage := s.getManagedStorage(session) image, err := s.imageBlob(m...
[ "func", "(", "s", "*", "imageStorage", ")", "Image", "(", "kind", ",", "series", ",", "arch", "string", ")", "(", "*", "Metadata", ",", "io", ".", "ReadCloser", ",", "error", ")", "{", "metadataDoc", ",", "err", ":=", "s", ".", "imageMetadataDoc", "(...
// Image is defined on the Storage interface.
[ "Image", "is", "defined", "on", "the", "Storage", "interface", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/imagestorage/image.go#L230-L256
4,071
juju/juju
state/imagestorage/image.go
imagePath
func imagePath(kind, series, arch, checksum string) string { return fmt.Sprintf("images/%s-%s-%s:%s", kind, series, arch, checksum) }
go
func imagePath(kind, series, arch, checksum string) string { return fmt.Sprintf("images/%s-%s-%s:%s", kind, series, arch, checksum) }
[ "func", "imagePath", "(", "kind", ",", "series", ",", "arch", ",", "checksum", "string", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "kind", ",", "series", ",", "arch", ",", "checksum", ")", "\n", "}" ]
// imagePath returns the storage path for the specified image.
[ "imagePath", "returns", "the", "storage", "path", "for", "the", "specified", "image", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/imagestorage/image.go#L309-L311
4,072
juju/juju
state/imagestorage/image.go
docId
func docId(metadata *Metadata) string { return fmt.Sprintf("%s-%s-%s-%s", metadata.ModelUUID, metadata.Kind, metadata.Series, metadata.Arch) }
go
func docId(metadata *Metadata) string { return fmt.Sprintf("%s-%s-%s-%s", metadata.ModelUUID, metadata.Kind, metadata.Series, metadata.Arch) }
[ "func", "docId", "(", "metadata", "*", "Metadata", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "metadata", ".", "ModelUUID", ",", "metadata", ".", "Kind", ",", "metadata", ".", "Series", ",", "metadata", ".", "Arch", ")",...
// docId returns an id for the mongo image metadata document.
[ "docId", "returns", "an", "id", "for", "the", "mongo", "image", "metadata", "document", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/imagestorage/image.go#L314-L316
4,073
juju/juju
worker/uniter/charm/charm.go
ReadCharmURL
func ReadCharmURL(path string) (*charm.URL, error) { surl := "" if err := utils.ReadYaml(path, &surl); err != nil { return nil, err } return charm.ParseURL(surl) }
go
func ReadCharmURL(path string) (*charm.URL, error) { surl := "" if err := utils.ReadYaml(path, &surl); err != nil { return nil, err } return charm.ParseURL(surl) }
[ "func", "ReadCharmURL", "(", "path", "string", ")", "(", "*", "charm", ".", "URL", ",", "error", ")", "{", "surl", ":=", "\"", "\"", "\n", "if", "err", ":=", "utils", ".", "ReadYaml", "(", "path", ",", "&", "surl", ")", ";", "err", "!=", "nil", ...
// ReadCharmURL reads a charm identity file from the supplied path.
[ "ReadCharmURL", "reads", "a", "charm", "identity", "file", "from", "the", "supplied", "path", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/uniter/charm/charm.go#L76-L82
4,074
juju/juju
worker/uniter/charm/charm.go
WriteCharmURL
func WriteCharmURL(path string, url *charm.URL) error { return utils.WriteYaml(path, url.String()) }
go
func WriteCharmURL(path string, url *charm.URL) error { return utils.WriteYaml(path, url.String()) }
[ "func", "WriteCharmURL", "(", "path", "string", ",", "url", "*", "charm", ".", "URL", ")", "error", "{", "return", "utils", ".", "WriteYaml", "(", "path", ",", "url", ".", "String", "(", ")", ")", "\n", "}" ]
// WriteCharmURL writes a charm identity file into the supplied path.
[ "WriteCharmURL", "writes", "a", "charm", "identity", "file", "into", "the", "supplied", "path", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/uniter/charm/charm.go#L85-L87
4,075
juju/juju
core/cache/charm.go
LXDProfile
func (c *Charm) LXDProfile() lxdprofile.Profile { c.mu.Lock() defer c.mu.Unlock() return c.details.LXDProfile }
go
func (c *Charm) LXDProfile() lxdprofile.Profile { c.mu.Lock() defer c.mu.Unlock() return c.details.LXDProfile }
[ "func", "(", "c", "*", "Charm", ")", "LXDProfile", "(", ")", "lxdprofile", ".", "Profile", "{", "c", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "mu", ".", "Unlock", "(", ")", "\n", "return", "c", ".", "details", ".", "LXDProfile",...
// LXDProfile returns the lxd profile of this charm.
[ "LXDProfile", "returns", "the", "lxd", "profile", "of", "this", "charm", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/core/cache/charm.go#L38-L42
4,076
juju/juju
cmd/juju/firewall/setrule.go
NewSetFirewallRuleCommand
func NewSetFirewallRuleCommand() cmd.Command { cmd := &setFirewallRuleCommand{} cmd.newAPIFunc = func() (SetFirewallRuleAPI, error) { root, err := cmd.NewAPIRoot() if err != nil { return nil, errors.Trace(err) } return firewallrules.NewClient(root), nil } return modelcmd.Wrap(cmd) }
go
func NewSetFirewallRuleCommand() cmd.Command { cmd := &setFirewallRuleCommand{} cmd.newAPIFunc = func() (SetFirewallRuleAPI, error) { root, err := cmd.NewAPIRoot() if err != nil { return nil, errors.Trace(err) } return firewallrules.NewClient(root), nil } return modelcmd.Wrap(cmd) }
[ "func", "NewSetFirewallRuleCommand", "(", ")", "cmd", ".", "Command", "{", "cmd", ":=", "&", "setFirewallRuleCommand", "{", "}", "\n", "cmd", ".", "newAPIFunc", "=", "func", "(", ")", "(", "SetFirewallRuleAPI", ",", "error", ")", "{", "root", ",", "err", ...
// NewSetFirewallRuleCommand returns a command to set firewall rules.
[ "NewSetFirewallRuleCommand", "returns", "a", "command", "to", "set", "firewall", "rules", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/firewall/setrule.go#L41-L52
4,077
juju/juju
worker/controller/tracker.go
Use
func (c *tracker) Use() (*state.Controller, error) { c.mu.Lock() defer c.mu.Unlock() if c.references == 0 { return nil, ErrControllerClosed } c.references++ return c.st, nil }
go
func (c *tracker) Use() (*state.Controller, error) { c.mu.Lock() defer c.mu.Unlock() if c.references == 0 { return nil, ErrControllerClosed } c.references++ return c.st, nil }
[ "func", "(", "c", "*", "tracker", ")", "Use", "(", ")", "(", "*", "state", ".", "Controller", ",", "error", ")", "{", "c", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "if", "c", ".", "re...
// Use implements Tracker.
[ "Use", "implements", "Tracker", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/controller/tracker.go#L50-L59
4,078
juju/juju
worker/controller/tracker.go
Done
func (c *tracker) Done() error { c.mu.Lock() defer c.mu.Unlock() if c.references == 0 { return ErrControllerClosed } c.references-- if c.references == 0 { err := c.st.Close() if err != nil { logger.Errorf("error when closing controller: %v", err) } } return nil }
go
func (c *tracker) Done() error { c.mu.Lock() defer c.mu.Unlock() if c.references == 0 { return ErrControllerClosed } c.references-- if c.references == 0 { err := c.st.Close() if err != nil { logger.Errorf("error when closing controller: %v", err) } } return nil }
[ "func", "(", "c", "*", "tracker", ")", "Done", "(", ")", "error", "{", "c", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "if", "c", ".", "references", "==", "0", "{", "return", "ErrController...
// Done implements Tracker.
[ "Done", "implements", "Tracker", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/controller/tracker.go#L62-L77
4,079
juju/juju
state/resources_mongo.go
resourceID
func resourceID(id, subType, subID string) string { if subType == "" { return fmt.Sprintf("resource#%s", id) } return fmt.Sprintf("resource#%s#%s-%s", id, subType, subID) }
go
func resourceID(id, subType, subID string) string { if subType == "" { return fmt.Sprintf("resource#%s", id) } return fmt.Sprintf("resource#%s#%s-%s", id, subType, subID) }
[ "func", "resourceID", "(", "id", ",", "subType", ",", "subID", "string", ")", "string", "{", "if", "subType", "==", "\"", "\"", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "id", ")", "\n", "}", "\n", "return", "fmt", ".", "Sprintf",...
// resourceID converts an external resource ID into an internal one.
[ "resourceID", "converts", "an", "external", "resource", "ID", "into", "an", "internal", "one", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/resources_mongo.go#L27-L32
4,080
juju/juju
state/resources_mongo.go
newResolvePendingResourceOps
func newResolvePendingResourceOps(pending storedResource, exists bool) []txn.Op { oldID := pendingResourceID(pending.ID, pending.PendingID) newRes := pending newRes.PendingID = "" // TODO(ericsnow) Update newRes.StoragePath? Doing so would require // moving the resource in the blobstore to the correct path, which ...
go
func newResolvePendingResourceOps(pending storedResource, exists bool) []txn.Op { oldID := pendingResourceID(pending.ID, pending.PendingID) newRes := pending newRes.PendingID = "" // TODO(ericsnow) Update newRes.StoragePath? Doing so would require // moving the resource in the blobstore to the correct path, which ...
[ "func", "newResolvePendingResourceOps", "(", "pending", "storedResource", ",", "exists", "bool", ")", "[", "]", "txn", ".", "Op", "{", "oldID", ":=", "pendingResourceID", "(", "pending", ".", "ID", ",", "pending", ".", "PendingID", ")", "\n", "newRes", ":=",...
// newResolvePendingResourceOps generates transaction operations that // will resolve a pending resource doc and make it active. // // We trust that the provided resource really is pending // and that it matches the existing doc with the same ID.
[ "newResolvePendingResourceOps", "generates", "transaction", "operations", "that", "will", "resolve", "a", "pending", "resource", "doc", "and", "make", "it", "active", ".", "We", "trust", "that", "the", "provided", "resource", "really", "is", "pending", "and", "tha...
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/resources_mongo.go#L223-L254
4,081
juju/juju
state/resources_mongo.go
newCharmStoreResourceDoc
func newCharmStoreResourceDoc(res charmStoreResource) *resourceDoc { fullID := charmStoreResourceID(res.id) return charmStoreResource2Doc(fullID, res) }
go
func newCharmStoreResourceDoc(res charmStoreResource) *resourceDoc { fullID := charmStoreResourceID(res.id) return charmStoreResource2Doc(fullID, res) }
[ "func", "newCharmStoreResourceDoc", "(", "res", "charmStoreResource", ")", "*", "resourceDoc", "{", "fullID", ":=", "charmStoreResourceID", "(", "res", ".", "id", ")", "\n", "return", "charmStoreResource2Doc", "(", "fullID", ",", "res", ")", "\n", "}" ]
// newCharmStoreResourceDoc generates a doc that represents the given resource.
[ "newCharmStoreResourceDoc", "generates", "a", "doc", "that", "represents", "the", "given", "resource", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/resources_mongo.go#L257-L260
4,082
juju/juju
state/resources_mongo.go
newUnitResourceDoc
func newUnitResourceDoc(unitID string, stored storedResource) *resourceDoc { fullID := unitResourceID(stored.ID, unitID) return unitResource2Doc(fullID, unitID, stored) }
go
func newUnitResourceDoc(unitID string, stored storedResource) *resourceDoc { fullID := unitResourceID(stored.ID, unitID) return unitResource2Doc(fullID, unitID, stored) }
[ "func", "newUnitResourceDoc", "(", "unitID", "string", ",", "stored", "storedResource", ")", "*", "resourceDoc", "{", "fullID", ":=", "unitResourceID", "(", "stored", ".", "ID", ",", "unitID", ")", "\n", "return", "unitResource2Doc", "(", "fullID", ",", "unitI...
// newUnitResourceDoc generates a doc that represents the given resource.
[ "newUnitResourceDoc", "generates", "a", "doc", "that", "represents", "the", "given", "resource", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/resources_mongo.go#L263-L266
4,083
juju/juju
state/resources_mongo.go
newResourceDoc
func newResourceDoc(stored storedResource) *resourceDoc { fullID := applicationResourceID(stored.ID) if stored.PendingID != "" { fullID = pendingResourceID(stored.ID, stored.PendingID) } return resource2doc(fullID, stored) }
go
func newResourceDoc(stored storedResource) *resourceDoc { fullID := applicationResourceID(stored.ID) if stored.PendingID != "" { fullID = pendingResourceID(stored.ID, stored.PendingID) } return resource2doc(fullID, stored) }
[ "func", "newResourceDoc", "(", "stored", "storedResource", ")", "*", "resourceDoc", "{", "fullID", ":=", "applicationResourceID", "(", "stored", ".", "ID", ")", "\n", "if", "stored", ".", "PendingID", "!=", "\"", "\"", "{", "fullID", "=", "pendingResourceID", ...
// newResourceDoc generates a doc that represents the given resource.
[ "newResourceDoc", "generates", "a", "doc", "that", "represents", "the", "given", "resource", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/resources_mongo.go#L269-L275
4,084
juju/juju
state/resources_mongo.go
newStagedResourceDoc
func newStagedResourceDoc(stored storedResource) *resourceDoc { stagedID := stagedResourceID(stored.ID) return resource2doc(stagedID, stored) }
go
func newStagedResourceDoc(stored storedResource) *resourceDoc { stagedID := stagedResourceID(stored.ID) return resource2doc(stagedID, stored) }
[ "func", "newStagedResourceDoc", "(", "stored", "storedResource", ")", "*", "resourceDoc", "{", "stagedID", ":=", "stagedResourceID", "(", "stored", ".", "ID", ")", "\n", "return", "resource2doc", "(", "stagedID", ",", "stored", ")", "\n", "}" ]
// newStagedResourceDoc generates a staging doc that represents // the given resource.
[ "newStagedResourceDoc", "generates", "a", "staging", "doc", "that", "represents", "the", "given", "resource", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/resources_mongo.go#L279-L282
4,085
juju/juju
state/resources_mongo.go
resources
func (p ResourcePersistence) resources(applicationID string) ([]resourceDoc, error) { logger.Tracef("querying db for resources for %q", applicationID) var docs []resourceDoc query := bson.D{{"application-id", applicationID}} if err := p.base.All(resourcesC, query, &docs); err != nil { return nil, errors.Trace(err...
go
func (p ResourcePersistence) resources(applicationID string) ([]resourceDoc, error) { logger.Tracef("querying db for resources for %q", applicationID) var docs []resourceDoc query := bson.D{{"application-id", applicationID}} if err := p.base.All(resourcesC, query, &docs); err != nil { return nil, errors.Trace(err...
[ "func", "(", "p", "ResourcePersistence", ")", "resources", "(", "applicationID", "string", ")", "(", "[", "]", "resourceDoc", ",", "error", ")", "{", "logger", ".", "Tracef", "(", "\"", "\"", ",", "applicationID", ")", "\n", "var", "docs", "[", "]", "r...
// resources returns the resource docs for the given application.
[ "resources", "returns", "the", "resource", "docs", "for", "the", "given", "application", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/resources_mongo.go#L285-L294
4,086
juju/juju
state/resources_mongo.go
getOne
func (p ResourcePersistence) getOne(resID string) (resourceDoc, error) { logger.Tracef("querying db for resource %q", resID) id := applicationResourceID(resID) var doc resourceDoc if err := p.base.One(resourcesC, id, &doc); err != nil { return doc, errors.Trace(err) } return doc, nil }
go
func (p ResourcePersistence) getOne(resID string) (resourceDoc, error) { logger.Tracef("querying db for resource %q", resID) id := applicationResourceID(resID) var doc resourceDoc if err := p.base.One(resourcesC, id, &doc); err != nil { return doc, errors.Trace(err) } return doc, nil }
[ "func", "(", "p", "ResourcePersistence", ")", "getOne", "(", "resID", "string", ")", "(", "resourceDoc", ",", "error", ")", "{", "logger", ".", "Tracef", "(", "\"", "\"", ",", "resID", ")", "\n", "id", ":=", "applicationResourceID", "(", "resID", ")", ...
// getOne returns the resource that matches the provided model ID.
[ "getOne", "returns", "the", "resource", "that", "matches", "the", "provided", "model", "ID", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/resources_mongo.go#L306-L314
4,087
juju/juju
state/resources_mongo.go
getOnePending
func (p ResourcePersistence) getOnePending(resID, pendingID string) (resourceDoc, error) { logger.Tracef("querying db for resource %q (pending %q)", resID, pendingID) id := pendingResourceID(resID, pendingID) var doc resourceDoc if err := p.base.One(resourcesC, id, &doc); err != nil { return doc, errors.Trace(err...
go
func (p ResourcePersistence) getOnePending(resID, pendingID string) (resourceDoc, error) { logger.Tracef("querying db for resource %q (pending %q)", resID, pendingID) id := pendingResourceID(resID, pendingID) var doc resourceDoc if err := p.base.One(resourcesC, id, &doc); err != nil { return doc, errors.Trace(err...
[ "func", "(", "p", "ResourcePersistence", ")", "getOnePending", "(", "resID", ",", "pendingID", "string", ")", "(", "resourceDoc", ",", "error", ")", "{", "logger", ".", "Tracef", "(", "\"", "\"", ",", "resID", ",", "pendingID", ")", "\n", "id", ":=", "...
// getOnePending returns the resource that matches the provided model ID.
[ "getOnePending", "returns", "the", "resource", "that", "matches", "the", "provided", "model", "ID", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/resources_mongo.go#L317-L325
4,088
juju/juju
state/resources_mongo.go
resource2doc
func resource2doc(id string, stored storedResource) *resourceDoc { res := stored.Resource // TODO(ericsnow) We may need to limit the resolution of timestamps // in order to avoid some conversion problems from Mongo. return &resourceDoc{ DocID: id, ID: res.ID, PendingID: res.PendingID, Applicatio...
go
func resource2doc(id string, stored storedResource) *resourceDoc { res := stored.Resource // TODO(ericsnow) We may need to limit the resolution of timestamps // in order to avoid some conversion problems from Mongo. return &resourceDoc{ DocID: id, ID: res.ID, PendingID: res.PendingID, Applicatio...
[ "func", "resource2doc", "(", "id", "string", ",", "stored", "storedResource", ")", "*", "resourceDoc", "{", "res", ":=", "stored", ".", "Resource", "\n", "// TODO(ericsnow) We may need to limit the resolution of timestamps", "// in order to avoid some conversion problems from M...
// resource2doc converts the resource into a DB doc.
[ "resource2doc", "converts", "the", "resource", "into", "a", "DB", "doc", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/resources_mongo.go#L376-L402
4,089
juju/juju
state/resources_mongo.go
doc2resource
func doc2resource(doc resourceDoc) (storedResource, error) { res, err := doc2basicResource(doc) if err != nil { return storedResource{}, errors.Trace(err) } stored := storedResource{ Resource: res, storagePath: doc.StoragePath, } return stored, nil }
go
func doc2resource(doc resourceDoc) (storedResource, error) { res, err := doc2basicResource(doc) if err != nil { return storedResource{}, errors.Trace(err) } stored := storedResource{ Resource: res, storagePath: doc.StoragePath, } return stored, nil }
[ "func", "doc2resource", "(", "doc", "resourceDoc", ")", "(", "storedResource", ",", "error", ")", "{", "res", ",", "err", ":=", "doc2basicResource", "(", "doc", ")", "\n", "if", "err", "!=", "nil", "{", "return", "storedResource", "{", "}", ",", "errors"...
// doc2resource returns the resource info represented by the doc.
[ "doc2resource", "returns", "the", "resource", "info", "represented", "by", "the", "doc", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/resources_mongo.go#L405-L416
4,090
juju/juju
state/resources_mongo.go
doc2basicResource
func doc2basicResource(doc resourceDoc) (resource.Resource, error) { var res resource.Resource resType, err := charmresource.ParseType(doc.Type) if err != nil { return res, errors.Annotate(err, "got invalid data from DB") } origin, err := charmresource.ParseOrigin(doc.Origin) if err != nil { return res, err...
go
func doc2basicResource(doc resourceDoc) (resource.Resource, error) { var res resource.Resource resType, err := charmresource.ParseType(doc.Type) if err != nil { return res, errors.Annotate(err, "got invalid data from DB") } origin, err := charmresource.ParseOrigin(doc.Origin) if err != nil { return res, err...
[ "func", "doc2basicResource", "(", "doc", "resourceDoc", ")", "(", "resource", ".", "Resource", ",", "error", ")", "{", "var", "res", "resource", ".", "Resource", "\n\n", "resType", ",", "err", ":=", "charmresource", ".", "ParseType", "(", "doc", ".", "Type...
// doc2basicResource returns the resource info represented by the doc.
[ "doc2basicResource", "returns", "the", "resource", "info", "represented", "by", "the", "doc", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/resources_mongo.go#L419-L460
4,091
juju/juju
api/logstream/logstream.go
Close
func (ls *LogStream) Close() error { ls.mu.Lock() defer ls.mu.Unlock() if ls.stream == nil { return nil } if err := ls.stream.Close(); err != nil { return errors.Trace(err) } ls.stream = nil return nil }
go
func (ls *LogStream) Close() error { ls.mu.Lock() defer ls.mu.Unlock() if ls.stream == nil { return nil } if err := ls.stream.Close(); err != nil { return errors.Trace(err) } ls.stream = nil return nil }
[ "func", "(", "ls", "*", "LogStream", ")", "Close", "(", ")", "error", "{", "ls", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "ls", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "if", "ls", ".", "stream", "==", "nil", "{", "return", "nil", ...
// Close closes the stream.
[ "Close", "closes", "the", "stream", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/logstream/logstream.go#L106-L118
4,092
juju/juju
worker/upgradeseries/worker.go
Validate
func (config Config) Validate() error { if config.Logger == nil { return errors.NotValidf("nil Logger") } if config.Tag == nil { return errors.NotValidf("nil machine tag") } k := config.Tag.Kind() if k != names.MachineTagKind { return errors.NotValidf("%q tag kind", k) } if config.FacadeFactory == nil { ...
go
func (config Config) Validate() error { if config.Logger == nil { return errors.NotValidf("nil Logger") } if config.Tag == nil { return errors.NotValidf("nil machine tag") } k := config.Tag.Kind() if k != names.MachineTagKind { return errors.NotValidf("%q tag kind", k) } if config.FacadeFactory == nil { ...
[ "func", "(", "config", "Config", ")", "Validate", "(", ")", "error", "{", "if", "config", ".", "Logger", "==", "nil", "{", "return", "errors", ".", "NotValidf", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "config", ".", "Tag", "==", "nil", "{", ...
// Validate validates the upgrade-series worker configuration.
[ "Validate", "validates", "the", "upgrade", "-", "series", "worker", "configuration", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/upgradeseries/worker.go#L55-L73
4,093
juju/juju
worker/upgradeseries/worker.go
NewWorker
func NewWorker(config Config) (worker.Worker, error) { if err := config.Validate(); err != nil { return nil, errors.Trace(err) } w := &upgradeSeriesWorker{ Facade: config.FacadeFactory(config.Tag), facadeFactory: config.FacadeFactory, logger: config.Logger, service: config.Serv...
go
func NewWorker(config Config) (worker.Worker, error) { if err := config.Validate(); err != nil { return nil, errors.Trace(err) } w := &upgradeSeriesWorker{ Facade: config.FacadeFactory(config.Tag), facadeFactory: config.FacadeFactory, logger: config.Logger, service: config.Serv...
[ "func", "NewWorker", "(", "config", "Config", ")", "(", "worker", ".", "Worker", ",", "error", ")", "{", "if", "err", ":=", "config", ".", "Validate", "(", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Trace", "(", "err",...
// NewWorker creates, starts and returns a new upgrade-series worker based on // the input configuration.
[ "NewWorker", "creates", "starts", "and", "returns", "a", "new", "upgrade", "-", "series", "worker", "based", "on", "the", "input", "configuration", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/upgradeseries/worker.go#L105-L128
4,094
juju/juju
worker/upgradeseries/worker.go
handleUpgradeSeriesChange
func (w *upgradeSeriesWorker) handleUpgradeSeriesChange() error { w.mu.Lock() defer w.mu.Unlock() var err error if w.machineStatus, err = w.MachineStatus(); err != nil { if errors.IsNotFound(err) { // No upgrade-series lock. This can happen when: // - The first watch call is made. // - The lock is remov...
go
func (w *upgradeSeriesWorker) handleUpgradeSeriesChange() error { w.mu.Lock() defer w.mu.Unlock() var err error if w.machineStatus, err = w.MachineStatus(); err != nil { if errors.IsNotFound(err) { // No upgrade-series lock. This can happen when: // - The first watch call is made. // - The lock is remov...
[ "func", "(", "w", "*", "upgradeSeriesWorker", ")", "handleUpgradeSeriesChange", "(", ")", "error", "{", "w", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "w", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "var", "err", "error", "\n", "if", "w", "...
// handleUpgradeSeriesChange retrieves the current upgrade-series status for // this machine and based on the status, calls methods that will progress // the workflow accordingly.
[ "handleUpgradeSeriesChange", "retrieves", "the", "current", "upgrade", "-", "series", "status", "for", "this", "machine", "and", "based", "on", "the", "status", "calls", "methods", "that", "will", "progress", "the", "workflow", "accordingly", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/upgradeseries/worker.go#L154-L183
4,095
juju/juju
worker/upgradeseries/worker.go
handlePrepareStarted
func (w *upgradeSeriesWorker) handlePrepareStarted() error { var err error if !w.leadersPinned { if err = w.pinLeaders(); err != nil { return errors.Trace(err) } } if w.preparedUnits, err = w.UnitsPrepared(); err != nil { return errors.Trace(err) } unitServices, allConfirmed, err := w.compareUnitAgentS...
go
func (w *upgradeSeriesWorker) handlePrepareStarted() error { var err error if !w.leadersPinned { if err = w.pinLeaders(); err != nil { return errors.Trace(err) } } if w.preparedUnits, err = w.UnitsPrepared(); err != nil { return errors.Trace(err) } unitServices, allConfirmed, err := w.compareUnitAgentS...
[ "func", "(", "w", "*", "upgradeSeriesWorker", ")", "handlePrepareStarted", "(", ")", "error", "{", "var", "err", "error", "\n", "if", "!", "w", ".", "leadersPinned", "{", "if", "err", "=", "w", ".", "pinLeaders", "(", ")", ";", "err", "!=", "nil", "{...
// handlePrepareStarted handles workflow for the machine with an upgrade-series // lock status of "UpgradeSeriesPrepareStarted"
[ "handlePrepareStarted", "handles", "workflow", "for", "the", "machine", "with", "an", "upgrade", "-", "series", "lock", "status", "of", "UpgradeSeriesPrepareStarted" ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/upgradeseries/worker.go#L187-L212
4,096
juju/juju
worker/upgradeseries/worker.go
transitionPrepareComplete
func (w *upgradeSeriesWorker) transitionPrepareComplete(unitServices map[string]string) error { w.logger.Infof("preparing service units for series upgrade") toSeries, err := w.TargetSeries() if err != nil { return errors.Trace(err) } upgrader, err := w.upgraderFactory(toSeries) if err != nil { return errors.T...
go
func (w *upgradeSeriesWorker) transitionPrepareComplete(unitServices map[string]string) error { w.logger.Infof("preparing service units for series upgrade") toSeries, err := w.TargetSeries() if err != nil { return errors.Trace(err) } upgrader, err := w.upgraderFactory(toSeries) if err != nil { return errors.T...
[ "func", "(", "w", "*", "upgradeSeriesWorker", ")", "transitionPrepareComplete", "(", "unitServices", "map", "[", "string", "]", "string", ")", "error", "{", "w", ".", "logger", ".", "Infof", "(", "\"", "\"", ")", "\n", "toSeries", ",", "err", ":=", "w", ...
// transitionPrepareComplete rewrites service unit files for unit agents running // on this machine so that they are compatible with the init system of the // series upgrade target.
[ "transitionPrepareComplete", "rewrites", "service", "unit", "files", "for", "unit", "agents", "running", "on", "this", "machine", "so", "that", "they", "are", "compatible", "with", "the", "init", "system", "of", "the", "series", "upgrade", "target", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/upgradeseries/worker.go#L217-L232
4,097
juju/juju
worker/upgradeseries/worker.go
transitionUnitsStarted
func (w *upgradeSeriesWorker) transitionUnitsStarted(unitServices map[string]string) error { w.logger.Infof("ensuring units are up after series upgrade") for unit, serviceName := range unitServices { svc, err := w.service.DiscoverService(serviceName) if err != nil { return errors.Trace(err) } running, err...
go
func (w *upgradeSeriesWorker) transitionUnitsStarted(unitServices map[string]string) error { w.logger.Infof("ensuring units are up after series upgrade") for unit, serviceName := range unitServices { svc, err := w.service.DiscoverService(serviceName) if err != nil { return errors.Trace(err) } running, err...
[ "func", "(", "w", "*", "upgradeSeriesWorker", ")", "transitionUnitsStarted", "(", "unitServices", "map", "[", "string", "]", "string", ")", "error", "{", "w", ".", "logger", ".", "Infof", "(", "\"", "\"", ")", "\n\n", "for", "unit", ",", "serviceName", "...
// transitionUnitsStarted iterates over units managed by this machine. Starts // the unit's agent service, and transitions all unit subordinate statuses.
[ "transitionUnitsStarted", "iterates", "over", "units", "managed", "by", "this", "machine", ".", "Starts", "the", "unit", "s", "agent", "service", "and", "transitions", "all", "unit", "subordinate", "statuses", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/upgradeseries/worker.go#L278-L299
4,098
juju/juju
worker/upgradeseries/worker.go
handleCompleted
func (w *upgradeSeriesWorker) handleCompleted() error { s, err := hostSeries() if err != nil { return errors.Trace(err) } if err = w.FinishUpgradeSeries(s); err != nil { return errors.Trace(err) } return errors.Trace(w.unpinLeaders()) }
go
func (w *upgradeSeriesWorker) handleCompleted() error { s, err := hostSeries() if err != nil { return errors.Trace(err) } if err = w.FinishUpgradeSeries(s); err != nil { return errors.Trace(err) } return errors.Trace(w.unpinLeaders()) }
[ "func", "(", "w", "*", "upgradeSeriesWorker", ")", "handleCompleted", "(", ")", "error", "{", "s", ",", "err", ":=", "hostSeries", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Trace", "(", "err", ")", "\n", "}", "\n", "i...
// handleCompleted notifies the server that it has completed the upgrade // workflow, then unpins leadership for applications running on the machine.
[ "handleCompleted", "notifies", "the", "server", "that", "it", "has", "completed", "the", "upgrade", "workflow", "then", "unpins", "leadership", "for", "applications", "running", "on", "the", "machine", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/upgradeseries/worker.go#L303-L312
4,099
juju/juju
worker/upgradeseries/worker.go
pinLeaders
func (w *upgradeSeriesWorker) pinLeaders() (err error) { // if we encounter an error, // attempt to ensure that no application leaders remain pinned. defer func() { if err != nil { if unpinErr := w.unpinLeaders(); unpinErr != nil { err = errors.Wrap(err, unpinErr) } } }() results, err := w.PinMachin...
go
func (w *upgradeSeriesWorker) pinLeaders() (err error) { // if we encounter an error, // attempt to ensure that no application leaders remain pinned. defer func() { if err != nil { if unpinErr := w.unpinLeaders(); unpinErr != nil { err = errors.Wrap(err, unpinErr) } } }() results, err := w.PinMachin...
[ "func", "(", "w", "*", "upgradeSeriesWorker", ")", "pinLeaders", "(", ")", "(", "err", "error", ")", "{", "// if we encounter an error,", "// attempt to ensure that no application leaders remain pinned.", "defer", "func", "(", ")", "{", "if", "err", "!=", "nil", "{"...
// pinLeaders pins leadership for applications // represented by units running on this machine.
[ "pinLeaders", "pins", "leadership", "for", "applications", "represented", "by", "units", "running", "on", "this", "machine", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/upgradeseries/worker.go#L343-L382