Merge "Fix Lint warnings: Missing comments for functions"

This commit is contained in:
Zuul 2020-04-30 16:47:06 +00:00 committed by Gerrit Code Review
commit c33e0a20ad
5 changed files with 13 additions and 0 deletions

View File

@ -27,10 +27,12 @@ type ApplyOptions struct {
ApplyOptions *apply.ApplyOptions ApplyOptions *apply.ApplyOptions
} }
// SetDryRun enables/disables the dry run flag in kubectl apply options
func (ao *ApplyOptions) SetDryRun(dryRun bool) { func (ao *ApplyOptions) SetDryRun(dryRun bool) {
ao.ApplyOptions.DryRun = dryRun ao.ApplyOptions.DryRun = dryRun
} }
// SetPrune enables/disables the prune flag in kubectl apply options
func (ao *ApplyOptions) SetPrune(label string) { func (ao *ApplyOptions) SetPrune(label string) {
if label != "" { if label != "" {
ao.ApplyOptions.Prune = true ao.ApplyOptions.Prune = true
@ -45,6 +47,7 @@ func (ao *ApplyOptions) SetSourceFiles(fileNames []string) {
ao.ApplyOptions.DeleteOptions.Filenames = fileNames ao.ApplyOptions.DeleteOptions.Filenames = fileNames
} }
// Run executes the `apply` command.
func (ao *ApplyOptions) Run() error { func (ao *ApplyOptions) Run() error {
return ao.ApplyOptions.Run() return ao.ApplyOptions.Run()
} }

View File

@ -50,6 +50,7 @@ func NewKubectl(f cmdutil.Factory) *Kubectl {
} }
} }
// WithBufferDir sets buffer dir
func (kubectl *Kubectl) WithBufferDir(bd string) *Kubectl { func (kubectl *Kubectl) WithBufferDir(bd string) *Kubectl {
kubectl.bufferDir = bd kubectl.bufferDir = bd
return kubectl return kubectl

View File

@ -19,6 +19,8 @@ import (
cmdutil "k8s.io/kubectl/pkg/cmd/util" cmdutil "k8s.io/kubectl/pkg/cmd/util"
) )
// FactoryFromKubeConfigPath returns a factory with the
// default Kubernetes resources for the given kube config path
func FactoryFromKubeConfigPath(kp string) cmdutil.Factory { func FactoryFromKubeConfigPath(kp string) cmdutil.Factory {
kf := genericclioptions.NewConfigFlags(false) kf := genericclioptions.NewConfigFlags(false)
kf.KubeConfig = &kp kf.KubeConfig = &kp

View File

@ -20,10 +20,15 @@ import (
aerror "opendev.org/airship/airshipctl/pkg/errors" aerror "opendev.org/airship/airshipctl/pkg/errors"
) )
// TODO: This need to be refactored to match the error format used elsewhere in airshipctl
// Usage of this error should be deprecated as it doesn't provide meaningful feedback to the user.
// GenericError provides general feedback about an error that occurred in a remote operation
type GenericError struct { type GenericError struct {
aerror.AirshipError aerror.AirshipError
} }
// NewRemoteDirectErrorf retruns formatted remote direct errors
func NewRemoteDirectErrorf(format string, v ...interface{}) error { func NewRemoteDirectErrorf(format string, v ...interface{}) error {
e := &GenericError{} e := &GenericError{}
e.Message = fmt.Sprintf(format, v...) e.Message = fmt.Sprintf(format, v...)

View File

@ -26,6 +26,8 @@ import (
"opendev.org/airship/airshipctl/pkg/log" "opendev.org/airship/airshipctl/pkg/log"
) )
// URLSchemeSeparator holds the separator for URL scheme
// Example: git+ssh
const ( const (
redfishURLSchemeSeparator = "+" redfishURLSchemeSeparator = "+"
) )