Fix for Lint warnings
* This commit handles only warnings of mentioned type warning: comment on exported function <funcname> should be of the form "<funcname> ..." * In this case, there were comments for the exported function/constant/var for which warnings raised, but not in expected format. * So this fix is mostly formating the comment to avoid lint warnings. Observations: * comment did not had function name * function name in comment was immediately follwed by comma => function followed by space and any description is expected * function was not mentioned in the first line of the comment => when there is multiline comment, first line should start with function name Change-Id: Ife97104ebc1054f4e34259dca51e8bdb42b33bbd Relates-To:#148
This commit is contained in:
parent
a4001d255f
commit
f696ed5f11
@ -33,8 +33,8 @@ airshipctl config get-credentials
|
||||
airshipctl config get-credentials e2e`
|
||||
)
|
||||
|
||||
// An AuthInfo refers to a particular user for a cluster
|
||||
// NewCmdConfigGetAuthInfo returns a Command instance for 'config -AuthInfo' sub command
|
||||
// An AuthInfo refers to a particular user for a cluster
|
||||
func NewCmdConfigGetAuthInfo(rootSettings *environment.AirshipCTLSettings) *cobra.Command {
|
||||
o := &config.AuthInfoOptions{}
|
||||
cmd := &cobra.Command{
|
||||
|
@ -415,7 +415,7 @@ func (c *Config) SetKubeConfig(kubeConfig *clientcmdapi.Config) {
|
||||
c.kubeConfig = kubeConfig
|
||||
}
|
||||
|
||||
// Get A Cluster
|
||||
// GetCluster returns a cluster instance
|
||||
func (c *Config) GetCluster(cName, cType string) (*Cluster, error) {
|
||||
_, exists := c.Clusters[cName]
|
||||
if !exists {
|
||||
@ -519,8 +519,7 @@ func (c *Config) GetClusters() []*Cluster {
|
||||
return clusters
|
||||
}
|
||||
|
||||
// Context Operations from Config point of view
|
||||
// Get Context
|
||||
// GetContext returns a context instance
|
||||
func (c *Config) GetContext(cName string) (*Context, error) {
|
||||
context, exists := c.Contexts[cName]
|
||||
if !exists {
|
||||
@ -580,7 +579,7 @@ func (c *Config) ModifyContext(context *Context, theContext *ContextOptions) {
|
||||
}
|
||||
}
|
||||
|
||||
// CurrentContext methods Returns the appropriate information for the current context
|
||||
// GetCurrentContext methods Returns the appropriate information for the current context
|
||||
// Current Context holds labels for the approriate config objects
|
||||
// Cluster is the name of the cluster for this context
|
||||
// ClusterType is the name of the clustertype for this context, it should be a flag we pass to it??
|
||||
@ -647,6 +646,7 @@ func (c *Config) CurrentContextEntryPoint(clusterType string, phase string) (str
|
||||
phase), nil
|
||||
}
|
||||
|
||||
// GetAuthInfo returns an instance of authino
|
||||
// Credential or AuthInfo related methods
|
||||
func (c *Config) GetAuthInfo(aiName string) (*AuthInfo, error) {
|
||||
authinfo, exists := c.AuthInfos[aiName]
|
||||
|
@ -13,7 +13,7 @@ const (
|
||||
Initinfra = "initinfra"
|
||||
)
|
||||
|
||||
// Sorted
|
||||
// AllClusterTypes holds cluster types
|
||||
var AllClusterTypes = [2]string{Ephemeral, Target}
|
||||
|
||||
// Constants defining default values
|
||||
|
@ -5,15 +5,15 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Repo errors
|
||||
|
||||
// ErrMutuallyExclusiveAuthSSHPass is returned when ssh-pass type
|
||||
// is selected and http-pass, ssh-key or key-pass options are defined
|
||||
// ErrIncompatibleAuthOptions is returned when incompatible
|
||||
// AuthTypes are provided
|
||||
type ErrIncompatibleAuthOptions struct {
|
||||
ForbiddenOptions []string
|
||||
AuthType string
|
||||
}
|
||||
|
||||
// NewErrIncompetibleAuthOptions returns Error of type
|
||||
// ErrIncompatibleAuthOptions
|
||||
func NewErrIncompetibleAuthOptions(fo []string, ao string) error {
|
||||
return ErrIncompatibleAuthOptions{
|
||||
ForbiddenOptions: fo,
|
||||
@ -21,11 +21,14 @@ func NewErrIncompetibleAuthOptions(fo []string, ao string) error {
|
||||
}
|
||||
}
|
||||
|
||||
// Error of type ErrIncompatibleAuthOptions is returned when
|
||||
// ssh-pass type is selected and http-pass, ssh-key or key-pass
|
||||
// options are defined
|
||||
func (e ErrIncompatibleAuthOptions) Error() string {
|
||||
return fmt.Sprintf("Can not use %s options, with auth type %s", e.ForbiddenOptions, e.AuthType)
|
||||
}
|
||||
|
||||
// ErrAuthTypeNotSupported is returned with wrong AuthType is provided
|
||||
// ErrAuthTypeNotSupported is returned when wrong AuthType is provided
|
||||
type ErrAuthTypeNotSupported struct {
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ type Config struct {
|
||||
kubeConfig *kubeconfig.Config
|
||||
}
|
||||
|
||||
// Encapsulates the Cluster Type as an enumeration
|
||||
// ClusterPurpose encapsulates the Cluster Type as an enumeration
|
||||
type ClusterPurpose struct {
|
||||
// Cluster map of referenceable names to cluster configs
|
||||
ClusterTypes map[string]*Cluster `json:"cluster-type"`
|
||||
@ -86,7 +86,7 @@ type Cluster struct {
|
||||
Bootstrap string `json:"bootstrap-info"`
|
||||
}
|
||||
|
||||
// Modules, generic configuration for modules
|
||||
// Modules encapsulates all module configurations
|
||||
// Configuration that the Bootstrap Module would need
|
||||
// Configuration that the Document Module would need
|
||||
// Configuration that the Workflows Module would need
|
||||
@ -179,7 +179,7 @@ type RepoCheckout struct {
|
||||
ForceCheckout bool `json:"force"`
|
||||
}
|
||||
|
||||
// Holds the complex cluster name information
|
||||
// ClusterComplexName holds the complex cluster name information
|
||||
// Encapsulates the different operations around using it.
|
||||
type ClusterComplexName struct {
|
||||
Name string
|
||||
|
@ -1,15 +1,14 @@
|
||||
package document
|
||||
|
||||
const (
|
||||
// Label Selectors
|
||||
const (
|
||||
BaseAirshipSelector = "airshipit.org"
|
||||
EphemeralHostSelector = BaseAirshipSelector + "/ephemeral-node in (True, true)"
|
||||
EphemeralUserDataSelector = BaseAirshipSelector + "/ephemeral-user-data in (True, true)"
|
||||
InitInfraSelector = BaseAirshipSelector + "/phase = initinfra"
|
||||
|
||||
// Annotation Selectors
|
||||
// DeployToK8sSelector checks that deploy-k8s label is not equal to true or True (string)
|
||||
// Please note that by default every document in the manifest is to be deployed to kubernetes cluster.
|
||||
// so this selector simply checks that deploy-k8s label is not equal to true or True (string)
|
||||
DeployToK8sSelector = "config.kubernetes.io/local-config notin (True, true)"
|
||||
)
|
||||
|
||||
|
@ -1,3 +1,15 @@
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package redfish
|
||||
|
||||
import (
|
||||
@ -17,9 +29,10 @@ const (
|
||||
RedfishURLSchemeSeparator = "+"
|
||||
)
|
||||
|
||||
// GetResourceIDFromURL returns a parsed Redfish resource ID
|
||||
// from the Redfish URL
|
||||
// Redfish Id ref is a URI which contains resource Id
|
||||
// as the last part. This function extracts resource
|
||||
// ID from ID ref
|
||||
// as the last part.
|
||||
func GetResourceIDFromURL(refURL string) string {
|
||||
u, err := url.Parse(refURL)
|
||||
if err != nil {
|
||||
@ -33,7 +46,7 @@ func GetResourceIDFromURL(refURL string) string {
|
||||
return id
|
||||
}
|
||||
|
||||
// Checks whether an ID exists in Redfish IDref collection
|
||||
// IsIDInList checks whether an ID exists in Redfish IDref collection
|
||||
func IsIDInList(idRefList []redfishClient.IdRef, id string) bool {
|
||||
for _, r := range idRefList {
|
||||
rID := GetResourceIDFromURL(r.OdataId)
|
||||
|
@ -58,7 +58,7 @@ func DummyConfig() *config.Config {
|
||||
return conf
|
||||
}
|
||||
|
||||
// DummyContext , utility function used for tests
|
||||
// DummyContext creates a Context config object for unit testing
|
||||
func DummyContext() *config.Context {
|
||||
c := config.NewContext()
|
||||
c.NameInKubeconf = "dummy_cluster_ephemeral"
|
||||
@ -72,7 +72,7 @@ func DummyContext() *config.Context {
|
||||
return c
|
||||
}
|
||||
|
||||
// DummyCluster, utility function used for tests
|
||||
// DummyCluster creates a Cluster config object for unit testing
|
||||
func DummyCluster() *config.Cluster {
|
||||
c := config.NewCluster()
|
||||
|
||||
@ -86,7 +86,7 @@ func DummyCluster() *config.Cluster {
|
||||
return c
|
||||
}
|
||||
|
||||
// DummyManifest , utility function used for tests
|
||||
// DummyManifest creates a Manifest config object for unit testing
|
||||
func DummyManifest() *config.Manifest {
|
||||
m := config.NewManifest()
|
||||
// Repositories is the map of repository adddressable by a name
|
||||
@ -97,7 +97,7 @@ func DummyManifest() *config.Manifest {
|
||||
return m
|
||||
}
|
||||
|
||||
// DummyRepository, utility function used for tests
|
||||
// DummyRepository creates a Repository config object for unit testing
|
||||
func DummyRepository() *config.Repository {
|
||||
return &config.Repository{
|
||||
URLString: "http://dummy.url.com/manifests.git",
|
||||
@ -112,7 +112,7 @@ func DummyRepository() *config.Repository {
|
||||
}
|
||||
}
|
||||
|
||||
// DummyRepoAuth , utility function used for tests
|
||||
// DummyRepoAuth creates a RepoAuth config object for unit testing
|
||||
func DummyRepoAuth() *config.RepoAuth {
|
||||
return &config.RepoAuth{
|
||||
Type: "ssh-key",
|
||||
@ -120,7 +120,8 @@ func DummyRepoAuth() *config.RepoAuth {
|
||||
}
|
||||
}
|
||||
|
||||
// DummyRepoCheckout, utility function used for checks
|
||||
// DummyRepoCheckout creates a RepoCheckout config object
|
||||
// for unit testing
|
||||
func DummyRepoCheckout() *config.RepoCheckout {
|
||||
return &config.RepoCheckout{
|
||||
Tag: "v1.0.1",
|
||||
@ -128,7 +129,7 @@ func DummyRepoCheckout() *config.RepoCheckout {
|
||||
}
|
||||
}
|
||||
|
||||
// DummyAuthInfo , utility function used for tests
|
||||
// DummyAuthInfo creates a AuthInfo config object for unit testing
|
||||
func DummyAuthInfo() *config.AuthInfo {
|
||||
a := config.NewAuthInfo()
|
||||
authinfo := kubeconfig.NewAuthInfo()
|
||||
@ -141,7 +142,8 @@ func DummyAuthInfo() *config.AuthInfo {
|
||||
return a
|
||||
}
|
||||
|
||||
// DummyKubeAuthInfo , utility function used for tests
|
||||
// DummyKubeAuthInfo creates a AuthInfo kubeconfig object
|
||||
// for unit testing
|
||||
func DummyKubeAuthInfo() *kubeconfig.AuthInfo {
|
||||
authinfo := kubeconfig.NewAuthInfo()
|
||||
authinfo.Username = "dummy_username"
|
||||
@ -152,14 +154,14 @@ func DummyKubeAuthInfo() *kubeconfig.AuthInfo {
|
||||
return authinfo
|
||||
}
|
||||
|
||||
// DummyModules , utility function used for tests
|
||||
// DummyModules returns Modules config objects for unit testing
|
||||
func DummyModules() *config.Modules {
|
||||
m := config.NewModules()
|
||||
m.BootstrapInfo["dummy_bootstrap_config"] = DummyBootstrap()
|
||||
return m
|
||||
}
|
||||
|
||||
// DummyClusterPurpose , utility function used for tests
|
||||
// DummyClusterPurpose creates ClusterPurpose config object for unit testing
|
||||
func DummyClusterPurpose() *config.ClusterPurpose {
|
||||
cp := config.NewClusterPurpose()
|
||||
cp.ClusterTypes["ephemeral"] = DummyCluster()
|
||||
@ -193,6 +195,8 @@ func InitConfig(t *testing.T) (conf *config.Config, cleanup func(*testing.T)) {
|
||||
return conf, cleanup
|
||||
}
|
||||
|
||||
// DummyClusterOptions creates ClusterOptions config object
|
||||
// for unit testing
|
||||
func DummyClusterOptions() *config.ClusterOptions {
|
||||
co := &config.ClusterOptions{}
|
||||
co.Name = "dummy_cluster"
|
||||
@ -205,6 +209,8 @@ func DummyClusterOptions() *config.ClusterOptions {
|
||||
return co
|
||||
}
|
||||
|
||||
// DummyContextOptions creates ContextOptions config object
|
||||
// for unit testing
|
||||
func DummyContextOptions() *config.ContextOptions {
|
||||
co := &config.ContextOptions{}
|
||||
co.Name = "dummy_context"
|
||||
@ -216,6 +222,8 @@ func DummyContextOptions() *config.ContextOptions {
|
||||
return co
|
||||
}
|
||||
|
||||
// DummyAuthInfoOptions creates AuthInfoOptions config object
|
||||
// for unit testing
|
||||
func DummyAuthInfoOptions() *config.AuthInfoOptions {
|
||||
authinfo := &config.AuthInfoOptions{}
|
||||
authinfo.Username = "dummy_username"
|
||||
@ -226,6 +234,7 @@ func DummyAuthInfoOptions() *config.AuthInfoOptions {
|
||||
return authinfo
|
||||
}
|
||||
|
||||
// DummyBootstrap creates Bootstrap config object for unit testing
|
||||
func DummyBootstrap() *config.Bootstrap {
|
||||
bs := &config.Bootstrap{}
|
||||
cont := config.Container{
|
||||
|
Loading…
Reference in New Issue
Block a user