anchor
dict
positive
dict
negative
dict
{ "audio": "", "image": "", "text": "func NewCertificate(certPEM, keyPEM []byte) *Certificate {\n\treturn &Certificate{", "video": "" }
{ "audio": "", "image": "", "text": "\n\t\tCertPEM: certPEM,\n\t\tKeyPEM: keyPEM,\n\t}\n}", "video": "" }
{ "audio": "", "image": "", "text": " \"CERTIFICATE\", Bytes: certBytes})\n\tkeypem := pem.EncodeToMemory(pemBlockForKey(privateKey))\n\treturn certpem, keypem, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (c *Certificate) Validate() error {\n\tif len(c.CertPEM) == 0 {\n\t\treturn errors.NotValidf(\"missing cert PEM\")\n\t}\n\tif len(c.KeyPEM) == 0", "video": "" }
{ "audio": "", "image": "", "text": " {\n\t\treturn errors.NotValidf(\"missing key PEM\")\n\t}\n\treturn nil\n}", "video": "" }
{ "audio": "", "image": "", "text": " _, c := range actual {\n\t\t// remove value c from exp\n\t\tfor i := 0; i < len(exp); i++ {\n\t\t\tif exp[i] == c {\n\t\t\t\texp = removeListElement(exp, i)\n\t\t\t\tif len(exp) == 0 {\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn len(exp) == 0\n}", "vide...
{ "audio": "", "image": "", "text": "func (c *Certificate) WriteCertPEM(out io.Writer) error {\n\t_,", "video": "" }
{ "audio": "", "image": "", "text": " err := out.Write(c.CertPEM)\n\treturn errors.Trace(err)\n}", "video": "" }
{ "audio": "", "image": "", "text": "\n\n\t// If the out writer supports io.Closer, Close it.\n\tif c, ok := t.out.(io.Closer); ok {\n\t\tc.Close()\n\t}\n\treturn err\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (c *Certificate) WriteKeyPEM(out io.Writer) error {\n\t_,", "video": "" }
{ "audio": "", "image": "", "text": " err := out.Write(c.KeyPEM)\n\treturn errors.Trace(err)\n}", "video": "" }
{ "audio": "", "image": "", "text": "\n\n\t// If the out writer supports io.Closer, Close it.\n\tif c, ok := t.out.(io.Closer); ok {\n\t\tc.Close()\n\t}\n\treturn err\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (c *Certificate) Fingerprint() (string, error) {\n\tx509Cert, err := c.X509()\n\tif err != nil {\n\t\treturn \"\", errors.Trace(err)", "video": "" }
{ "audio": "", "image": "", "text": "\n\t}\n\tdata := sha256.Sum256(x509Cert.Raw)\n\treturn fmt.Sprintf(\"%x\", data), nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "\t\tfilepath.Walk(rootPath, func(path string, info os.FileInfo, err error) error {\n\t\t\t\tmatched, err := filepath.Match(\"*.json\", info.Name())\n\t\t\t\tif err != nil {\n\t\t\t\t\twarn(err)\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\tif matched {\n\t\t\t\t\tc <- path\n\t\t\t...
{ "audio": "", "image": "", "text": "func (c *Certificate) X509() (*x509.Certificate, error) {\n\tblock, _ := pem.Decode(c.CertPEM)\n\tif block == nil {\n\t\treturn nil, errors.Errorf(\"invalid cert PEM (%d bytes)\", len(c.CertPEM))\n\t}\n\n", "video": "" }
{ "audio": "", "image": "", "text": "\tx509Cert, err := x509.ParseCertificate(block.Bytes)\n\tif err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\treturn x509Cert, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "\tfmt.Println(err)\n\t\treturn nil\n\t}\n\t// decode pem\n\tblock, _ := pem.Decode(derBytes)\n\tif block != nil {\n\t\tderBytes = block.Bytes\n\t}\n\treturn derBytes\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (c *Certificate) AsCreateRequest() (api.CertificatesPost, error) {\n\tblock, _ := pem.Decode(c.CertPEM)\n\tif block == nil {\n\t\treturn api.CertificatesPost{}, errors.New(\"failed to decode certificate PEM\")\n\t}\n\n", "video": "" }
{ "audio": "", "image": "", "text": "\treturn api.CertificatesPost{\n\t\tCertificate: base64.StdEncoding.EncodeToString(block.Bytes),\n\t\tCertificatePut: api.CertificatePut{\n\t\t\tName: c.Name,\n\t\t\tType: \"client\",\n\t\t},\n\t}, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "\tfmt.Println(err)\n\t\treturn nil\n\t}\n\t// decode pem\n\tblock, _ := pem.Decode(derBytes)\n\tif block != nil {\n\t\tderBytes = block.Bytes\n\t}\n\treturn derBytes\n}", "video": "" }
{ "audio": "", "image": "", "text": "func stateStepsFor253() []Step {\n\treturn []Step{\n\t\t&upgradeStep{\n\t\t\tdescription: \"update inherited controller config global", "video": "" }
{ "audio": "", "image": "", "text": " key\",\n\t\t\ttargets: []Target{DatabaseMaster},\n\t\t\trun: func(context Context) error {\n\t\t\t\treturn context.State().UpdateInheritedControllerConfig()\n\t\t\t},\n\t\t},\n\t}\n}", "video": "" }
{ "audio": "", "image": "", "text": " sync,\n\t}\n\n\tcontroller.logger.Log(\"info\", \"setting up event handlers\")\n\n\t// ----- EVENT HANDLERS for HelmRelease resources change ---------\n\tfhrInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{\n\t\tAddFunc: func(new interface{}) {\n...
{ "audio": "", "image": "", "text": "func (m *CAASModel) SetPodSpec(appTag names.ApplicationTag, spec string) error {\n\tbuildTxn := func(attempt int) ([]txn.Op, error) {\n\t\tvar prereqOps []txn.Op\n\t\tapp, err := m.State().Application(appTag.Id())\n\t\tif err != nil {\n\t\t\treturn nil, errors.Trace(err)\n\t\t...
{ "audio": "", "image": "", "text": " nil, jujutxn.ErrNoOperations\n\t\t\t}\n\t\t\top.Assert = txn.DocExists\n\t\t\top.Update = bson.D{{\"$set\", bson.D{{\"spec\", spec}}}}\n\t\t} else if errors.IsNotFound(err) {\n\t\t\top.Assert = txn.DocMissing\n\t\t\top.Insert = containerSpecDoc{Spec: spec}\n\t\t} else {\n\t\t...
{ "audio": "", "image": "", "text": "\t\tfor _, n := range unit.SubordinateNames() {\n\t\t\t\tapp, err := a.st.Application(unitAppName(n))\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\terr = app.VerifySupportedSeries(series, force)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\...
{ "audio": "", "image": "", "text": "func (m *CAASModel) PodSpec(appTag names.ApplicationTag) (string, error) {\n\tcoll, cleanup := m.mb.db().GetCollection(podSpecsC)\n\tdefer cleanup()\n\tvar doc containerSpecDoc\n\tif err := coll.FindId(applicationGlobalKey(appTag.Id())).One(&doc); err != nil {\n\t\tif err == m...
{ "audio": "", "image": "", "text": " errors.NotFoundf(\n\t\t\t\t\"pod spec for %s\",\n\t\t\t\tnames.ReadableString(appTag),\n\t\t\t)\n\t\t}\n\t\treturn \"\", errors.Trace(err)\n\t}\n\treturn doc.Spec, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "\tif err := coll.FindId(bson.ObjectIdHex(id)).One(result); err != nil {\n\t\tif err.Error() != mgo.ErrNotFound.Error() {\n\t\t\tlog.Printf(\"Error fetching %s with id %s. Error: %s\\n\", result.CollectionName(), id, err)\n\t\t}\n\t\treturn err\n\t}\n\treturn nil\n}", "video"...
{ "audio": "", "image": "", "text": "func (c *Client) addNetworkDevice(\n\tctx context.Context,\n\tspec *types.VirtualMachineConfigSpec,\n\tnetwork *mo.Network,\n\tmac string,\n\tdvportgroupConfig map[types.ManagedObjectReference]types.DVPortgroupConfigInfo,\n) (*types.VirtualVmxnet3, error) {\n\tvar networkBacki...
{ "audio": "", "image": "", "text": "\t\t\tPortgroupKey: dvportgroupConfig.Key,\n\t\t\t},\n\t\t}\n\t}\n\n\tvar networkDevice types.VirtualVmxnet3\n\twakeOnLan := true\n\tnetworkDevice.WakeOnLanEnabled = &wakeOnLan\n\tnetworkDevice.Backing = networkBacking\n\tif mac != \"\" {\n\t\tif !VerifyMAC(mac) {\n\t\t\tretur...
{ "audio": "", "image": "", "text": " If it's a streaming plugin, we need to signal the scheduler that\n\t// this plugin is being killed.\n\tif c, ok := a.client.(client.PluginStreamCollectorClient); ok {\n\t\tc.Killed()\n\t}\n\n\tif a.ePlugin != nil {\n\t\treturn a.ePlugin.Kill()\n\t}\n\treturn nil\n}", "video...
{ "audio": "", "image": "", "text": "func VerifyMAC(mac string) bool {\n\tparts := strings.Split(mac, \":\")\n\tif len(parts) != 6 {\n\t\treturn false\n\t}\n\tif parts[0] != \"00\" || parts[1] != \"50\" || parts[2] != \"56\" {\n\t\treturn false\n\t}\n\tfor i, part := range parts[3:] {\n", "video": "" }
{ "audio": "", "image": "", "text": "\t\tv, err := strconv.ParseUint(part, 16, 8)\n\t\tif err != nil {\n\t\t\treturn false\n\t\t}\n\t\tif i == 0 && v > 0x3f {\n\t\t\t// 4th byte must be <= 0x3f\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "video": "" }
{ "audio": "", "image": "", "text": "\n\t\tparts = set.NewStrings()\n\t\tregistered[component] = parts\n\t}\n\tif parts.Contains(part) {\n\t\treturn false\n\t}\n\tparts.Add(part)\n\treturn true\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (c *Client) computeResourceNetworks(\n\tctx context.Context,\n\tcomputeResource *mo.ComputeResource,\n) ([]mo.Network, map[types.ManagedObjectReference]types.DVPortgroupConfigInfo, error) {\n\trefsByType := make(map[string][]types.ManagedObjectReference)\n\tfor _, network...
{ "audio": "", "image": "", "text": " c.client.Retrieve(ctx, refs, nil, &dvportgroups); err != nil {\n\t\t\treturn nil, nil, errors.Annotate(err, \"retrieving distributed virtual portgroup details\")\n\t\t}\n\t\tdvportgroupConfig = make(map[types.ManagedObjectReference]types.DVPortgroupConfigInfo)\n\t\tallnetwork...
{ "audio": "", "image": "", "text": " TODO(fejta): VM name\n\n\tif spec.Refs != nil && len(spec.Refs.Pulls) > 0 {\n\t\tstarted.Pull = strconv.Itoa(spec.Refs.Pulls[0].Number)\n\t}\n\n\tstarted.Repos = map[string]string{}\n\n\tif spec.Refs != nil {\n\t\tstarted.Repos[spec.Refs.Org+\"/\"+spec.Refs.Repo] = spec.Refs....
{ "audio": "", "image": "", "text": "func (c *showMachineCommand) Init(args []string) error {\n", "video": "" }
{ "audio": "", "image": "", "text": "\tc.machineIds = args\n\treturn nil\n}", "video": "" }
{ "audio": "", "image": "", "text": " func(_ *Client, c *RemoteContext) error {\n\t\tc.Snapshotter = snapshotterName\n\t\treturn nil\n\t}\n}", "video": "" }
{ "audio": "", "image": "", "text": "func DiscoverService(name string, conf common.Conf) (Service, error) {\n\thostSeries := series.MustHostSeries()\n\tinitName, err := discoverInitSystem(hostSeries)\n\tif err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\n\tservice, err :=", "video": "" }
{ "audio": "", "image": "", "text": " newService(name, conf, initName, hostSeries)\n\tif err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\n\treturn service, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": " conf.IndexSize > 0:\n\t\t\tnidx = conf.IndexSize\n\t\t}\n\t}\n\n\tzw, err := newFlateWriter(wr, lvl)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\txw := &Writer{wr: wr, zw: zw, nchk: nchk, nidx: nidx}\n\txw.Reset(wr)\n\treturn xw, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "func VersionInitSystem(series string) (string, error) {\n\tinitName, err := versionInitSystem(series)\n\tif err != nil {\n\t\treturn \"\",", "video": "" }
{ "audio": "", "image": "", "text": " errors.Trace(err)\n\t}\n\tlogger.Debugf(\"discovered init system %q from series %q\", initName, series)\n\treturn initName, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": " string, _ string) (string, error) {\n\treturn \"\", nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "func DiscoverInitSystemScript() string {\n\trenderer := shell.BashRenderer{}\n\ttests := []string{\n\t\tdiscoverSystemd,\n\t\tdiscoverUpstart,\n\t", "video": "" }
{ "audio": "", "image": "", "text": "\t\"exit 1\",\n\t}\n\tdata := renderer.RenderScript(tests)\n\treturn string(data)\n}", "video": "" }
{ "audio": "", "image": "", "text": " {\n\treturn OnActivityEvents(activityName, []string{\n\t\tswf.EventTypeActivityTaskCompleted,\n\t}, deciders...)\n}", "video": "" }
{ "audio": "", "image": "", "text": "func newShellSelectCommand(envVarName, defaultCase string, handler func(string) (string, bool)) string {\n\tvar cases []string\n\n\tconst shellCaseStatement = `\ncase \"$%s\" in\n%s\n*)\n %s\n ;;\nesac`\n\n\tfor _, initSystem", "video": "" }
{ "audio": "", "image": "", "text": " := range linuxInitSystems {\n\t\tcmd, ok := handler(initSystem)\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\t\tcases = append(cases, initSystem+\")\", \" \"+cmd, \" ;;\")\n\t}\n\tif len(cases) == 0 {\n\t\treturn \"\"\n\t}\n\n\treturn fmt.Sprintf(shellCaseStatement[1:], envVa...
{ "audio": "", "image": "", "text": " string, _ string) (string, error) {\n\treturn \"\", nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (m *MockState) ContainerManagerConfig(arg0 params.ContainerManagerConfigParams) (params.ContainerManagerConfig, error) {\n\tret := m.ctrl.Call(m, \"ContainerManagerConfig\", arg0)\n", "video": "" }
{ "audio": "", "image": "", "text": "\tret0, _ := ret[0].(params.ContainerManagerConfig)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "video": "" }
{ "audio": "", "image": "", "text": " error {\n\tret := m.ctrl.Call(m, \"Detach\", arg0, arg1)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (mr *MockStateMockRecorder) HostChangesForContainer(arg0 interface{}) *gomock.Call {\n\treturn", "video": "" }
{ "audio": "", "image": "", "text": " mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"HostChangesForContainer\", reflect.TypeOf((*MockState)(nil).HostChangesForContainer), arg0)\n}", "video": "" }
{ "audio": "", "image": "", "text": "\n\t\treturn nil, ErrInvalidParams()\n\t}\n\n\tmr.m.RLock()\n\tmd, ok := mr.r[r.Method]\n\tmr.m.RUnlock()\n\tif !ok {\n\t\treturn nil, ErrMethodNotFound()\n\t}\n\n\treturn md.Handler, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (m *MockState) Machines(arg0 ...names_v2.MachineTag) ([]provisioner.MachineResult, error) {\n\tvarargs := []interface{}{}\n\tfor _, a := range arg0 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"Machines\",", "video": "" }
{ "audio": "", "image": "", "text": " varargs...)\n\tret0, _ := ret[0].([]provisioner.MachineResult)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "video": "" }
{ "audio": "", "image": "", "text": " append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"ListVersionsByFunctionWithContext\", varargs...)\n\tret0, _ := ret[0].(*lambda.ListVersionsByFunctionOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (c *downloadCommand) ResolveFilename() string {\n\tfilename := c.Filename\n\tif filename == \"\" {\n\t\tfilename", "video": "" }
{ "audio": "", "image": "", "text": " = backups.FilenamePrefix + c.ID + \".tar.gz\"\n\t}\n\treturn filename\n}", "video": "" }
{ "audio": "", "image": "", "text": " else {\n\t\t\tfilePath = fmt.Sprintf(\"%s/%s\", targetDir, filename)\n\t\t}\n\n\t\tif _, err := os.Stat(filePath); err == nil {\n\t\t\tfilename = fmt.Sprintf(\"%s-%d\", original, i)\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn filename\n}", "video": "" }
{ "audio": "", "image": "", "text": "func UnknownOrigin() Origin {\n\treturn Origin{\n\t\tModel: UnknownString,", "video": "" }
{ "audio": "", "image": "", "text": "\n\t\tMachine: UnknownString,\n\t\tHostname: UnknownString,\n\t\tVersion: UnknownVersion,\n\t}\n}", "video": "" }
{ "audio": "", "image": "", "text": " new(ClearDataForOriginArgs)\n\targs.Origin = origin\n\targs.StorageTypes = storageTypes\n\treturn args\n}", "video": "" }
{ "audio": "", "image": "", "text": "func NewMetadata() *Metadata {\n\treturn &Metadata{\n\t\tFileMetadata: filestorage.NewMetadata(),\n\t\t// TODO(fwereade): 2016-03-17 lp:1558657\n\t\tStarted:", "video": "" }
{ "audio": "", "image": "", "text": " time.Now().UTC(),\n\t\tOrigin: Origin{\n\t\t\tVersion: jujuversion.Current,\n\t\t},\n\t}\n}", "video": "" }
{ "audio": "", "image": "", "text": " <-ch:\n\t\t\tif change.Alive {\n\t\t\t\treturn nil\n\t\t\t}\n\t\tcase <-time.After(timeout):\n\t\t\t// TODO(fwereade): 2016-03-17 lp:1558657\n\t\t\treturn fmt.Errorf(\"still not alive after timeout\")\n\t\tcase <-pwatcher.Dead():\n\t\t\treturn pwatcher.Err()\n\t\t}\n\t}\n\tpa...
{ "audio": "", "image": "", "text": "func NewMetadataState(db DB, machine, series string) (*Metadata, error) {\n\t// hostname could be derived from the model...\n\thostname, err := os.Hostname()\n\tif err != nil {\n\t\t// If os.Hostname() is not working, something is woefully wrong.\n\t\t// Run for the hills.\n\t...
{ "audio": "", "image": "", "text": "\treturn nil, errors.Annotate(err, \"could not get server secrets\")\n\t}\n\tcontrollerCfg, err := db.ControllerConfig()\n\tif err != nil {\n\t\treturn nil, errors.Annotate(err, \"could not get controller config\")\n\t}\n\tmeta.CACert, _ = controllerCfg.CACert()\n\tmeta.CAPriv...
{ "audio": "", "image": "", "text": " != \"\" {\n\t\tfields[2] = addr.MailboxName\n\t}\n\tif addr.HostName != \"\" {\n\t\tfields[3] = addr.HostName\n\t}\n\n\treturn fields\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (m *Metadata) MarkComplete(size int64, checksum string) error {\n\tif size == 0 {\n\t\treturn errors.New(\"missing size\")\n\t}\n\tif checksum == \"\" {\n\t\treturn errors.New(\"missing checksum\")\n\t}\n\tformat := checksumFormat\n\t// TODO(fwereade): 2016-03-17 lp:15586...
{ "audio": "", "image": "", "text": " err := m.SetFileInfo(size, checksum, format); err != nil {\n\t\treturn errors.Annotate(err, \"unexpected failure\")\n\t}\n\tm.Finished = &finished\n\n\treturn nil\n}", "video": "" }
{ "audio": "", "image": "", "text": " \"\" {\n\t\treturn errors.New(\"missing content type\")\n\t}\n\n\tif d.Timestamp == nil {\n\t\treturn errors.New(\"missing timestamp\")\n\t}\n\tfor k, v := range d.GetTags() {\n\t\tif err := types.ValidateTag(k, v); err != nil {\n\t\t\treturn fmt.Errorf(\"invalid tag %q: %v\"...
{ "audio": "", "image": "", "text": "func NewMetadataJSONReader(in io.Reader) (*Metadata, error) {\n\tvar flat flatMetadata\n\tif err := json.NewDecoder(in).Decode(&flat); err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\n\tmeta := NewMetadata()\n\tmeta.SetID(flat.ID)\n\n\terr := meta.SetFileInfo(flat.Size,...
{ "audio": "", "image": "", "text": "\n\t\tModel: flat.Environment,\n\t\tMachine: flat.Machine,\n\t\tHostname: flat.Hostname,\n\t\tVersion: flat.Version,\n\t\tSeries: flat.Series,\n\t}\n\n\t// TODO(wallyworld) - put these in a separate file.\n\tmeta.CACert = flat.CACert\n\tmeta.CAPrivateKey = flat.CAPrivat...
{ "audio": "", "image": "", "text": "\n\t\tflat += n.flat\n\t\tcum += n.cum\n\t}\n\treturn\n}", "video": "" }
{ "audio": "", "image": "", "text": "func BuildMetadata(file *os.File) (*Metadata, error) {\n\n\t// Extract the file size.\n\tfi, err := file.Stat()\n\tif err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\tsize := fi.Size()\n\n\t// Extract the timestamp.\n\ttimestamp := fileTimestamp(fi)\n\n\t// Get the chec...
{ "audio": "", "image": "", "text": " NewMetadata()\n\tmeta.Started = time.Time{}\n\tmeta.Origin = UnknownOrigin()\n\terr = meta.MarkComplete(size, checksum)\n\tif err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\tmeta.Finished = &timestamp\n\treturn meta, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "\t\treturn\n\t}\n\tdefer f.Close()\n\n\t// Compute checksum\n\tvar h = sha1.New()\n\tif _, err = io.Copy(h, f); err != nil {\n\t\terr = errors.Wrap(err, \"copying file to hasher failed\")\n\t\treturn\n\t}\n\tchecksum = base64.StdEncoding.EncodeToString(h.Sum(nil))\n\treturn\n}...
{ "audio": "", "image": "", "text": "func (rc *externalController) ControllerInfo() crossmodel.ControllerInfo {\n\treturn crossmodel.ControllerInfo{\n", "video": "" }
{ "audio": "", "image": "", "text": "\t\tControllerTag: names.NewControllerTag(rc.doc.Id),\n\t\tAlias: rc.doc.Alias,\n\t\tAddrs: rc.doc.Addrs,\n\t\tCACert: rc.doc.CACert,\n\t}\n}", "video": "" }
{ "audio": "", "image": "", "text": "\t\t\tAlias: arg.ControllerInfo.Alias,\n\t\t\tAddrs: arg.ControllerInfo.Addrs,\n\t\t\tCACert: arg.ControllerInfo.CACert,\n\t\t}\n\t}\n\terr := c.facade.FacadeCall(\"Consume\", args, &consumeRes)\n\tif err != nil {\n\t\treturn \"\", errors.Trace(err)\n\t}...
{ "audio": "", "image": "", "text": "func (ec *externalControllers) Save(controller crossmodel.ControllerInfo, modelUUIDs ...string) (ExternalController, error) {\n\tif err := controller.Validate(); err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\tdoc := externalControllerDoc{\n\t\tId: controller.Contr...
{ "audio": "", "image": "", "text": "\tAssert: txn.DocExists,\n\t\t\t\tUpdate: bson.D{\n\t\t\t\t\t{\"$set\",\n\t\t\t\t\t\tbson.D{{\"addresses\", doc.Addrs},\n\t\t\t\t\t\t\t{\"alias\", doc.Alias},\n\t\t\t\t\t\t\t{\"cacert\", doc.CACert},\n\t\t\t\t\t\t\t{\"models\", models.Values()}},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\...
{ "audio": "", "image": "", "text": "\t\t\"cannot acquire lock file for getting an account details on controller %s\", controllerName,\n\t\t)\n\t}\n\tdefer releaser.Release()\n\n\taccounts, err := ReadAccountsFile(JujuAccountsPath())\n\tif err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\tdetails, ok := acc...
{ "audio": "", "image": "", "text": "func (ec *externalControllers) Remove(controllerUUID string) error {\n\tops := []txn.Op{{\n\t\tC: externalControllersC,\n", "video": "" }
{ "audio": "", "image": "", "text": "\t\tId: controllerUUID,\n\t\tRemove: true,\n\t}}\n\terr := ec.st.db().RunTransaction(ops)\n\treturn errors.Annotate(err, \"failed to remove external controller\")\n}", "video": "" }
{ "audio": "", "image": "", "text": "\tC: firewallRulesC,\n\t\t\t\tId: serviceStr,\n\t\t\t\tAssert: txn.DocExists,\n\t\t\t\tUpdate: bson.D{\n\t\t\t\t\t{\"$set\", bson.D{{\"whitelist-cidrs\", rule.WhitelistCIDRs}}},\n\t\t\t\t},\n\t\t\t}, model.assertActiveOp()}\n\t\t} else {\n\t\t\tdoc.WhitelistCIDRS = ru...
{ "audio": "", "image": "", "text": "func (ec *externalControllers) Controller(controllerUUID string) (ExternalController, error) {\n\tdoc, err := ec.controller(controllerUUID)\n\tif err", "video": "" }
{ "audio": "", "image": "", "text": " != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\treturn &externalController{*doc}, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": " sync,\n\t}\n\n\tcontroller.logger.Log(\"info\", \"setting up event handlers\")\n\n\t// ----- EVENT HANDLERS for HelmRelease resources change ---------\n\tfhrInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{\n\t\tAddFunc: func(new interface{}) {\n...
{ "audio": "", "image": "", "text": "func (ec *externalControllers) ControllerForModel(modelUUID string) (ExternalController, error) {\n\tcoll, closer := ec.st.db().GetCollection(externalControllersC)\n\tdefer closer()\n\n\tvar doc []externalControllerDoc\n\terr := coll.Find(bson.M{\"models\": bson.M{\"$in\": []s...
{ "audio": "", "image": "", "text": " {\n\tcase 0:\n\t\treturn nil, errors.NotFoundf(\"external controller with model %v\", modelUUID)\n\tcase 1:\n\t\treturn &externalController{\n\t\t\tdoc: doc[0],\n\t\t}, nil\n\t}\n\treturn nil, errors.Errorf(\"expected 1 controller with model %v, got %d\", modelUUID, len(doc))...
{ "audio": "", "image": "", "text": " doc.DocID,\n\t\t\t\tAssert: txn.DocExists,\n\t\t\t\tUpdate: bson.M{\"$set\": bson.M{\"settings\": doc.Settings}},\n\t\t\t})\n\t\t}\n\t}\n\tif err := iter.Close(); err != nil {\n\t\treturn errors.Trace(err)\n\t}\n\tif len(ops) > 0 {\n\t\treturn errors.Trace(st.runRawTransactio...
{ "audio": "", "image": "", "text": "func (ec *externalControllers) WatchController(controllerUUID string) NotifyWatcher {\n\treturn", "video": "" }
{ "audio": "", "image": "", "text": " newEntityWatcher(ec.st, externalControllersC, controllerUUID)\n}", "video": "" }
{ "audio": "", "image": "", "text": "\n\tgc.ExtraChannels = []storage.ExtraChannel{}\n\tfor _, ec := range req.GatewayProfile.ExtraChannels {\n\t\tc := storage.ExtraChannel{\n\t\t\tFrequency: int(ec.Frequency),\n\t\t\tBandwidth: int(ec.Bandwidth),\n\t\t\tBitrate: int(ec.Bitrate),\n\t\t}\n\n\t\tswitch ec.Modulat...
{ "audio": "", "image": "", "text": "func NewMacaroonCache(clock clock.Clock) *MacaroonCache {\n\tc := &cacheInternal{clock: clock, macaroons: make(map[string]*macaroonEntry)}\n\tcache := &MacaroonCache{c}\n\t// The interval to run the expiry worker is somewhat arbitrary.\n\t// Expired macaroons will be re-issued...
{ "audio": "", "image": "", "text": " ensure\n\t// that those which fall out of use are eventually cleaned up.\n\tc.runExpiryWorker(10 * time.Minute)\n\truntime.SetFinalizer(cache, stopMacaroonCacheExpiryWorker)\n\treturn cache\n}", "video": "" }
{ "audio": "", "image": "", "text": "\t// Expiry imply the value is immediately expired.\n\treturn tv.Expiry.IsZero() || when.After(tv.Expiry)\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (c *cacheInternal) Upsert(token string, ms macaroon.Slice) {\n\tc.Lock()\n\tdefer c.Unlock()\n\n\tvar et *time.Time\n\tif expiryTime, ok := checkers.MacaroonsExpiryTime(ms); ok {\n", "video": "" }
{ "audio": "", "image": "", "text": "\t\tet = &expiryTime\n\t}\n\tc.macaroons[token] = &macaroonEntry{\n\t\tms: ms,\n\t\texpiryTime: et,\n\t}\n}", "video": "" }
{ "audio": "", "image": "", "text": "\t\t\t\t// hard to fix and super rare. see https://github.com/grafana/metrictank/pull/1242\n\t\t\t\t\ttotalPoints.DecUint64(uint64(points))\n\t\t\t\t\tms.Unlock()\n\t\t\t\t}\n\t\t\t}\n\t\t\tms.RLock()\n\t\t\torgActive := len(ms.Metrics[org])\n\t\t\torgActiveMetrics.Set(float64...
{ "audio": "", "image": "", "text": "func (c *cacheInternal) Get(k string) (macaroon.Slice, bool) {\n\tc.Lock()\n\tdefer c.Unlock()\n\n\tentry, found :=", "video": "" }
{ "audio": "", "image": "", "text": " c.macaroons[k]\n\tif !found {\n\t\treturn nil, false\n\t}\n\tif entry.expired(c.clock) {\n\t\tdelete(c.macaroons, k)\n\t\treturn nil, false\n\t}\n\treturn entry.ms, true\n}", "video": "" }
{ "audio": "", "image": "", "text": "\tdefer c.lock.Unlock()\n\tc.service = k\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (c *cloudImageMetadataCommandBase) NewImageMetadataAPI() (*imagemetadatamanager.Client, error)", "video": "" }
{ "audio": "", "image": "", "text": " {\n\troot, err := c.NewAPIRoot()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn imagemetadatamanager.NewClient(root), nil\n}", "video": "" }
{ "audio": "", "image": "", "text": " func(_ *Client, c *RemoteContext) error {\n\t\tc.Snapshotter = snapshotterName\n\t\treturn nil\n\t}\n}", "video": "" }
{ "audio": "", "image": "", "text": "func NewMockFacade(ctrl *gomock.Controller) *MockFacade {\n\tmock := &MockFacade{ctrl: ctrl}\n", "video": "" }
{ "audio": "", "image": "", "text": "\tmock.recorder = &MockFacadeMockRecorder{mock}\n\treturn mock\n}", "video": "" }
{ "audio": "", "image": "", "text": " {\n\tmock := &MockDockerMetadataClient{ctrl: ctrl}\n\tmock.recorder = &MockDockerMetadataClientMockRecorder{mock}\n\treturn mock\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (mr *MockFacadeMockRecorder) FinishUpgradeSeries(arg0 interface{}) *gomock.Call {\n\treturn", "video": "" }
{ "audio": "", "image": "", "text": " mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"FinishUpgradeSeries\", reflect.TypeOf((*MockFacade)(nil).FinishUpgradeSeries), arg0)\n}", "video": "" }
{ "audio": "", "image": "", "text": "\n\t\treturn nil, ErrInvalidParams()\n\t}\n\n\tmr.m.RLock()\n\tmd, ok := mr.r[r.Method]\n\tmr.m.RUnlock()\n\tif !ok {\n\t\treturn nil, ErrMethodNotFound()\n\t}\n\n\treturn md.Handler, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (m *MockFacade) MachineStatus() (model.UpgradeSeriesStatus, error) {\n\tret := m.ctrl.Call(m, \"MachineStatus\")\n\tret0, _", "video": "" }
{ "audio": "", "image": "", "text": " := ret[0].(model.UpgradeSeriesStatus)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "video": "" }
{ "audio": "", "image": "", "text": " error {\n\tret := m.ctrl.Call(m, \"RunScript\", scriptName, options)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (m *MockFacade) SetMachineStatus(arg0 model.UpgradeSeriesStatus, arg1", "video": "" }
{ "audio": "", "image": "", "text": " string) error {\n\tret := m.ctrl.Call(m, \"SetMachineStatus\", arg0, arg1)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "video": "" }
{ "audio": "", "image": "", "text": "\t}\n\tcase model.ActionDropColumn, model.ActionModifyColumn,\n\t\tmodel.ActionDropTablePartition, model.ActionAddTablePartition,\n\t\tmodel.ActionRebaseAutoID, model.ActionShardRowID,\n\t\tmodel.ActionTruncateTable, model.ActionAddForeignKey,\n\t\tmodel.ActionDropForeignKey, ...
{ "audio": "", "image": "", "text": "func (m *MockFacade) StartUnitCompletion(arg0 string) error {\n\tret := m.ctrl.Call(m, \"StartUnitCompletion\",", "video": "" }
{ "audio": "", "image": "", "text": " arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "video": "" }
{ "audio": "", "image": "", "text": " error {\n\tret := m.ctrl.Call(m, \"RunScript\", scriptName, options)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (m *MockFacade) TargetSeries() (string, error) {\n\tret := m.ctrl.Call(m, \"TargetSeries\")\n\tret0, _", "video": "" }
{ "audio": "", "image": "", "text": " := ret[0].(string)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "video": "" }
{ "audio": "", "image": "", "text": " error {\n\tret := m.ctrl.Call(m, \"Detach\", arg0, arg1)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (m *MockFacade) UnitsCompleted() ([]names_v2.UnitTag, error) {\n\tret := m.ctrl.Call(m, \"UnitsCompleted\")\n\tret0, _", "video": "" }
{ "audio": "", "image": "", "text": " := ret[0].([]names_v2.UnitTag)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "video": "" }
{ "audio": "", "image": "", "text": " {\n\tret := m.ctrl.Call(m, \"MachineTag\")\n\tret0, _ := ret[0].(names_v2.MachineTag)\n\treturn ret0\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (mr *MockFacadeMockRecorder) UnpinMachineApplications() *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock,", "video": "" }
{ "audio": "", "image": "", "text": " \"UnpinMachineApplications\", reflect.TypeOf((*MockFacade)(nil).UnpinMachineApplications))\n}", "video": "" }
{ "audio": "", "image": "", "text": "\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ChangeConnectionID\", reflect.TypeOf((*MockCryptoSetup)(nil).ChangeConnectionID), arg0)\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (m *MockLogger) Infof(arg0 string, arg1 ...interface{}) {\n\tvarargs := []interface{}{arg0}\n\tfor _, a := range arg1 {\n", "video": "" }
{ "audio": "", "image": "", "text": "\t\tvarargs = append(varargs, a)\n\t}\n\tm.ctrl.Call(m, \"Infof\", varargs...)\n}", "video": "" }
{ "audio": "", "image": "", "text": " {\n\tfor _, level := range m {\n\t\tlevel.Del(path)\n\t}\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (mr *MockLoggerMockRecorder) Infof(arg0 interface{}, arg1 ...interface{}) *gomock.Call {\n\tvarargs := append([]interface{}{arg0}, arg1...)\n\treturn", "video": "" }
{ "audio": "", "image": "", "text": " mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Infof\", reflect.TypeOf((*MockLogger)(nil).Infof), varargs...)\n}", "video": "" }
{ "audio": "", "image": "", "text": " (interface{}, error)) *Init {\n\treturn ini.Branch(func() (interface{}, error) {\n\t\treturn ini.withTimeout(timeout, f)\n\t})\n}", "video": "" }
{ "audio": "", "image": "", "text": "func NewMockAgentService(ctrl *gomock.Controller) *MockAgentService {\n\tmock := &MockAgentService{ctrl: ctrl}", "video": "" }
{ "audio": "", "image": "", "text": "\n\tmock.recorder = &MockAgentServiceMockRecorder{mock}\n\treturn mock\n}", "video": "" }
{ "audio": "", "image": "", "text": " {\n\tmock := &MockDockerMetadataClient{ctrl: ctrl}\n\tmock.recorder = &MockDockerMetadataClientMockRecorder{mock}\n\treturn mock\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (m *MockAgentService) Running() (bool, error) {\n\tret := m.ctrl.Call(m, \"Running\")\n\tret0, _", "video": "" }
{ "audio": "", "image": "", "text": " := ret[0].(bool)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "video": "" }
{ "audio": "", "image": "", "text": " error {\n\tret := m.ctrl.Call(m, \"RunScript\", scriptName, options)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (mr *MockAgentServiceMockRecorder) Running() *gomock.Call {\n\treturn", "video": "" }
{ "audio": "", "image": "", "text": " mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Running\", reflect.TypeOf((*MockAgentService)(nil).Running))\n}", "video": "" }
{ "audio": "", "image": "", "text": "\n\t\treturn nil, ErrInvalidParams()\n\t}\n\n\tmr.m.RLock()\n\tmd, ok := mr.r[r.Method]\n\tmr.m.RUnlock()\n\tif !ok {\n\t\treturn nil, ErrMethodNotFound()\n\t}\n\n\treturn md.Handler, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "func NewMockServiceAccess(ctrl *gomock.Controller) *MockServiceAccess {\n\tmock := &MockServiceAccess{ctrl: ctrl}", "video": "" }
{ "audio": "", "image": "", "text": "\n\tmock.recorder = &MockServiceAccessMockRecorder{mock}\n\treturn mock\n}", "video": "" }
{ "audio": "", "image": "", "text": " {\n\tmock := &MockDockerMetadataClient{ctrl: ctrl}\n\tmock.recorder = &MockDockerMetadataClientMockRecorder{mock}\n\treturn mock\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (m *MockServiceAccess) DiscoverService(arg0 string) (upgradeseries.AgentService, error) {\n\tret := m.ctrl.Call(m, \"DiscoverService\", arg0)\n\tret0, _ :=", "video": "" }
{ "audio": "", "image": "", "text": " ret[0].(upgradeseries.AgentService)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "video": "" }
{ "audio": "", "image": "", "text": " error {\n\tret := m.ctrl.Call(m, \"RunScript\", scriptName, options)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (mr *MockServiceAccessMockRecorder) DiscoverService(arg0 interface{}) *gomock.Call {\n\treturn", "video": "" }
{ "audio": "", "image": "", "text": " mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DiscoverService\", reflect.TypeOf((*MockServiceAccess)(nil).DiscoverService), arg0)\n}", "video": "" }
{ "audio": "", "image": "", "text": "\n\t\treturn nil, ErrInvalidParams()\n\t}\n\n\tmr.m.RLock()\n\tmd, ok := mr.r[r.Method]\n\tmr.m.RUnlock()\n\tif !ok {\n\t\treturn nil, ErrMethodNotFound()\n\t}\n\n\treturn md.Handler, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (m *MockServiceAccess) ListServices() ([]string, error) {\n\tret := m.ctrl.Call(m, \"ListServices\")\n\tret0, _", "video": "" }
{ "audio": "", "image": "", "text": " := ret[0].([]string)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "video": "" }
{ "audio": "", "image": "", "text": " error {\n\tret := m.ctrl.Call(m, \"Detach\", arg0, arg1)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (mr *MockServiceAccessMockRecorder) ListServices() *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock,", "video": "" }
{ "audio": "", "image": "", "text": " \"ListServices\", reflect.TypeOf((*MockServiceAccess)(nil).ListServices))\n}", "video": "" }
{ "audio": "", "image": "", "text": "\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ChangeConnectionID\", reflect.TypeOf((*MockCryptoSetup)(nil).ChangeConnectionID), arg0)\n}", "video": "" }
{ "audio": "", "image": "", "text": "func NewMockUpgrader(ctrl *gomock.Controller) *MockUpgrader {\n\tmock := &MockUpgrader{ctrl: ctrl}\n", "video": "" }
{ "audio": "", "image": "", "text": "\tmock.recorder = &MockUpgraderMockRecorder{mock}\n\treturn mock\n}", "video": "" }
{ "audio": "", "image": "", "text": " {\n\tmock := &MockDockerMetadataClient{ctrl: ctrl}\n\tmock.recorder = &MockDockerMetadataClientMockRecorder{mock}\n\treturn mock\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (m *MockUpgrader) PerformUpgrade() error {\n\tret := m.ctrl.Call(m, \"PerformUpgrade\")\n", "video": "" }
{ "audio": "", "image": "", "text": "\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "video": "" }
{ "audio": "", "image": "", "text": " error {\n\tret := m.ctrl.Call(m, \"Detach\", arg0, arg1)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (mr *MockUpgraderMockRecorder) PerformUpgrade() *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock,", "video": "" }
{ "audio": "", "image": "", "text": " \"PerformUpgrade\", reflect.TypeOf((*MockUpgrader)(nil).PerformUpgrade))\n}", "video": "" }
{ "audio": "", "image": "", "text": "\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ChangeConnectionID\", reflect.TypeOf((*MockCryptoSetup)(nil).ChangeConnectionID), arg0)\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (cfo cacheForOperations) get(name string) (resource.Resource, io.ReadCloser, error) {\n\tif cfo.EntityCache == nil {\n\t\treturn resource.Resource{}, nil, errors.NotFoundf(\"resource %q\", name)\n\t}\n\n\tres, reader, err := cfo.OpenResource(name)\n\tif errors.IsNotFound(...
{ "audio": "", "image": "", "text": " = nil\n\t\tres, err = cfo.GetResource(name)\n\t}\n\tif err != nil {\n\t\treturn resource.Resource{}, nil, errors.Trace(err)\n\t}\n\n\treturn res, reader, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": " of.tarFile.Next()\n\t\tif err == io.EOF {\n\t\t\treturn nil, err\n\t\t}\n\t\tif header.Name == filename {\n\t\t\treturn header, nil\n\t\t}\n\t}\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (cfo cacheForOperations) set(chRes charmresource.Resource, reader io.ReadCloser) (resource.Resource, io.ReadCloser, error) {\n\tif cfo.EntityCache == nil {\n\t\tres := resource.Resource{\n\t\t\tResource: chRes,\n\t\t}\n\t\treturn res, reader, nil // a no-op\n", "video":...
{ "audio": "", "image": "", "text": "\t}\n\tdefer reader.Close()\n\n\tres, err := cfo.SetResource(chRes, reader)\n\tif err != nil {\n\t\treturn resource.Resource{}, nil, errors.Trace(err)\n\t}\n\n\t// Make sure to use the potentially updated resource details.\n\tres, reader, err = cfo.OpenResource(res.Name)\n\tif...
{ "audio": "", "image": "", "text": " {\n\t\tswitch resource := untyped.(type) {\n\t\tcase *resources.AWSEC2TransitGatewayRouteTableAssociation:\n\t\t\treturn resource, nil\n\t\t}\n\t}\n\treturn nil, fmt.Errorf(\"resource %q of type AWSEC2TransitGatewayRouteTableAssociation not found\", name)\n}", "video": "" }
{ "audio": "", "image": "", "text": "func Archive(w io.Writer, dir string) error {\n\tentries, err := ioutil.ReadDir(dir)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tgzw := gzip.NewWriter(w)\n\tdefer closeErrorCheck(&err, gzw)\n\n\ttarw := tar.NewWriter(gzw)\n\tdefer closeErrorCheck(&err, tarw)\n\n\tfor _, ent :...
{ "audio": "", "image": "", "text": " {\n\t\t\th.Mode = 0644\n\t\t}\n\t\terr := tarw.WriteHeader(h)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfileName := filepath.Join(dir, ent.Name())\n\t\tif err := copyFile(tarw, fileName); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "\tdefer c.lock.RUnlock()\n\n\tif e := c.cache[key]; e != nil {\n\t\tent := e.Value.(*cacheEntry)\n\t\tif !c.isEntryExpired(now, ent) {\n\t\t\treturn ent.v, true\n\t\t}\n\t}\n\treturn nil, false\n}", "video": "" }
{ "audio": "", "image": "", "text": "func archiveAndSHA256(w io.Writer, dir string) (sha256hash string, err error) {\n\th := sha256.New()\n\tif err := Archive(io.MultiWriter(h, w), dir); err !=", "video": "" }
{ "audio": "", "image": "", "text": " nil {\n\t\treturn \"\", err\n\t}\n\treturn fmt.Sprintf(\"%x\", h.Sum(nil)), err\n}", "video": "" }
{ "audio": "", "image": "", "text": " err\n\t}\n\tdefer f.Close()\n\n\th := sha256.New()\n\t_, err = io.Copy(h, f)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn h.Sum(nil), nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "func copyFile(w io.Writer, file string) error {\n\tf, err := os.Open(file)\n\tif err != nil {\n\t\treturn", "video": "" }
{ "audio": "", "image": "", "text": " err\n\t}\n\tdefer f.Close()\n\t_, err = io.Copy(w, f)\n\treturn err\n}", "video": "" }
{ "audio": "", "image": "", "text": "\t}\n\n\tif header.Typeflag != tar.TypeReg && header.Typeflag != tar.TypeRegA {\n\t\treturn nil\n\t}\n\n\tfile, err := os.Open(fileName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer file.Close()\n\n\t_, err = io.Copy(w.writer, file)\n\treturn err\n}", "video": "" }
{ "audio": "", "image": "", "text": "func tarHeader(i os.FileInfo) *tar.Header {\n\treturn &tar.Header{\n\t\tTypeflag: tar.TypeReg,\n\t\tName: i.Name(),\n\t\tSize: i.Size(),\n\t\tMode: int64(i.Mode() & 0777),", "video": "" }
{ "audio": "", "image": "", "text": "\n\t\tModTime: i.ModTime(),\n\t\tAccessTime: i.ModTime(),\n\t\tChangeTime: i.ModTime(),\n\t\tUname: \"ubuntu\",\n\t\tGname: \"ubuntu\",\n\t}\n}", "video": "" }
{ "audio": "", "image": "", "text": " but could not be accessed: %v\", key, err))\n\t\t\tcontinue\n\t\t}\n\n\t\thdr := &tar.Header{\n\t\t\tName: hex.EncodeToString(hash),\n\t\t\tMode: 0644,\n\t\t\tSize: int64(len(data)),\n\t\t}\n\t\tif err := tw.WriteHeader(hdr); err != nil {\n\t\t\treturn count, err\n\t\t}\n\t\t...
{ "audio": "", "image": "", "text": "func closeErrorCheck(errp *error, c io.Closer)", "video": "" }
{ "audio": "", "image": "", "text": " {\n\terr := c.Close()\n\tif *errp == nil {\n\t\t*errp = err\n\t}\n}", "video": "" }
{ "audio": "", "image": "", "text": " != nil {\n\t\treturn bi.closer.Close()\n\t}\n\treturn nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "func ExistingJujudLocation() (string, error) {\n\tjujuLocation, err := findExecutable(os.Args[0])\n\tif err != nil {\n\t\tlogger.Infof(\"%v\",", "video": "" }
{ "audio": "", "image": "", "text": " err)\n\t\treturn \"\", err\n\t}\n\tjujuDir := filepath.Dir(jujuLocation)\n\treturn jujuDir, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "\tDefaultPointersConfig: struct{}{},\n\t\tRun: func() error {\n\t\t\tif err := GetPrint(os.Stdout); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tfmt.Print(\"\\n\")\n\t\t\treturn nil\n\n\t\t},\n\t}\n}", "video": "" }
{ "audio": "", "image": "", "text": "func bundleTools(build bool, w io.Writer, forceVersion *version.Number) (_ version.Binary, official bool, sha256hash string, _ error) {\n\tdir, err := ioutil.TempDir(\"\", \"juju-tools\")\n\tif err != nil {\n\t\treturn version.Binary{}, false, \"\", err\n\t}\n\tdefer os.Remove...
{ "audio": "", "image": "", "text": " {\n\t\tlogger.Debugf(\"forcing version to %s\", forceVersion)\n\t\tif err := ioutil.WriteFile(filepath.Join(dir, \"FORCE-VERSION\"), []byte(forceVersion.String()), 0666); err != nil {\n\t\t\treturn version.Binary{}, false, \"\", err\n\t\t}\n\t}\n\n\tsha256hash, err = archiveA...
{ "audio": "", "image": "", "text": "\t\t\"build_commit\": version.Vcs,\n\t\t\"build_timestamp\": version.Timestamp,\n\t\t\"build_hostname\": version.Hostname,\n\t}); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "func JujudVersion(dir string) (version.Binary, bool, error) {\n\ttvers, err := getVersionFromFile(dir)\n\tofficial := err == nil\n\tif err != nil && !errors.IsNotFound(err) && !isNoMatchingToolsChecksum(err) {\n\t\treturn version.Binary{}, false, errors.Trace(err)\n\t}\n\tif e...
{ "audio": "", "image": "", "text": " {\n\t\t// No signature file found.\n\t\t// Extract the version number that the jujud binary was built with.\n\t\t// This is used to check compatibility with the version of the client\n\t\t// being used to bootstrap.\n\t\ttvers, err = getVersionFromJujud(dir)\n\t\tif err != ni...
{ "audio": "", "image": "", "text": " m.Id(), subnetID)\n\tif err != nil && !errors.IsNotFound(err) {\n\t\treturn nil, errors.Trace(err)\n\t}\n\treturn ports, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "func AgentConf(info AgentInfo, renderer shell.Renderer) common.Conf {\n\tconf := common.Conf{\n\t\tDesc: fmt.Sprintf(\"juju agent for %s\", info.name),\n\t\tExecStart: info.cmd(renderer),\n\t\tLogfile: info.logFile(renderer),\n\t\tEnv: osenv.Featur...
{ "audio": "", "image": "", "text": "\tswitch info.Kind {\n\tcase AgentKindMachine:\n\t\tconf.Limit = map[string]string{\n\t\t\t\"nofile\": \"64000\",\n\t\t}\n\tcase AgentKindUnit:\n\t\tconf.Desc = \"juju unit agent for \" + info.ID\n\t}\n\n\treturn conf\n}", "video": "" }
{ "audio": "", "image": "", "text": "\n\t\tp.renderer.previewSuggestionBGColor = x\n\t\treturn nil\n\t}\n}", "video": "" }
{ "audio": "", "image": "", "text": "func ShutdownAfterConf(serviceName string) (common.Conf, error) {\n\tif serviceName == \"\" {\n\t\treturn common.Conf{}, errors.New(`missing \"after\" service name`)\n\t}\n\tdesc", "video": "" }
{ "audio": "", "image": "", "text": " := \"juju shutdown job\"\n\treturn shutdownAfterConf(serviceName, desc), nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "\t\t\t\tloggerRouter.\n\t\t\t\t\tError(\"Could not define the service name for the router: too many services\")\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tfor serviceName := range configuration.Services {\n\t\t\t\trouter.Service = serviceName\n\t\t\t}\n\t\t}\n\t}\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (a *aggregator) instInfo(id instance.Id, inst instances.Instance) (instanceInfo, error) {\n\tif inst == nil {\n\t\treturn instanceInfo{}, errors.NotFoundf(\"instance", "video": "" }
{ "audio": "", "image": "", "text": " %v\", id)\n\t}\n\taddr, err := inst.Addresses(a.callContext)\n\tif err != nil {\n\t\treturn instanceInfo{}, err\n\t}\n\treturn instanceInfo{\n\t\taddr,\n\t\tinst.Status(a.callContext),\n\t}, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "\t\t\tdevicePath)\n\t\t\treturn nil\n\t\t}\n\n\t\treturn fmt.Errorf(\"error getting instance %q\", instanceName)\n\t}\n\n\tmc := newDiskMetricContextZonal(\"detach\", g.region, inst.Zone)\n\treturn mc.Observe(g.manager.DetachDiskOnCloudProvider(inst.Zone, inst.Name, devicePath...
{ "audio": "", "image": "", "text": "func (t *Timer) Reset(d time.Duration)", "video": "" }
{ "audio": "", "image": "", "text": " bool {\n\treturn t.timer.Reset(d)\n}", "video": "" }
{ "audio": "", "image": "", "text": " stop it.\n\tt.timer = time.AfterFunc(time.Hour, func() {\n\t\tw.Assert()\n\t})\n\tt.timer.Stop()\n}", "video": "" }
{ "audio": "", "image": "", "text": "func InitiateMongoServer(p InitiateMongoParams) error {\n\tlogger.Debugf(\"Initiating mongo replicaset; dialInfo %#v; memberHostport %q; user %q; password %q\", p.DialInfo, p.MemberHostPort, p.User, p.Password)\n\tdefer logger.Infof(\"finished InitiateMongoServer\")\n\n\tif le...
{ "audio": "", "image": "", "text": "\n\tfor attempt := initiateAttemptStrategy.Start(); attempt.Next(); {\n\t\terr = attemptInitiateMongoServer(p.DialInfo, p.MemberHostPort)\n\t\tif err == nil {\n\t\t\tlogger.Infof(\"replica set initiated\")\n\t\t\treturn err\n\t\t}\n\t\tif attempt.HasNext() {\n\t\t\tlogger.Debu...
{ "audio": "", "image": "", "text": "\n\tp.p[\"hostname\"] = hostname\n\tp.p[\"password\"] = password\n\tp.p[\"physicalnetworkid\"] = physicalnetworkid\n\tp.p[\"username\"] = username\n\treturn p\n}", "video": "" }
{ "audio": "", "image": "", "text": "func attemptInitiateMongoServer(dialInfo *mgo.DialInfo, memberHostPort string) error {\n\tsession, err := mgo.DialWithInfo(dialInfo)\n\tif err != nil {\n\t\treturn errors.Annotatef(err, \"cannot dial", "video": "" }
{ "audio": "", "image": "", "text": " mongo to initiate replicaset\")\n\t}\n\tdefer session.Close()\n\tsession.SetSocketTimeout(mongo.SocketTimeout)\n\n\treturn replicaset.Initiate(\n\t\tsession,\n\t\tmemberHostPort,\n\t\tmongo.ReplicaSetName,\n\t\tmap[string]string{\n\t\t\tjujuMachineKey: agent.BootstrapMachineI...
{ "audio": "", "image": "", "text": "\t\tcontinue\n\t\t}\n\t\tpath := filepath.Join(tempDir, hdr.Name)\n\t\tinfo := hdr.FileInfo()\n\t\tif info.IsDir() {\n\t\t\tif err := os.MkdirAll(path, info.Mode()); err != nil {\n\t\t\t\treturn errors.Annotate(err, \"cannot create directory\")\n\t\t\t}\n\t\t\tcontinue\n\t\t}\...
{ "audio": "", "image": "", "text": "func resetReplicaSet(dialInfo *mgo.DialInfo, memberHostPort string) error {\n\tparams := peergrouper.InitiateMongoParams{\n\t\tDialInfo: dialInfo,\n\t\tMemberHostPort: memberHostPort,\n\t\tUser: ", "video": "" }
{ "audio": "", "image": "", "text": " dialInfo.Username,\n\t\tPassword: dialInfo.Password,\n\t}\n\treturn peergrouper.InitiateMongoServer(params)\n}", "video": "" }
{ "audio": "", "image": "", "text": "\t}\n\tif len(results.Results) != 1 {\n\t\treturn params.ControllersChanges{}, errors.Errorf(\"expected 1 result, got %d\", len(results.Results))\n\t}\n\tresult := results.Results[0]\n\tif result.Error != nil {\n\t\treturn params.ControllersChanges{}, result.Error\n\t}\n\tretu...
{ "audio": "", "image": "", "text": "func tagUserCredentials(conf agent.Config) (string, string, error) {\n\tusername := conf.Tag().String()\n\tvar password string\n\t// TODO(perrito) we might need an accessor for the actual state password\n\t// just in case it ever changes from the same as api password.\n\tapiIn...
{ "audio": "", "image": "", "text": " I find\n\t\t// no reasonable way to reach this state, yet since APIInfo has it as a\n\t\t// possibility I prefer to handle it, we cannot recover from this since\n\t\t// it would mean that the agent.conf is corrupted.\n\t\treturn \"\", \"\", errors.New(\"cannot obtain password...
{ "audio": "", "image": "", "text": " = username\n\tca.password = password\n}", "video": "" }
{ "audio": "", "image": "", "text": "func newDialInfo(privateAddr string, conf agent.Config) (*mgo.DialInfo, error) {\n\tdialOpts := mongo.DialOpts{Direct: true}\n\tssi, ok := conf.StateServingInfo()\n\tif !ok {\n\t\treturn nil, errors.Errorf(\"cannot get state serving info to dial\")\n\t}\n\tinfo := mongo.Info{\...
{ "audio": "", "image": "", "text": " oldPassword != \"\" {\n\t\tdialInfo.Username = \"admin\"\n\t\tdialInfo.Password = conf.OldPassword()\n\t} else {\n\t\tdialInfo.Username, dialInfo.Password, err = tagUserCredentials(conf)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Trace(err)\n\t\t}\n\t}\n\treturn dialInfo,...
{ "audio": "", "image": "", "text": " \"\", errors.Annotate(err, \"cannot obtain mongo build info\")\n\t}\n\treturn binfo.Version, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "func updateMachineAddresses(machine *state.Machine, privateAddress, publicAddress string) error {\n\tprivateAddressAddress := network.Address{\n\t\tValue: privateAddress,\n\t\tType: network.DeriveAddressType(privateAddress),\n", "video": "" }
{ "audio": "", "image": "", "text": "\t}\n\tpublicAddressAddress := network.Address{\n\t\tValue: publicAddress,\n\t\tType: network.DeriveAddressType(publicAddress),\n\t}\n\tif err := machine.SetProviderAddresses(publicAddressAddress, privateAddressAddress); err != nil {\n\t\treturn errors.Trace(err)\n\t}\n\tretu...
{ "audio": "", "image": "", "text": "\t}\n\tm, err := u.machine()\n\tif err != nil {\n\t\tunitLogger.Tracef(\"%v\", err)\n\t\treturn network.Address{}, errors.Trace(err)\n\t}\n\treturn m.PublicAddress()\n}", "video": "" }
{ "audio": "", "image": "", "text": "func connectToDB(controllerTag names.ControllerTag, modelTag names.ModelTag, info *mongo.MongoInfo) (*state.StatePool, error) {\n\t// We need to retry here to allow mongo to come up on the restored controller.\n\t// The connection might succeed due to the mongo dial retries bu...
{ "audio": "", "image": "", "text": " := attempt.Start(); a.Next(); {\n\t\tpool, err = state.OpenStatePool(state.OpenParams{\n\t\t\tClock: clock.WallClock,\n\t\t\tControllerTag: controllerTag,\n\t\t\tControllerModelTag: modelTag,\n\t\t\tMongoSession: session,\n\t\t\tNewPolicy: env...
{ "audio": "", "image": "", "text": "\t\t// Remove the reference to the pool, to allow a clean up of the connection\n\t\tconn.poolDriver = nil\n\t\terr := conn.Close()\n\t\tif err != nil {\n\t\t\td.closed = true\n\t\t\treturn err\n\t\t}\n\t}\n\t// Mark the pool as closed to stop any new connections\n\td.closed = ...
{ "audio": "", "image": "", "text": "func updateAllMachines(privateAddress, publicAddress string, machines []machineModel) error {\n\tvar machineUpdating sync.WaitGroup\n\tfor _, item := range machines {\n\t\tmachine := item.machine\n\t\t// A newly resumed controller requires no updating, and more\n\t\t// than on...
{ "audio": "", "image": "", "text": "\t\t// runMachineUpdate only handles linux machines, what about windows?\n\t\t\terr := runMachineUpdate(machine, setAgentAddressScript(privateAddress, publicAddress))\n\t\t\tif err != nil {\n\t\t\t\tlogger.Errorf(\"failed updating machine: %v\", err)\n\t\t\t}\n\t\t}(machine, i...
{ "audio": "", "image": "", "text": " new(getMachineIDResponse)\n\terr := vb.send(req1, rsp1)\n\tif err != nil {\n\t\treturn err\n\t}\n\tmachine.id = rsp1.Returnval\n\n\t// get machine name\n\treq2 := getMachineNameRequest{Mobref: machine.mobref}\n\trsp2 := new(getMachineNameResponse)\n\terr = vb.send(req2, rsp2)...
{ "audio": "", "image": "", "text": "func setAgentAddressScript(stateAddr, statePubAddr string) string {\n\tvar buf bytes.Buffer\n\terr := agentAddressAndRelationsTemplate.Execute(&buf, struct", "video": "" }
{ "audio": "", "image": "", "text": " {\n\t\tAddress string\n\t\tPubAddress string\n\t}{stateAddr, statePubAddr})\n\tif err != nil {\n\t\tpanic(errors.Annotate(err, \"template error\"))\n\t}\n\treturn buf.String()\n}", "video": "" }
{ "audio": "", "image": "", "text": "\tvar buf bytes.Buffer\n\terr = tpl.Execute(&buf, o)\n\tif err != nil {\n\t\treturn err\n\t}\n\tbo, err := format.Source(buf.Bytes())\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn ioutil.WriteFile(\"example/all/main.go\", bo, 0600)\n}", "video": "" }
{ "audio": "", "image": "", "text": "func runMachineUpdate(machine *state.Machine, sshArg string) error {\n\taddr, err := machine.PublicAddress()\n\tif err != nil {\n\t\tif network.IsNoAddressError(err) {\n\t\t\treturn", "video": "" }
{ "audio": "", "image": "", "text": " errors.Annotatef(err, \"no appropriate public address found\")\n\t\t}\n\t\treturn errors.Trace(err)\n\t}\n\treturn runViaSSH(addr.Value, sshArg)\n}", "video": "" }
{ "audio": "", "image": "", "text": "\t}\n\tm, err := u.machine()\n\tif err != nil {\n\t\tunitLogger.Tracef(\"%v\", err)\n\t\treturn network.Address{}, errors.Trace(err)\n\t}\n\treturn m.PublicAddress()\n}", "video": "" }
{ "audio": "", "image": "", "text": "func runViaSSH(addr string, script string) error {\n\tsshOptions := ssh.Options{}\n\tsshOptions.SetIdentities(\"/var/lib/juju/system-identity\")\n\t// Disable host key checking. We're not pushing across anything\n\t// sensitive, and there's no guarantee that the machine would\...
{ "audio": "", "image": "", "text": "\tuserAddr := \"ubuntu@\" + addr\n\tuserCmd := sshCommand(userAddr, []string{\"sudo\", \"-n\", \"bash\", \"-c \" + utils.ShQuote(script)}, &sshOptions)\n\tvar stdoutBuf bytes.Buffer\n\tvar stderrBuf bytes.Buffer\n\tuserCmd.Stdout = &stdoutBuf\n\tuserCmd.Stderr = &stderrBuf\n\t...
{ "audio": "", "image": "", "text": " ensure that (1) the Accumulator\n\t// cannot be used any more after Close() has been called and (2)\n\t// information about the key is not retained in memory\n\t// indefinitely.\n\tacc.gen.reset()\n\n\treturn err\n}", "video": "" }
{ "audio": "", "image": "", "text": "func ParsePlacement(directive string) (*Placement, error) {\n\tif directive == \"\" {\n\t\treturn nil, nil\n\t}\n\tif colon := strings.IndexRune(directive, ':'); colon != -1 {\n\t\tscope, directive := directive[:colon], directive[colon+1:]\n\t\tif scope == \"\" {\n\t\t\treturn...
{ "audio": "", "image": "", "text": "\treturn &Placement{Scope: scope, Directive: directive}, nil\n\t}\n\tif names.IsValidMachine(directive) {\n\t\treturn &Placement{Scope: MachineScope, Directive: directive}, nil\n\t}\n\tif isContainerType(directive) {\n\t\treturn &Placement{Scope: directive}, nil\n\t}\n\treturn...
{ "audio": "", "image": "", "text": "\t\t\tprefix: token.prefix,\n\t\t\t}\n\t\t\tif !yaml_parser_append_tag_directive(parser, value, false, token.start_mark) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\ttag_directives = append(tag_directives, value)\n\t\t}\n\n\t\tskip_token(parser)\n\t\ttoken = peek_token(parser)\n\t\...
{ "audio": "", "image": "", "text": "func MustParsePlacement(directive string) *Placement {\n\tplacement, err := ParsePlacement(directive)\n", "video": "" }
{ "audio": "", "image": "", "text": "\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn placement\n}", "video": "" }
{ "audio": "", "image": "", "text": "\t\t\tprefix: token.prefix,\n\t\t\t}\n\t\t\tif !yaml_parser_append_tag_directive(parser, value, false, token.start_mark) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\ttag_directives = append(tag_directives, value)\n\t\t}\n\n\t\tskip_token(parser)\n\t\ttoken = peek_token(parser)\n\t\...
{ "audio": "", "image": "", "text": "func (a *Application) SetMinUnits(minUnits int) (err error) {\n\tdefer errors.DeferredAnnotatef(&err, \"cannot set minimum units for application %q\", a)\n\tdefer func() {\n\t\tif err == nil {\n\t\t\ta.doc.MinUnits = minUnits\n\t\t}\n\t}()\n\tif minUnits < 0 {\n\t\treturn erro...
{ "audio": "", "image": "", "text": "\t// If one client tries to update the document, and a racing client removes\n\t// it, the former should be able to re-create the document in the second\n\t// attempt. If the referred-to application advanced its life cycle to a not\n\t// alive state, an error is returned after...
{ "audio": "", "image": "", "text": "\tif !ok {\n\t\t// Ensure only one goroutine at a time can be adding a ringBuffer to the map of ringBuffers\n\t\t// pointers\n\t\ta.mutex.Lock()\n\t\tdefer a.mutex.Unlock()\n\t\trb, ok = a.ringBuffers[app]\n\t\tif !ok {\n\t\t\trb = newRingBuffer(a.bufferSize)\n\t\t\ta.ringBuff...
{ "audio": "", "image": "", "text": "func doesMinUnitsExist(unit *Unit) (bool, error) {\n\tminUnits, closer := unit.st.db().GetCollection(minUnitsC)\n\tdefer closer()\n\tvar result bson.D\n\terr := minUnits.FindId(unit.ApplicationName()).Select(bson.M{\"_id\": 1}).One(&result)\n\tif err == nil {", "video": "" }
{ "audio": "", "image": "", "text": "\n\t\treturn true, nil\n\t} else if err == mgo.ErrNotFound {\n\t\treturn false, nil\n\t} else {\n\t\treturn false, errors.Trace(err)\n\t}\n}", "video": "" }
{ "audio": "", "image": "", "text": " = conn.ServiceInstances().Update(bson.M{\"name\": si.Name, \"service_name\": si.ServiceName, \"bound_units.id\": bson.M{\"$ne\": unit.GetID()}}, updateOp)\n\tconn.Close()\n\tif err != nil {\n\t\tif err == mgo.ErrNotFound {\n\t\t\treturn nil\n\t\t}\n\t\treturn err\n\t}\n\terr ...
{ "audio": "", "image": "", "text": "func minUnitsRemoveOp(st *State, applicationname string) txn.Op {\n\treturn txn.Op{\n\t\tC: minUnitsC,\n\t\tId: ", "video": "" }
{ "audio": "", "image": "", "text": " st.docID(applicationname),\n\t\tRemove: true,\n\t}\n}", "video": "" }
{ "audio": "", "image": "", "text": "\n\n\t\tops = append(ops, txn.Op{\n\t\t\tC: permissionsC,\n\t\t\tId: id,\n\t\t\tAssert: txn.DocExists,\n\t\t\tUpdate: bson.D{{\"$set\", bson.D{{\"access\", \"add-model\"}}}},\n\t\t})\n\t}\n\tif err := iter.Close(); err != nil {\n\t\treturn errors.Trace(err)\n\t}\n\tre...
{ "audio": "", "image": "", "text": "func (a *Application) EnsureMinUnits() (err error) {\n\tdefer errors.DeferredAnnotatef(&err, \"cannot ensure minimum units for application %q\", a)\n\tapp := &Application{st: a.st, doc: a.doc}\n\tfor {\n\t\t// Ensure the application is alive.\n\t\tif app.doc.Life != Alive {\n\...
{ "audio": "", "image": "", "text": "\n\t\tswitch err := a.st.db().RunTransaction(ops); err {\n\t\tcase nil:\n\t\t\t// Assign the new unit.\n\t\t\tunit, err := a.st.Unit(name)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif err := app.st.AssignUnit(unit, AssignNew); err != nil {\n\t\t\t\treturn err\...
{ "audio": "", "image": "", "text": "\tif !ok {\n\t\tw.logError(\"programming error, value not of type unitLXDProfileRemove\")\n\t\treturn\n\t}\n\n\tapp, ok := w.applications[rUnit.appName]\n\tif !ok {\n\t\tw.logError(\"programming error, unit removed before being added, application name not found\")\n\t\treturn\...
{ "audio": "", "image": "", "text": "func aliveUnitsCount(app *Application) (int, error) {\n\tunits, closer := app.st.db().GetCollection(unitsC)", "video": "" }
{ "audio": "", "image": "", "text": "\n\tdefer closer()\n\n\tquery := bson.D{{\"application\", app.doc.Name}, {\"life\", Alive}}\n\treturn units.Find(query).Count()\n}", "video": "" }
{ "audio": "", "image": "", "text": "\t}},\n\t\tapp.MenuItem{\n\t\t\tLabel: \"Source code\",\n\t\t\tOnClick: func() {\n\t\t\t\tapp.Navigate(\"https://github.com/maxence-charriere/app/blob/master/demo/cmd/demo-wasm/hello.go\")\n\t\t\t}},\n\t)\n}", "video": "" }
{ "audio": "", "image": "", "text": "func ensureMinUnitsOps(app *Application) (string, []txn.Op, error) {\n\tasserts := bson.D{{\"txn-revno\", app.doc.TxnRevno}}\n", "video": "" }
{ "audio": "", "image": "", "text": "\treturn app.addUnitOps(\"\", AddUnitParams{}, asserts)\n}", "video": "" }
{ "audio": "", "image": "", "text": "\n\tif err != nil {\n\t\tconn.Apps().Update(bson.M{\"name\": app.Name}, bson.M{\"$addToSet\": bson.M{\"teams\": team.Name}})\n\t\treturn err\n\t}\n\tfor _, user := range users {\n\t\tperms, err := user.Permissions()\n\t\tif err != nil {\n\t\t\tconn.Apps().Update(bson.M{\"name\...
{ "audio": "", "image": "", "text": "func (m *Model) AutoConfigureContainerNetworking(environ environs.BootstrapEnviron) error {\n\tupdateAttrs := make(map[string]interface{})\n\tmodelConfig, err := m.ModelConfig()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfanConfigured, err := m.discoverFan(environ, modelConfig...
{ "audio": "", "image": "", "text": " what to do\n\t} else if environs.SupportsContainerAddresses(CallContext(m.st), environ) {\n\t\tupdateAttrs[\"container-networking-method\"] = \"provider\"\n\t} else if fanConfigured {\n\t\tupdateAttrs[\"container-networking-method\"] = \"fan\"\n\t} else {\n\t\tupdateAttrs[\"c...
{ "audio": "", "image": "", "text": "\n\t// For now, we'll piggyback off the ModelConfig API.\n\tmodelConfig, err := e.ModelConfig()\n\tif err != nil {\n\t\treturn nil, false, err\n\t}\n\tcfg, ok := modelConfig.LogFwdSyslog()\n\treturn cfg, ok, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "func NewFacade(backend Backend, claimer lease.Claimer, auth facade.Authorizer) (*Facade, error) {\n\tif !auth.AuthController() {\n\t\treturn nil,", "video": "" }
{ "audio": "", "image": "", "text": " common.ErrPerm\n\t}\n\treturn &Facade{\n\t\tauth: auth,\n\t\tmodelTag: backend.ModelTag(),\n\t\tcontrollerTag: backend.ControllerTag(),\n\t\tsingularClaimer: claimer,\n\t}, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "\treturn ctx.r.shared.leaseManager.Claimer(\n\t\tlease.SingularControllerNamespace,\n\t\tctx.State().ModelUUID(),\n\t)\n}", "video": "" }
{ "audio": "", "image": "", "text": "func addPackageSourceCmds(cfg CloudConfig, src packaging.PackageSource) []string {\n\tcmds := []string{}\n\n\t// if keyfile is required, add it first\n\tif src.Key != \"\" {\n\t\tkeyFilePath := config.YumKeyfileDir + src.KeyFileName()\n\t\tcmds = append(cmds, addFileCmds(keyFi...
{ "audio": "", "image": "", "text": "\tsourceFile, _ := cfg.getPackagingConfigurer().RenderSource(src)\n\tdata := []byte(sourceFile)\n\tcmds = append(cmds, addFileCmds(repoPath, data, 0644, false)...)\n\n\treturn cmds\n}", "video": "" }
{ "audio": "", "image": "", "text": " log.Println(\"short packet from\", src, len(pkt), \"bytes\")\n return\n } else {\n if dst.Contains(msg.pkt.Dst()) && src.Contains(msg.pkt.Src()) {\n return msg.pkt\n }\n }\n }\n return\n}", "video": "" }
{ "audio": "", "image": "", "text": "func removeStringFromSlice(slice []string, val string) []string {\n\tfor i, str", "video": "" }
{ "audio": "", "image": "", "text": " := range slice {\n\t\tif str == val {\n\t\t\tslice = append(slice[:i], slice[i+1:]...)\n\t\t}\n\t}\n\n\treturn slice\n}", "video": "" }
{ "audio": "", "image": "", "text": " append(ids, i)\n\t}\n\tsort.Slice(ids, func(i, j int) bool {\n\t\treturn ids[i].CreationDate.After(ids[j].CreationDate)\n\t})\n\tfor _, i := range ids {\n\t\treturn i\n\t}\n\treturn Identity{}\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (s machineStatus) machineName() string {\n\tif s.DisplayName == \"\" {\n", "video": "" }
{ "audio": "", "image": "", "text": "\t\treturn string(s.InstanceId)\n\t}\n\treturn s.DisplayName\n}", "video": "" }
{ "audio": "", "image": "", "text": " {\n\t\ts.Environment = azure.PublicCloud\n\t} else {\n\t\ts.Environment, err = azure.EnvironmentFromName(v)\n\t}\n\tif s.Values[Resource] == \"\" {\n\t\ts.Values[Resource] = s.Environment.ResourceManagerEndpoint\n\t}\n\treturn\n}", "video": "" }
{ "audio": "", "image": "", "text": "func NewDestroyCommand() cmd.Command {\n\tdestroyCmd := &destroyCommand{\n\t\tclock: jujuclock.WallClock,\n\t}\n\tdestroyCmd.CanClearCurrentModel = true\n\treturn modelcmd.Wrap(", "video": "" }
{ "audio": "", "image": "", "text": "\n\t\tdestroyCmd,\n\t\tmodelcmd.WrapSkipDefaultModel,\n\t\tmodelcmd.WrapSkipModelFlags,\n\t)\n}", "video": "" }
{ "audio": "", "image": "", "text": " CharmResourcesCommand\n\tc.setResourceLister(resourceLister)\n\treturn modelcmd.Wrap(&c)\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (m *containerManager) DestroyContainer(id instance.Id) error {\n\treturn", "video": "" }
{ "audio": "", "image": "", "text": " errors.Trace(m.server.RemoveContainer(string(id)))\n}", "video": "" }
{ "audio": "", "image": "", "text": " {\n\treturn m.SpaceID == spaceID && len(m.Path) == 1 && m.Path[0] == m.ID\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (m *containerManager) CreateContainer(\n\tinstanceConfig *instancecfg.InstanceConfig,\n\tcons constraints.Value,\n\tseries string,\n\tnetworkConfig *container.NetworkConfig,\n\tstorageConfig *container.StorageConfig,\n\tcallback environs.StatusCallbackFunc,\n) (instances....
{ "audio": "", "image": "", "text": " err := m.server.CreateContainerFromSpec(spec)\n\tif err != nil {\n\t\tcallback(status.ProvisioningError, fmt.Sprintf(\"Creating container: %v\", err), nil)\n\t\treturn nil, nil, errors.Trace(err)\n\t}\n\tcallback(status.Running, \"Container started\", nil)\n\n\treturn &lxdIns...
{ "audio": "", "image": "", "text": " != nil {\n\t\t\t\t\to.Message = newEventMessage(v)\n\t\t\t\t}\n\t\t\t\tif err := w.w.write(o); err != nil {\n\t\t\t\t\tastilog.Error(errors.Wrap(err, \"writing callback message failed\"))\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn\n\t\t})\n\t})\n}", "video": "" }