Skip to content

Commit

Permalink
refactored to return err
Browse files Browse the repository at this point in the history
  • Loading branch information
chrislovecnm committed Oct 19, 2017
1 parent 871dbee commit a512992
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions nodeup/pkg/model/protokube.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,10 @@ func (t *ProtokubeBuilder) buildSystemdService() (*nodetasks.Service, error) {
return nil, fmt.Errorf("unable to parse KubernetesVersion %q", t.Cluster.Spec.KubernetesVersion)
}

protokubeFlags := t.ProtokubeFlags(*k8sVersion)
protokubeFlags, err := t.ProtokubeFlags(*k8sVersion)
if err != nil {
return nil, err
}
protokubeFlagsArgs, err := flagbuilder.BuildFlags(protokubeFlags)
if err != nil {
return nil, err
Expand Down Expand Up @@ -212,7 +215,7 @@ type ProtokubeFlags struct {
}

// ProtokubeFlags is responsible for building the command line flags for protokube
func (t *ProtokubeBuilder) ProtokubeFlags(k8sVersion semver.Version) *ProtokubeFlags {
func (t *ProtokubeBuilder) ProtokubeFlags(k8sVersion semver.Version) (*ProtokubeFlags, error) {
// @todo: i think we should allow the user to override the source of the image, but for now
// lets keep that for another PR and allow the version change
imageVersion := t.Cluster.Spec.EtcdClusters[0].Version
Expand All @@ -229,8 +232,7 @@ func (t *ProtokubeBuilder) ProtokubeFlags(k8sVersion semver.Version) *ProtokubeF
assets := assets.NewAssetBuilder(nil)
remapped, err := assets.RemapImage(image)
if err != nil {
glog.Errorf("unable to remap container %q: %v", image, err)
glog.Errorf("using default %s", image)
return nil, fmt.Errorf("unable to remap container %q: %v", image, err)
} else {
image = remapped
}
Expand Down Expand Up @@ -304,7 +306,7 @@ func (t *ProtokubeBuilder) ProtokubeFlags(k8sVersion semver.Version) *ProtokubeF
f.ApplyTaints = fi.Bool(true)
}

return f
return f, nil
}

// ProtokubeEnvironmentVariables generates the environments variables for docker
Expand Down

0 comments on commit a512992

Please sign in to comment.