id stringlengths 2 7 | text stringlengths 17 51.2k | title stringclasses 1
value |
|---|---|---|
c8000 | nil {
log.Errorf("Error encoding nameserver state. Err: %v", err)
return []byte{}, err
}
return jsonState, nil
} | |
c8001 | consul client")
return nil, err
}
cc.client = client
// verify we can reach the consul
_, _, err = client.KV().List("/", nil)
if err != nil {
if api.IsServerError(err) || strings.Contains(err.Error(), "EOF") ||
strings.Contains(err.Error(), "connection refused") {
for i := 0; i < maxConsulRetries; i++... | |
c8002 | }
}
// Consul returns success and a nil kv when a key is not found,
// translate it to 'Key not found' error
if resp == nil {
return errors.New("Key not found")
}
// Parse JSON response
if err := json.Unmarshal(resp.Value, retVal); err != nil {
log.Errorf("Error parsing object %v, Err %v", resp.Value, err)... | |
c8003 | return nil, err
}
}
// Consul returns success and a nil kv when a key is not found,
// translate it to 'Key not found' error
if kvs == nil {
return []string{}, nil
}
var keys []string
for _, kv := range kvs {
keys = append(keys, string(kv.Value))
}
return keys, nil
} | |
c8004 | jsonVal}, nil)
if err != nil {
if api.IsServerError(err) || strings.Contains(err.Error(), "EOF") ||
strings.Contains(err.Error(), "connection refused") {
for i := 0; i < maxConsulRetries; i++ {
_, err = cp.client.KV().Put(&api.KVPair{Key: key, Value: jsonVal}, nil)
if err == nil {
break
}
... | |
c8005 | maxConsulRetries; i++ {
_, err = cp.client.KV().Delete(key, nil)
if err == nil {
break
}
// Retry after a delay
time.Sleep(time.Second)
}
}
}
return err
} | |
c8006 | d.Client.KV().Delete(key, nil)
return err
} | |
c8007 | err := d.Read(key)
if err != nil {
return err
}
return unmarshal(encodedState, value)
} | |
c8008 | interface{}) error) ([]core.State, error) {
baseKey = processKey(baseKey)
return readAllStateCommon(d, baseKey, sType, unmarshal)
} | |
c8009 |
link.ObjKey = obj.GetKey()
} | |
c8010 | (*linkSet)[obj.GetKey()] = Link{
ObjType: obj.GetType(),
ObjKey: obj.GetKey(),
}
return nil
} | |
c8011 | the link from map
delete(*linkSet, obj.GetKey())
return nil
} | |
c8012 | objKey
err := cdb.SetObj(key, value)
if err != nil {
log.Errorf("Error storing object %s. Err: %v", key, err)
return err
}
return nil
} | |
c8013 | objKey
err := cdb.GetObj(key, retVal)
if err != nil {
log.Errorf("Error reading object: %s. Err: %v", key, err)
return err
}
return nil
} | |
c8014 | nil {
log.Errorf("Error deleting object: %s. Err: %v", key, err)
}
return nil
} | |
c8015 | "/modeldb/" + objType + "/"
return cdb.ListDir(key)
} | |
c8016 | {
log.Errorf("Error finding epg: %s. Err: %v", epgKey, err)
return 0, core.Errorf("EPG not found")
}
// return endpoint group id
return cfgEpGroup.EndpointGroupID, nil
} | |
c8017 | log.Errorf("Failed to network info %v %v ", networkID, nErr)
return "", nErr
}
gw := nwCfg.Gateway + "/" + strconv.Itoa(int(nwCfg.SubnetLen))
log.Debugf("GW is %s for epg %s", gw, epgObj.GroupName)
return gw, nil
} | |
c8018 | ACI mode", ruleName)
return errors.New(errStr)
}
if rule.Action == "deny" {
log.Debugf("==Ignoring deny rule %v", ruleName)
continue
}
filter := filterInfo{Protocol: rule.Protocol, ServPort: strconv.Itoa(rule.Port)}
cn := getContractName(policy.PolicyName, rule.FromEndpointGroup,
rule.ToEndpoin... | |
c8019 | return errors.New(err)
}
if err := appendEpgInfo(eMap, epgObj, stateDriver); err != nil {
log.Errorf("Error getting epg info %v", err)
return err
}
}
// walk the map and add to ANS
for _, epg := range eMap.Specs {
ans.Epgs = append(ans.Epgs, epg)
log.Debugf("Added epg %v", epg.Name)
}
for _, c... | |
c8020 | log.Errorf("Delete failed. Error: %v", err)
return err
}
if resp.Result != "success" {
log.Errorf("Delete failed %v - %v", resp.Result, resp.Info)
}
time.Sleep(time.Second)
return nil
} | |
c8021 | fmt.Sprintf("%ds", ttl),
eventChan: make(chan LockEvent, 1),
stopChan: make(chan struct{}, 1),
mutex: new(sync.Mutex),
client: cp.client,
}, nil
} | |
c8022 | lk.mutex.Lock()
defer lk.mutex.Unlock()
return lk.isReleased
} | |
c8023 | := lk.client.Session().CreateNoChecks(&sessCfg, nil)
if err != nil {
log.Errorf("Error Creating session for lock %s. Err: %v", lk.keyName, err)
return err
}
log.Infof("Created session: %s for lock %s/%s", sessionID, lk.name, lk.myID)
// save the session ID for later
lk.mutex.Lock()
lk.sessionID = sessionID... | |
c8024 | // If lock was released, exit this go routine
return
}
// Create new consul session
err = lk.createSession()
if err != nil {
log.Errorf("Error Creating session for lock %s. Err: %v", lk.keyName, err)
}
}
} | |
c8025 |
operEp.StateDriver = stateDriver
err = operEp.Read(epID)
if err != nil {
return nil, err
}
return operEp, nil
} | |
c8026 | driver, only create the bridge
// if it's not already created
// XXX: revisit if the bridge-name needs to be configurable
brCreated := false
for _, row := range d.cache[bridgeTable] {
if row.Fields["name"] == bridgeName {
brCreated = true
break
}
}
if !brCreated {
err = d.createDeleteBridge(bridgeNa... | |
c8027 | || d.ovsSwitch == nil {
return
}
linkUpd := ofnet.LinkUpdateInfo{
LinkName: intf.(string),
LacpStatus: newLacpStatus.(bool),
}
log.Debugf("LACP_UPD: Interface: %+v. LACP Status - (Old: %+v, New: %+v)\n", intf, oldLacpStatus, newLacpStatus)
d.ovsSwitch.HandleLinkUpdates(linkUpd)
}
} | |
c8028 | for uuid, row := range d.cache[bridgeTable] {
name := row.Fields["name"].(string)
if name == bridgeName {
brUUID = []libovsdb.UUID{uuid}
break
}
}
}
// Inserting/Deleting a Bridge row in Bridge table requires mutating
// the open_vswitch table.
mutateUUID := brUUID
mutateSet, _ := libovsdb.Ne... | |
c8029 | extIDMap := extIDs.(libovsdb.OvsMap).GoMap
if portID, ok := extIDMap["endpoint-id"]; ok && portID == id {
return row.Fields["name"].(string), nil
}
}
}
return "", core.Errorf("Ovs port/intf not found for id: %s", id)
} | |
c8030 |
// interface table ops
intfOp = libovsdb.Operation{
Op: opStr,
Table: interfaceTable,
Row: intf,
UUIDName: intfUUIDStr,
}
// insert/delete a row in Port table
portOp := libovsdb.Operation{}
port := make(map[string]interface{})
port["name"] = intfName
if tag != 0 {
port["vlan_mode"] = "... | |
c8031 | }
intfList = append(intfList, intfInfo.Fields["name"].(string))
case libovsdb.OvsSet: // Port bond case
intfUUIDList := row.Fields["interfaces"].(libovsdb.OvsSet)
for _, intfUUID := range intfUUIDList.GoSet {
intfInfo := d.GetIntfInfo(intfUUID.(libovsdb.UUID))
if reflect.DeepEqual(intfInfo, ... | |
c8032 | {
if intfUUID == uuid {
return row
}
}
return libovsdb.Row{}
} | |
c8033 | port["bond_mode"] = "balance-tcp"
port["lacp"] = "active"
lacpMap := make(map[string]string)
lacpMap["lacp-fallback-ab"] = "true"
port["other_config"], err = libovsdb.NewOvsMap(lacpMap)
portUUIDStr := bondName
portUUID := []libovsdb.UUID{{GoUuid: portUUIDStr}}
portOp = libovsdb.Operation{
Op: opStr,
... | |
c8034 | }
d.cacheLock.RUnlock()
// mutate the Ports column of the row in the Bridge table
mutateSet, _ := libovsdb.NewOvsSet(portUUID)
mutation := libovsdb.NewMutation("ports", opStr, mutateSet)
condition = libovsdb.NewCondition("name", "==", d.bridgeName)
mutateOp := libovsdb.Operation{
Op: "mutate",
Table:... | |
c8035 |
}
mutateOp := libovsdb.Operation{
Op: "update",
Table: interfaceTable,
Row: intf,
Where: []interface{}{condition},
}
operations := []libovsdb.Operation{mutateOp}
return d.performOvsdbOps(operations)
} | |
c8036 | {
log.Errorf("error '%s' creating options from %v \n", err, intfOptions)
return err
}
// Add an entry in Interface table
intfOp := libovsdb.Operation{
Op: opStr,
Table: interfaceTable,
Row: intf,
UUIDName: intfUUIDStr,
}
// insert/delete a row in Port table
port := make(map[string]int... | |
c8037 | and populating ovsdb entry for the interface
//may not be populated instantly.
if ofpPort := reflect.ValueOf(value).Float(); ofpPort != -1 {
return uint32(ofpPort), nil
}
}
}
time.Sleep(300 * time.Millisecond)
if retryNo == maxOfportRetry {
return 0, errors.New("ofPort not found")
}
r... | |
c8038 | switch t := value.(type) {
case string:
return true, t
default:
// return false, ""
}
}
default:
// return false, ""
}
}
}
}
// We could not find the interface name
return false, ""
} | |
c8039 | | %s | %s}",
cm, core.Docker, core.Kubernetes, core.SwarmMode)
}
masterRTCfg.clusterMode = cm
return nil
} | |
c8040 |
}
gCfg.Auto.VLANs = gc.VLANs
gcfgUpdateList = append(gcfgUpdateList, "vlan")
}
if gc.VXLANs != "" {
_, err = netutils.ParseTagRanges(gc.VXLANs, "vxlan")
if err != nil {
return err
}
gCfg.Auto.VXLANs = gc.VXLANs
gcfgUpdateList = append(gcfgUpdateList, "vxlan")
}
if gc.FwdMode != "" {
masterGc... | |
c8041 |
if err != nil {
return err
}
err = gCfg.Clear()
if err != nil {
return err
}
}
// Delete old state
gOper := &gstate.Oper{}
gOper.StateDriver = stateDriver
err = gOper.Read("")
if err == nil {
err = gOper.Clear()
if err != nil {
return err
}
}
return nil
} | |
c8042 | return validateTenantConfig(tenant)
} | |
c8043 | log.Warnf("Couldn't read global config %v", uErr)
return false, nil
}
if masterGc.NwInfraType != "aci" {
log.Debugf("NwInfra type is %v, no ACI", masterGc.NwInfraType)
return false, nil
}
return true, nil
} | |
c8044 | err != nil {
http.Error(w,
core.Errorf("marshaling json failed. Error: %s", err).Error(),
http.StatusInternalServerError)
return
}
w.Write(resp)
return
} | |
c8045 | return
}
// build the proxy url
url, _ := url.Parse(fmt.Sprintf("http://%s", masterNode))
// Create a proxy for the URL
proxy := httputil.NewSingleHostReverseProxy(url)
// modify the request url
newReq := *r
// newReq.URL = url
// Serve http
proxy.ServeHTTP(w, &newReq)
} | |
c8046 | {
return s.StateDriver.ReadAllState(endpointConfigPathPrefix, s, json.Unmarshal)
} | |
c8047 | {
return s.StateDriver.WatchAllState(endpointConfigPathPrefix, s, json.Unmarshal,
rsps)
} | |
c8048 | resource manager. Error: %s", err)
}
// Create an objdb client
d.objdbClient, err = objdb.InitClient(d.ClusterStoreDriver, []string{d.ClusterStoreURL})
if err != nil {
log.Fatalf("Error connecting to state store: driver %q, URLs %q. Err: %v", d.ClusterStoreDriver, d.ClusterStoreURL, err)
}
} | |
c8049 | err = d.ofnetMaster.AddNode(nodeInfo)
if err != nil {
log.Errorf("Error adding node %v. Err: %v", nodeInfo, err)
}
} else if agentEv.EventType == objdb.WatchServiceEventDel {
var res bool
log.Infof("Unregister node %+v", nodeInfo)
d.ofnetMaster.UnRegisterNode(&nodeInfo, &res)
go d.startDeferr... | |
c8050 | := range srvList {
if srv.Hostname == hostName {
return srv.HostAddr, nil
}
}
return "", fmt.Errorf("Could not find plugin instance with name: %s", hostName)
} | |
c8051 | }
pluginAddress, err := d.getPluginAddress(ep.HomingHost)
if err != nil {
return err
}
epDelURL := "http://" + pluginAddress + ":9090/debug/reclaimEndpoint/" + ep.ID
err = utils.HTTPDel(epDelURL)
if err != nil {
return fmt.Errorf("Error sending HTTP delete request to %s. Err: %+v", plugin... | |
c8052 |
// initialize policy manager
mastercfg.InitPolicyMgr(d.stateDriver, d.ofnetMaster)
// setup HTTP routes
d.registerRoutes(router)
d.startListeners(router, d.stopLeaderChan)
log.Infof("Exiting Leader mode")
} | |
c8053 | service
d.registerService()
// just wait on stop channel
log.Infof("Listening in follower mode")
d.startListeners(router, d.stopFollowerChan)
log.Info("Exiting follower mode")
} | |
c8054 | d.currState = "leader"
// Run the HTTP listener
go d.runLeader()
} | |
c8055 | state
d.currState = "follower"
// run follower loop
go d.runFollower()
} | |
c8056 | func() bool {
return d.currState == "leader"
}
networkpolicy.InitK8SServiceWatch(d.ControlURL, isLeader)
}
} | |
c8057 | = make(chan bool, 1)
// set current state
d.currState = "follower"
// Start off being a follower
go d.runFollower()
// Main run loop waiting on leader lock
for {
// Wait for lock events
select {
case event := <-leaderLock.EventChan():
if event.EventType == objdb.LockAcquired {
log.Infof("Leader l... | |
c8058 | getting netplugin nodes. Err: %v", err)
return nil, err
}
// Add each node
pluginNodes := []string{}
for _, srv := range srvList {
pluginNodes = append(pluginNodes, srv.HostAddr)
}
// Get all netmaster services
srvList, err = d.objdbClient.GetService("netmaster")
if err != nil {
log.Errorf("Error getti... | |
c8059 | mastercfg.GetEndpointGroupID(stateDriver, epg.GroupName, epg.TenantName)
if err != nil {
log.Errorf("Error getting epgID for %s. Err: %v", epgpKey, err)
return err
}
// Create the epg policy
gp, err = mastercfg.NewEpgPolicy(epgpKey, epgID, policy)
if err != nil {
log.Errorf("Error creating EPG policy. Err:... | |
c8060 | rule == nil {
log.Errorf("Error finding the rule %s", ruleKey)
continue
}
log.Infof("Deleting Rule %s from epgp policy %s", ruleKey, epgpKey)
// Add the rule to epg Policy
err := gp.DelRule(rule)
if err != nil {
log.Errorf("Error deleting rule %s from epg polict %s. Err: %v", ruleKey, epgpKey, err... | |
c8061 | }
// Add the Rule
err := gp.AddRule(rule)
if err != nil {
log.Errorf("Error adding the rule %s to epg policy %s. Err: %v", rule.Key, gpKey, err)
return err
}
// Save the policy state
err = gp.Write()
if err != nil {
return err
}
}
return nil
} | |
c8062 | utils.EtcdNameStr:
case utils.ConsulNameStr:
default:
return nil, core.Errorf("Unsupported state-store %q", stateStore)
}
// Setup instance info
instInfo := core.InstanceInfo{
DbURL: clusterStore,
}
return utils.NewStateDriver(stateStore, &instInfo)
} | |
c8063 |
for i := min; i <= max; i++ {
values = append(values, uint(i))
}
} else if len(minMax) == 1 {
val, err := strconv.Atoi(minMax[0])
if err != nil {
log.Errorf("Invalid range: %v", subrange)
return nil, err
}
values = append(values, uint(val))
} else {
log.Errorf("Invalid range: %v"... | |
c8064 | else if rsrcName == "vxlan" {
numVxlans, vxlansInUse := gCfg.GetVxlansInUse()
fmt.Printf("Num Vxlans: %d\n Current Vxlans in Use: %s\n", numVxlans, vxlansInUse)
// see if we need to set the resource
if rsrcVal != "" {
values, err := parseRange(rsrcVal)
if err != nil {
log.Errorf("Error parsing range... | |
c8065 | cniLog.Infof("processing cmd: %v", ipArgs)
return exec.Command(ipCmd, ipArgs...).CombinedOutput()
} | |
c8066 | out, err := cniReq.ipnsExecute(namespace, arg1); err != nil {
cniLog.Errorf("failed to execute [%d] %v %s, %s", idx, err, arg1, string(out))
return out, err
}
}
return nil, nil
} | |
c8067 |
return NewAPIClient(contivK8Config.K8sAPIServer, contivK8Config.K8sCa,
contivK8Config.K8sKey, contivK8Config.K8sCert, contivK8Config.K8sToken)
} | |
c8068 | case "WARN":
log.Debugf("epWatch : %s", epEvent.errStr)
break
case "FATAL":
log.Errorf("epWatch : %s", epEvent.errStr)
break
case "ERROR":
log.Warnf("epWatch : %s", epEvent.errStr)
watchClient.WatchSvcEps(epCh)
break
default:
np.SvcProviderUpdate(epEvent.svcName,... | |
c8069 | os.Remove(driverPath)
os.MkdirAll(cniapi.PluginPath, 0700)
go func() {
l, err := net.ListenUnix("unix", &net.UnixAddr{Name: driverPath, Net: "unix"})
if err != nil {
panic(err)
}
log.Infof("k8s plugin listening on %s", driverPath)
http.Serve(l, router)
l.Close()
log.Infof("k8s plugin closing %s", ... | |
c8070 | ServiceName: req.Group,
EndpointID: req.EndpointID,
}
var delResp master.DeleteEndpointResponse
masterErr := cluster.MasterPostReq("/plugin/deleteEndpoint", &delReq, &delResp)
if pluginErr != nil {
log.Errorf("failed to delete endpoint: %s from netplugin %s",
netID+"-"+req.EndpointID, pluginErr)
retur... | |
c8071 | err)
epCleanUp(req)
return nil, err
}
ep, err = utils.GetEndpoint(netID + "-" + req.EndpointID)
if err != nil {
epCleanUp(req)
return nil, err
}
log.Debug(ep)
// need to get the subnetlen from nw state.
nw, err := utils.GetNetwork(netID)
if err != nil {
epCleanUp(req)
return nil, err
}
epRespo... | |
c8072 | * time.Second)
link, err = netlink.LinkByName(ifname)
if err != nil {
log.Errorf("unable to find link %q. Error %q", ifname, err)
}
return link, err
}
return link, err
} | |
c8073 | nw name space: %v", ns)
}
elements := strings.Split(ns, "/")
return strconv.Atoi(elements[2])
} | |
c8074 | %s",
cidr, newname, err)
return nil
}
log.Infof("Output from ip assign: %v", assignIP)
if cidr6 != "" {
out, err := osexec.Command(nsenterPath, "-t", nsPid, "-n", "-F", "--", ipPath,
"-6", "address", "add", cidr6, "dev", newname).CombinedOutput()
if err != nil {
log.Errorf("unable to assign IPv6 %s ... | |
c8075 |
if gw6 != "" {
out, err := osexec.Command(nsenterPath, "-t", nsPid, "-n", "-F", "--", routePath,
"-6", "add", "default", "gw", gw6, intfName).CombinedOutput()
if err != nil {
log.Errorf("unable to set default IPv6 gateway %s. Error: %s - %s", gw6, err, out)
return nil
}
}
return nil
} | |
c8076 | tenant, _ := kubeAPIClient.GetPodLabel(pInfo.K8sNameSpace, pInfo.Name,
"io.contiv.tenant")
log.Infof("labels is %s/%s/%s for pod %s\n", tenant, netw, epg, pInfo.Name)
resp.Tenant = tenant
resp.Network = netw
resp.Group = epg
resp.EndpointID = pInfo.InfraContainerID
resp.Name = pInfo.Name
return &resp, nil
} | |
c8077 | getting labels. Err: %v", err)
setErrorResp(&resp, "Error getting labels", err)
return resp, err
}
netPlugin.DeleteHostAccPort(epReq.EndpointID)
if err = epCleanUp(epReq); err != nil {
log.Errorf("failed to delete pod, error: %s", err)
}
resp.Result = 0
resp.EndpointID = pInfo.InfraContainerID
return res... | |
c8078 | pErr *error) {
if *pErr != nil {
log.Infof("Freeing %s on error", ipAddress)
networkReleaseAddress(nwCfg, epgCfg, ipAddress)
}
} | |
c8079 |
err = nwCfg.Read(networkID)
if err != nil {
log.Errorf("error reading oper network %s. Error: %s", network.Name, err)
return err
}
for _, ep := range network.Endpoints {
epReq := CreateEndpointRequest{}
epReq.ConfigEP = ep
_, err = CreateEndpoint(stateDriver, nwCfg, &epReq)
if err != nil {
... | |
c8080 | epOper := &drivers.OperEndpointState{}
epOper.StateDriver = stateDriver
err := epOper.Read(epID)
if err != nil {
log.Errorf("Failed to read epOper: %+v", epOper)
return err
}
err = epOper.Clear()
if err != nil {
log.Errorf("Error deleting oper state for %+v", epOper)
} else {
log.... | |
c8081 |
epgCfg.StateDriver = stateDriver
err = epgCfg.Read(epCfg.EndpointGroupKey)
if err != nil {
log.Errorf("Error reading EPG for endpoint: %+v", epCfg)
}
epgCfg.EpCount--
// write updated epg state
err = epgCfg.Write()
if err != nil {
log.Errorf("error writing epg config. Error: %s", err)... | |
c8082 | container '%s' and host '%s'",
ep.Container, ep.Host)
for _, epCfg := range epCfgs {
cfg := epCfg.(*mastercfg.CfgEndpointState)
if cfg.EndpointID != ep.Container {
continue
}
cfg.HomingHost = ep.Host
err = cfg.Write()
if err != nil {
log.Errorf("error updating epCfg. Error: %s", err)
... | |
c8083 | endpointGroup)
modeldb.RemoveLinkSet(&endpointGroup.LinkSets.ExtContractsGrps, contractsGrpObj)
// Links broken, update the contracts group object.
err := contractsGrpObj.Write()
if err != nil {
return err
}
} else {
log.Errorf("Error cleaning up consumed ext contract %s", contractsGrp)
con... | |
c8084 | Establish the necessary links.
modeldb.AddLinkSet(&contractsGrpObj.LinkSets.EndpointGroups, endpointGroup)
modeldb.AddLinkSet(&endpointGroup.LinkSets.ExtContractsGrps, contractsGrpObj)
// Links made, write the policy set object.
err := contractsGrpObj.Write()
if err != nil {
return err
}
}
return ni... | |
c8085 | // Make sure the tenant exists
tenant := contivModel.FindTenant(contractsGroup.TenantName)
if tenant == nil {
return core.Errorf("Tenant %s not found", contractsGroup.TenantName)
}
// NOTE: Nothing more needs to be done here. This object
// need not be created in the masterCfg.
return nil
} | |
c8086 | update not supported: %s", contractsGroup.ContractsGroupName)
return core.Errorf("external contracts update not supported")
} | |
c8087 | isExtContractsGroupUsed(contractsGroup) == true {
log.Errorf("Error: External contracts groups is being used: %s", contractsGroup.ContractsGroupName)
return core.Errorf("External contracts group is in-use")
}
return nil
} | |
c8088 | // Send HTTP response
http.Error(w, err.Error(), http.StatusInternalServerError)
} else {
// Send HTTP response as Json
content, err := json.Marshal(resp)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
w.WriteHeader(http.StatusInternalServerEr... | |
c8089 | log.Infof("Body content: %s", string(content))
http.NotFound(w, r)
} | |
c8090 | http.StatusOK {
log.Errorf("HTTP error response. Status: %s, StatusCode: %d", res.Status, res.StatusCode)
return fmt.Errorf("HTTP error response. Status: %s, StatusCode: %d", res.Status, res.StatusCode)
}
// Read the entire response
body, err := ioutil.ReadAll(res.Body)
if err != nil {
log.Errorf("Error dur... | |
c8091 | response. Status: %s, StatusCode: %d", res.Status, res.StatusCode)
return fmt.Errorf("HTTP error response. Status: %s, StatusCode: %d", res.Status, res.StatusCode)
}
log.Debugf("Results for (%s): %+v\n", url, res)
return nil
} | |
c8092 | with http:// or https://")
} else if err != nil {
return nil, err
}
client := ContivClient{
baseURL: baseURL,
customRequestHeaders: [][2]string{},
httpClient: &http.Client{},
}
return &client, nil
} | |
c8093 | we will raise an error if there's already an auth token set.
for _, pair := range c.customRequestHeaders {
if pair[0] == authTokenHeader {
return errors.New("an auth token has already been set")
}
}
c.addCustomRequestHeader(authTokenHeader, token)
return nil
} | |
c8094 | // send the login POST request
resp, err := c.httpClient.Post(url, "application/json", bytes.NewBuffer(payload))
if err != nil {
return nil, nil, err
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return nil, nil, err
}
return resp, body, nil
} | |
c8095 | there is only one.
// Go internally canonicalizes them when we call Header.Add() anyways.
name = strings.ToLower(name)
c.customRequestHeaders = append(c.customRequestHeaders, [2]string{name, value})
} | |
c8096 | {
for _, pair := range c.customRequestHeaders {
req.Header.Add(pair[0], pair[1])
}
} | |
c8097 | err != nil {
log.Debugf("Error creating aciGw %+v. Err: %v", obj, err)
return err
}
return nil
} | |
c8098 |
log.Debugf("Error getting aciGws. Err: %v", err)
return nil, err
}
return &objList, nil
} | |
c8099 | != nil {
log.Debugf("Error deleting aciGw %s. Err: %v", keyStr, err)
return err
}
return nil
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.