refactor builder in kubectl factory

This commit is contained in:
ymqytw
2017-11-07 17:42:03 -08:00
parent 42d5dc709e
commit 06c5be9802
25 changed files with 125 additions and 159 deletions

View File

@@ -122,19 +122,13 @@ func (o *SetLastAppliedOptions) Complete(f cmdutil.Factory, cmd *cobra.Command)
}
func (o *SetLastAppliedOptions) Validate(f cmdutil.Factory, cmd *cobra.Command) error {
mapper, typer, err := f.UnstructuredObject()
if err != nil {
return err
}
r := f.NewBuilder().
Unstructured(f.UnstructuredClientForMapping, mapper, typer).
r := f.NewUnstructuredBuilder().
NamespaceParam(o.Namespace).DefaultNamespace().
FilenameParam(o.EnforceNamespace, &o.FilenameOptions).
Latest().
Flatten().
Do()
err = r.Err()
err := r.Err()
if err != nil {
return err
}