Skip to content

Commit

Permalink
Merge pull request #624 from dseevr/typos
Browse files Browse the repository at this point in the history
*: fix misspellings project-wide and integrate `misspell` tool into 'checks' target to catch them
  • Loading branch information
jojimt authored Nov 17, 2016
2 parents f688944 + 7594d22 commit c76d616
Show file tree
Hide file tree
Showing 27 changed files with 68 additions and 58 deletions.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ govet-src: $(PKG_DIRS)
$(info +++ govet $(PKG_DIRS))
@for dir in $?; do $(GOVET_CMD) $${dir} || exit 1;done

misspell-src: $(PKG_DIRS)
$(info +++ check spelling $(PKG_DIRS))
misspell -locale US -error $?

go-version:
$(info +++ check go version)
ifneq ($(GO_VERSION), $(lastword $(sort $(GO_VERSION) $(GO_MIN_VERSION))))
Expand All @@ -64,7 +68,7 @@ ifneq ($(GO_VERSION), $(firstword $(sort $(GO_VERSION) $(GO_MAX_VERSION))))
$(error go version check failed, expected <= $(GO_MAX_VERSION), found $(GO_VERSION))
endif

checks: go-version gofmt-src golint-src govet-src
checks: go-version gofmt-src golint-src govet-src misspell-src

# We cannot perform sudo inside a golang, the only reason to split the rules
# here
Expand Down
2 changes: 1 addition & 1 deletion core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ limitations under the License.
// hardware/kernel/device specific programming implementation, if any.
package core

// Address is a string represenation of a network address (mac, ip, dns-name, url etc)
// Address is a string representation of a network address (mac, ip, dns-name, url etc)
type Address struct {
addr string
}
Expand Down
6 changes: 3 additions & 3 deletions docs/Design.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ This section provides a brief overview of some terms used in rest of the documen
In application delivery environments, a management system coordinates the efforts of agents to accomplish the goal of placing applications in a cluster of resources (like compute, storage and network) based on their requirements, using the available resources efficiently and effectively. The management system also provides a front end (a central command control) to accept/input the application requirements. In other contexts, application delivery environments are also referred to as orchestration or scheduling platforms, container runtimes etc and the applications are also referred to as compute jobs or services.

In application delivery environments there is usually atleast one agent per managed resource. And the application requirements may include (but are not limited to) specification of resource constraints and affinities; communication patterns etc.
In application delivery environments there is usually at least one agent per managed resource. And the application requirements may include (but are not limited to) specification of resource constraints and affinities; communication patterns etc.

Unless explicitly stated otherwise, for the logic performed at the managed resource the Management Function refers to the agent running on that resource, otherwise it refers to the central command control for the user facing logic like accepting/processing application requirement.

Expand All @@ -44,7 +44,7 @@ Logically centralized decision making refers to the act of reaching consensus on

##Design Goals
Integrating a management function with a network function usually requires a coupling of the two, thereby resulting in following challenges:
- There is often unclarity/uncertainity of the definition of the integrating interfaces between the two without an available implementation of atleast one. This becomes even harder if both the implementations are a work in progress by independent teams, which is usually the case.
- There is often unclarity/uncertainty of the definition of the integrating interfaces between the two without an available implementation of at least one. This becomes even harder if both the implementations are a work in progress by independent teams, which is usually the case.
- It is difficulty to intermix the available implementations of functions without re-writing/modifying the functions themselves.
- There is a risk of exposing network function configuration (usually technology specific, imperative, procedural in nature) as management function configuration (which can be intent-based/declarative, promise-based etc), thereby complicating user experience. Example, to use a switch capable of supporting multi-teanancy using vlans and qos if the APIs exposed by the management function need to take care of specifying these values then it impedes defining a high-level API at management function.

Expand Down Expand Up @@ -148,7 +148,7 @@ As discussed above the Plugin interface implementation invokes the Driver interf
4. Resource deallocation for a network (vlan ids, vxlan ids) and endpoint (ip address) happens before the deletion of network and endpoint respectively.

