diff --git a/upup/pkg/fi/cloudup/loader.go b/upup/pkg/fi/cloudup/loader.go index 474934c69e925..a9262ca7ae98a 100644 --- a/upup/pkg/fi/cloudup/loader.go +++ b/upup/pkg/fi/cloudup/loader.go @@ -466,7 +466,7 @@ func (l *Loader) loadObjectMap(key string, data map[string]interface{}) (map[str klog.V(4).Infof("Built %s:%s => %v", key, k, o.Interface()) if inferredName { - hn, ok := o.Interface().(fi.HasName) + hn, ok := o.Interface().(fi.HasSetName) if ok { hn.SetName(name) } diff --git a/upup/pkg/fi/named.go b/upup/pkg/fi/named.go index 32af8a9227ebf..904aeab0fd7e2 100644 --- a/upup/pkg/fi/named.go +++ b/upup/pkg/fi/named.go @@ -16,8 +16,12 @@ limitations under the License. package fi -// HasName indicates that the task has a Name +// HasName indicates that the task has a Name. type HasName interface { GetName() *string +} + +// HasSetName indicates that the task can set its Name. +type HasSetName interface { SetName(name string) } diff --git a/upup/pkg/fi/nodeup/nodetasks/archive.go b/upup/pkg/fi/nodeup/nodetasks/archive.go index 7ff47400bd204..52d7eb2d0feb6 100644 --- a/upup/pkg/fi/nodeup/nodetasks/archive.go +++ b/upup/pkg/fi/nodeup/nodetasks/archive.go @@ -77,10 +77,6 @@ func (e *Archive) GetName() *string { return &e.Name } -func (e *Archive) SetName(name string) { - e.Name = name -} - // String returns a string representation, implementing the Stringer interface func (e *Archive) String() string { return fmt.Sprintf("Archive: %s %s->%s", e.Name, e.Source, e.TargetDir) diff --git a/upup/pkg/fi/nodeup/nodetasks/bindmount.go b/upup/pkg/fi/nodeup/nodetasks/bindmount.go index fa250e107f143..0d9726e98ddab 100644 --- a/upup/pkg/fi/nodeup/nodetasks/bindmount.go +++ b/upup/pkg/fi/nodeup/nodetasks/bindmount.go @@ -55,10 +55,6 @@ func (e *BindMount) GetName() *string { return fi.String("BindMount-" + e.Mountpoint) } -func (e *BindMount) SetName(name string) { - klog.Fatalf("SetName not supported for BindMount task") -} - var _ fi.HasDependencies = &BindMount{} // GetDependencies implements HasDependencies::GetDependencies diff --git a/upup/pkg/fi/nodeup/nodetasks/chattr.go b/upup/pkg/fi/nodeup/nodetasks/chattr.go index 5558564dfcba4..781c469c1723a 100644 --- a/upup/pkg/fi/nodeup/nodetasks/chattr.go +++ b/upup/pkg/fi/nodeup/nodetasks/chattr.go @@ -46,10 +46,6 @@ func (e *Chattr) GetName() *string { return fi.String("Chattr-" + e.File) } -func (e *Chattr) SetName(name string) { - klog.Fatalf("SetName not supported for Chattr task") -} - var _ fi.HasDependencies = &Chattr{} // GetDependencies implements HasDependencies::GetDependencies diff --git a/upup/pkg/fi/nodeup/nodetasks/file.go b/upup/pkg/fi/nodeup/nodetasks/file.go index 8024eae3f71ae..4356d7640a3fc 100644 --- a/upup/pkg/fi/nodeup/nodetasks/file.go +++ b/upup/pkg/fi/nodeup/nodetasks/file.go @@ -122,10 +122,6 @@ func (f *File) GetName() *string { return &f.Path } -func (f *File) SetName(name string) { - klog.Fatalf("SetName not supported for File task") -} - func (f *File) String() string { return fmt.Sprintf("File: %q", f.Path) } diff --git a/upup/pkg/fi/nodeup/nodetasks/group.go b/upup/pkg/fi/nodeup/nodetasks/group.go index 07230026abeeb..1440470b3bb48 100644 --- a/upup/pkg/fi/nodeup/nodetasks/group.go +++ b/upup/pkg/fi/nodeup/nodetasks/group.go @@ -47,10 +47,6 @@ func (f *GroupTask) GetName() *string { return &f.Name } -func (f *GroupTask) SetName(name string) { - klog.Fatalf("SetName not supported for Group task") -} - func (e *GroupTask) Find(c *fi.Context) (*GroupTask, error) { info, err := fi.LookupGroup(e.Name) if err != nil { diff --git a/upup/pkg/fi/nodeup/nodetasks/issue_cert.go b/upup/pkg/fi/nodeup/nodetasks/issue_cert.go index 0647935d35bf5..cc157b4d0d258 100644 --- a/upup/pkg/fi/nodeup/nodetasks/issue_cert.go +++ b/upup/pkg/fi/nodeup/nodetasks/issue_cert.go @@ -48,10 +48,6 @@ func (i *IssueCert) GetName() *string { return &i.Name } -func (i *IssueCert) SetName(name string) { - i.Name = name -} - // String returns a string representation, implementing the Stringer interface func (i *IssueCert) String() string { return fmt.Sprintf("IssueCert: %s", i.Name) diff --git a/upup/pkg/fi/nodeup/nodetasks/load_image.go b/upup/pkg/fi/nodeup/nodetasks/load_image.go index 8f6513d63ec6c..787894e7e6016 100644 --- a/upup/pkg/fi/nodeup/nodetasks/load_image.go +++ b/upup/pkg/fi/nodeup/nodetasks/load_image.go @@ -74,10 +74,6 @@ func (t *LoadImageTask) GetName() *string { return &t.Name } -func (t *LoadImageTask) SetName(name string) { - klog.Fatalf("SetName not supported for LoadImageTask") -} - func (t *LoadImageTask) String() string { return fmt.Sprintf("LoadImageTask: %v", t.Sources) } diff --git a/upup/pkg/fi/nodeup/nodetasks/package.go b/upup/pkg/fi/nodeup/nodetasks/package.go index ffd48c3bc718b..fbf654bf2fafc 100644 --- a/upup/pkg/fi/nodeup/nodetasks/package.go +++ b/upup/pkg/fi/nodeup/nodetasks/package.go @@ -117,10 +117,6 @@ func (f *Package) GetName() *string { return &f.Name } -func (f *Package) SetName(name string) { - f.Name = name -} - // isOSPackage returns true if this is an OS provided package (as opposed to a bare .deb, for example) func (p *Package) isOSPackage() bool { return fi.StringValue(p.Source) == "" diff --git a/upup/pkg/fi/nodeup/nodetasks/service.go b/upup/pkg/fi/nodeup/nodetasks/service.go index dd099feeee57f..2889e7e76fffb 100644 --- a/upup/pkg/fi/nodeup/nodetasks/service.go +++ b/upup/pkg/fi/nodeup/nodetasks/service.go @@ -381,7 +381,3 @@ var _ fi.HasName = &Service{} func (f *Service) GetName() *string { return &f.Name } - -func (f *Service) SetName(name string) { - klog.Fatalf("SetName not supported for Service task") -} diff --git a/upup/pkg/fi/nodeup/nodetasks/user.go b/upup/pkg/fi/nodeup/nodetasks/user.go index 13268cb763f3b..8e479d6ab3622 100644 --- a/upup/pkg/fi/nodeup/nodetasks/user.go +++ b/upup/pkg/fi/nodeup/nodetasks/user.go @@ -49,10 +49,6 @@ func (f *UserTask) GetName() *string { return &f.Name } -func (f *UserTask) SetName(name string) { - klog.Fatalf("SetName not supported for User task") -} - func (e *UserTask) Find(c *fi.Context) (*UserTask, error) { info, err := fi.LookupUser(e.Name) if err != nil {