Notes:
- The above constraints provide guarantees wrt the order of Driver interface invocation. However, they do not guarantee the presence/absence of the state when the Driver interface is actually invoked. The driver implementations are expected to deal with such scenarios. Example, when a delete for endpoint is received it is not guranteed that the network state will exist. So a driver implementation might need to cache/keep enough state to handle endpoint deletion gracefully.
- The above constraints provide guarantees wrt the order of Driver interface invocation. However, they do not guarantee the presence/absence of the state when the Driver interface is actually invoked. The driver implementations are expected to deal with such scenarios. Example, when a delete for endpoint is received it is not guaranteed that the network state will exist. So a driver implementation might need to cache/keep enough state to handle endpoint deletion gracefully.
- The Constraints 'c' and 'd' might become out of scope of the Plugin interface based on design approach we pick. See section on [open design items](#open-items-and-ongoing-work>)

##Integration Details
Expand Down
2 changes: 1 addition & 1 deletion mgmtfn/dockplugin/dockplugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func httpError(w http.ResponseWriter, message string, err error) {

content, errc := json.Marshal(api.Response{Err: fullError})
if errc != nil {
log.Warnf("Error received marshalling error response: %v, original error: %s", errc, fullError)
log.Warnf("Error received marshaling error response: %v, original error: %s", errc, fullError)
return
}

Expand Down
4 changes: 2 additions & 2 deletions mgmtfn/k8splugin/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ const (
ServiceAffinityNone ServiceAffinity = "None"
)

// Protocol defines network protocols supported for things like conatiner ports.
// Protocol defines network protocols supported for things like container ports.
type Protocol string

const (
Expand Down Expand Up @@ -288,7 +288,7 @@ type ServiceSpec struct {
SessionAffinity ServiceAffinity `json:"sessionAffinity,omitempty"`
}

// ServicePort conatins information on service's port.
// ServicePort contains information on service's port.
type ServicePort struct {
// The name of this port within the service. This must be a DNS_LABEL.
// All ports within a ServiceSpec must have unique names. This maps to
Expand Down
4 changes: 2 additions & 2 deletions mgmtfn/mesosplugin/netcontiv/cniplugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,15 +194,15 @@ func (cniApp *cniAppInfo) handleHTTP(url string, jsonReq *bytes.Buffer) int {
switch httpResp.StatusCode {

case http.StatusOK:
cniLog.Infof("received http OK reponse from netplugin")
cniLog.Infof("received http OK response from netplugin")
info, err := ioutil.ReadAll(httpResp.Body)
if err != nil {
return cniApp.sendCniErrorResp("failed to read success response from netplugin :" + err.Error())
}
return cniApp.sendCniResp(info, cniapi.CniStatusSuccess)

case http.StatusInternalServerError:
cniLog.Infof("received http error reponse from netplugin")
cniLog.Infof("received http error response from netplugin")
info, err := ioutil.ReadAll(httpResp.Body)
if err != nil {
return cniApp.sendCniErrorResp("failed to read error response from netplugin :" + err.Error())
Expand Down
2 changes: 1 addition & 1 deletion netmaster/daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ func (d *MasterDaemon) registerRoutes(router *mux.Router) {
resp, err := json.Marshal(info)
if err != nil {
http.Error(w,
core.Errorf("marshalling json failed. Error: %s", err).Error(),
core.Errorf("marshaling json failed. Error: %s", err).Error(),
http.StatusInternalServerError)
return
}
Expand Down
4 changes: 2 additions & 2 deletions netmaster/daemon/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func getVersion(w http.ResponseWriter, r *http.Request) {
resp, err := json.Marshal(ver)
if err != nil {
http.Error(w,
core.Errorf("marshalling json failed. Error: %s", err).Error(),
core.Errorf("marshaling json failed. Error: %s", err).Error(),
http.StatusInternalServerError)
return
}
Expand Down Expand Up @@ -185,7 +185,7 @@ func get(getAll bool, hook func(id string) ([]core.State, error)) func(http.Resp

if resp, err = json.Marshal(states); err != nil {
http.Error(w,
core.Errorf("marshalling json failed. Error: %s", err).Error(),
core.Errorf("marshaling json failed. Error: %s", err).Error(),
http.StatusInternalServerError)
return
}
Expand Down
2 changes: 1 addition & 1 deletion netmaster/master/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"github.com/contiv/netplugin/utils"
)

//SvcProviderUpdate propogates service provider updates to netplugins
//SvcProviderUpdate propagates service provider updates to netplugins
func SvcProviderUpdate(serviceID string, isDelete bool) error {
providerList := []string{}

Expand Down
34 changes: 17 additions & 17 deletions netmaster/objApi/objapi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func cleanupState() {
}
}

// checkError checks for error and fails teh test
// checkError checks for error and fails the test
func checkError(t *testing.T, testStr string, err error) {
if err != nil {
t.Fatalf("Error during %s. Err: %v", testStr, err)
Expand Down Expand Up @@ -405,7 +405,7 @@ func checkCreateNetProfile(t *testing.T, expError bool, dscp, burst int, bandwid
if err != nil && !expError {
t.Fatalf("Error creating Netprofile {%+v}. Err: %v", np, err)
} else if err == nil && expError {
t.Fatalf("Create NetProfile {%+v} succeded while expecing error", np)
t.Fatalf("Create NetProfile {%+v} succeeded while expecing error", np)
} else if err == nil {
//check if netprofile is created.
_, err := contivClient.NetprofileGet(tenantName, profileName)
Expand Down Expand Up @@ -435,7 +435,7 @@ func checkDeleteNetProfile(t *testing.T, expError bool, profileName, tenantName
if err != nil && !expError {
t.Fatalf("Error deleting Netprofile %s/%s Err: %v", profileName, tenantName, err)
} else if err == nil && expError {
t.Fatalf("delete NetProfile %s/%s succeded while expecing error", profileName, tenantName)
t.Fatalf("delete NetProfile %s/%s succeeded while expecing error", profileName, tenantName)
} else if err == nil {
//check if netprofile is deleted.
_, err := contivClient.NetprofileGet(tenantName, profileName)
Expand Down Expand Up @@ -491,7 +491,7 @@ func checkCreateEpgNp(t *testing.T, expError bool, tenant, ProfileName, network,
if err != nil && !expError {
t.Fatalf("Error creating epg {%+v}. Err: %v", epg, err)
} else if err == nil && expError {
t.Fatalf("Create epg {%+v} succeded while expecing error", epg)
t.Fatalf("Create epg {%+v} succeeded while expecing error", epg)
} else if err == nil {
// verify epg is created
_, err := contivClient.EndpointGroupGet(tenant, group)
Expand Down Expand Up @@ -834,34 +834,34 @@ func TestTenantAddDelete(t *testing.T) {

// Try creating invalid names and verify we get an error
if contivClient.TenantPost(&client.Tenant{TenantName: "tenant:invalid"}) == nil {
t.Fatalf("tenant create succedded while expecting error")
t.Fatalf("tenant create succeeded while expecting error")
}
if contivClient.TenantPost(&client.Tenant{TenantName: "tenant|invalid"}) == nil {
t.Fatalf("tenant create succedded while expecting error")
t.Fatalf("tenant create succeeded while expecting error")
}
if contivClient.TenantPost(&client.Tenant{TenantName: "tenant\\invalid"}) == nil {
t.Fatalf("tenant create succedded while expecting error")
t.Fatalf("tenant create succeeded while expecting error")
}
if contivClient.TenantPost(&client.Tenant{TenantName: "tenant#invalid"}) == nil {
t.Fatalf("tenant create succedded while expecting error")
t.Fatalf("tenant create succeeded while expecting error")
}
if contivClient.TenantPost(&client.Tenant{TenantName: "-tenant"}) == nil {
t.Fatalf("tenant create succedded while expecting error")
t.Fatalf("tenant create succeeded while expecting error")
}
if contivClient.TenantPost(&client.Tenant{TenantName: "tenant@invalid"}) == nil {
t.Fatalf("tenant create succedded while expecting error")
t.Fatalf("tenant create succeeded while expecting error")
}
if contivClient.TenantPost(&client.Tenant{TenantName: "tenant!invalid"}) == nil {
t.Fatalf("tenant create succedded while expecting error")
t.Fatalf("tenant create succeeded while expecting error")
}
if contivClient.TenantPost(&client.Tenant{TenantName: "tenant~invalid"}) == nil {
t.Fatalf("tenant create succedded while expecting error")
t.Fatalf("tenant create succeeded while expecting error")
}
if contivClient.TenantPost(&client.Tenant{TenantName: "tenant*invalid"}) == nil {
t.Fatalf("tenant create succedded while expecting error")
t.Fatalf("tenant create succeeded while expecting error")
}
if contivClient.TenantPost(&client.Tenant{TenantName: "tenant^invalid"}) == nil {
t.Fatalf("tenant create succedded while expecting error")
t.Fatalf("tenant create succeeded while expecting error")
}

// delete tenant
Expand Down Expand Up @@ -1921,11 +1921,11 @@ func verifyServiceCreate(t *testing.T, tenant, network, serviceName string, port
}

if serviceLbState.IPAddress == "" {
t.Fatalf("Service Created does not have an ip addres allocated")
t.Fatalf("Service Created does not have an ip address allocated")
}

if preferredIP != "" && serviceLbState.IPAddress != preferredIP {
t.Fatalf("Service Created does not have preferred ip addres allocated")
t.Fatalf("Service Created does not have preferred ip address allocated")
}

}
Expand Down Expand Up @@ -2100,7 +2100,7 @@ func get(getAll bool, hook func(id string) ([]core.State, error)) func(http.Resp

if resp, err = json.Marshal(states); err != nil {
http.Error(w,
core.Errorf("marshalling json failed. Error: %s", err).Error(),
core.Errorf("marshaling json failed. Error: %s", err).Error(),
http.StatusInternalServerError)
return
}
Expand Down
2 changes: 1 addition & 1 deletion netplugin/agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ func (ag *Agent) HandleEvents() error {
}
err := <-recvErr
if err != nil {
log.Errorf("Failure occured. Error: %s", err)
log.Errorf("Failure occurred. Error: %s", err)
return err
}

Expand Down
6 changes: 6 additions & 0 deletions scripts/deps
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ then
exit 1
fi

if ! go get -u github.com/client9/misspell/cmd/misspell
then
echo "!!! Could not install misspell"
exit 1
fi

# this is necessary because presumably the `vet` tool needs to be installed in
# $GOROOT. I have not investigated the reason fully yet.
# the check right below this line is to avoid a sudo call on each invocation,
Expand Down
2 changes: 1 addition & 1 deletion scripts/netContain/contivNet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ netplugin=false
vlan_if="invalid"

#This needs to be fixed, we cant rely on the value being supplied from
# paramters, just explosion of parameters is not a great solution
# parameters, just explosion of parameters is not a great solution
#export no_proxy="0.0.0.0, 172.28.11.253"
#echo "172.28.11.253 netmaster" > /etc/hosts

Expand Down
6 changes: 3 additions & 3 deletions scripts/python/api/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def execCmd(self, cmd):
return self.node.runCmd("docker exec " + self.cid + " " + cmd)
return out, err, exitCode

# Execute a command inside a container in backgroud
# Execute a command inside a container in background
def execBgndCmd(self, cmd):
out, err, exitCode = self.node.runCmd("docker exec -d " + self.cid + " " + cmd)
# Retry failures once to workaround docker issue #15713
Expand Down Expand Up @@ -90,7 +90,7 @@ def checkPing(self, ipAddr):
print err
tutils.exit("Ping failed")

# Check if ping succeded
# Check if ping succeeded
pingOutput = ''.join(out)
if "0 received, 100% packet loss" in pingOutput:
print "Ping failed. Output: " + pingOutput
Expand All @@ -108,7 +108,7 @@ def checkPingFailure(self, ipAddr):
tutils.log("Ping failed as expected.")
return True

# Check if ping succeded
# Check if ping succeeded
if "0 received, 100% packet loss" in pingOutput:
tutils.log("Ping failed as expected. Output: " + pingOutput)
return True
Expand Down
2 changes: 1 addition & 1 deletion scripts/python/cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# Create the parser and sub parser
parser = argparse.ArgumentParser()
parser.add_argument('--version', action='version', version='1.0.0')
parser.add_argument("-nodes", required=True, help="list of nodes(comma seperated)")
parser.add_argument("-nodes", required=True, help="list of nodes(comma separated)")
parser.add_argument("-user", default='vagrant', help="User id for ssh")
parser.add_argument("-password", default='vagrant', help="password for ssh")

Expand Down
2 changes: 1 addition & 1 deletion scripts/python/policyScale.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def testConnections(testbed, numContainer):
if testbed.checkConnections(containers, 8000, True) != True:
api.tutils.exit("Connection failed")
if testbed.checkConnections(containers, 7999, False) != False:
api.tutils.exit("Connection succeded while expecting it to fail")
api.tutils.exit("Connection succeeded while expecting it to fail")

# stop netcast listeners
testbed.stopListeners(containers)
Expand Down
2 changes: 1 addition & 1 deletion scripts/python/startPlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# Create the parser and sub parser
parser = argparse.ArgumentParser()
parser.add_argument('--version', action='version', version='1.0.0')
parser.add_argument("-nodes", required=True, help="list of nodes(comma seperated)")
parser.add_argument("-nodes", required=True, help="list of nodes(comma separated)")
parser.add_argument("-user", default='vagrant', help="User id for ssh")
parser.add_argument("-password", default='vagrant', help="password for ssh")
parser.add_argument("-binpath", default='/opt/gopath/bin', help="netplugin/netmaster binary path")
Expand Down
2 changes: 1 addition & 1 deletion scripts/python/startSwarm.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# Parse command line args
# Create the parser and sub parser
parser = argparse.ArgumentParser()
parser.add_argument("-nodes", required=True, help="list of nodes(comma seperated)")
parser.add_argument("-nodes", required=True, help="list of nodes(comma separated)")
parser.add_argument("-user", default='vagrant', help="User id for ssh")
parser.add_argument("-password", default='vagrant', help="password for ssh")
parser.add_argument("-binpath", default='/opt/gopath/bin', help="netplugin/netmaster binary path")
Expand Down
6 changes: 3 additions & 3 deletions state/cfgtool/cfgtool.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ func processResource(stateDriver core.StateDriver, rsrcName, rsrcVal string) err
func processState(stateDriver core.StateDriver, stateName, stateID, fieldName, setVal string) error {
var typeRegistry = make(map[string]core.State)

// build the type registery
// build the type registry
typeRegistry[reflect.TypeOf(mastercfg.CfgEndpointState{}).Name()] = &mastercfg.CfgEndpointState{}
typeRegistry[reflect.TypeOf(mastercfg.CfgNetworkState{}).Name()] = &mastercfg.CfgNetworkState{}
typeRegistry[reflect.TypeOf(mastercfg.CfgBgpState{}).Name()] = &mastercfg.CfgBgpState{}
Expand Down Expand Up @@ -231,7 +231,7 @@ func processState(stateDriver core.StateDriver, stateName, stateID, fieldName, s
// print the object
content, err := json.MarshalIndent(cfgType, "", " ")
if err != nil {
log.Errorf("Error marshalling json: %+v", cfgType)
log.Errorf("Error marshaling json: %+v", cfgType)
return err
}
fmt.Printf("Current value of id: %s{ id: %s }\n%s\n", stateName, stateID, content)
Expand Down Expand Up @@ -282,7 +282,7 @@ func processState(stateDriver core.StateDriver, stateName, stateID, fieldName, s
// print the modified object
content, err := json.MarshalIndent(cfgType, "", " ")
if err != nil {
log.Errorf("Error marshalling json: %+v", cfgType)
log.Errorf("Error marshaling json: %+v", cfgType)
return err
}
fmt.Printf("Writing values:\n%s\n", content)
Expand Down
4 changes: 2 additions & 2 deletions state/consulstatedriver.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ func (d *ConsulStateDriver) ClearState(key string) error {
return err
}

// ReadState reads key into a core.State with the unmarshalling function.
// ReadState reads key into a core.State with the unmarshaling function.
func (d *ConsulStateDriver) ReadState(key string, value core.State,
unmarshal func([]byte, interface{}) error) error {
key = processKey(key)
Expand Down Expand Up @@ -304,7 +304,7 @@ func (d *ConsulStateDriver) WatchAllState(baseKey string, sType core.State,

}

// WriteState writes a value of core.State into a key with a given marshalling function.
// WriteState writes a value of core.State into a key with a given marshaling function.
func (d *ConsulStateDriver) WriteState(key string, value core.State,
marshal func(interface{}) ([]byte, error)) error {
key = processKey(key)
Expand Down
Loading

0 comments on commit c76d616

Please sign in to comment.