Skip to content

Commit

Permalink
fixing more url stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
chrislovecnm committed Oct 20, 2017
1 parent a72ad4c commit 3de15b2
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions upup/pkg/fi/cloudup/apply_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ func (c *ApplyClusterCmd) Run() error {
}

if err := c.applyFileAssets(assetBuilder); err != nil {
return err
return fmt.Errorf("error getting assets: %v", err)
}

checkExisting := true
Expand Down Expand Up @@ -938,18 +938,12 @@ func (c *ApplyClusterCmd) applyFileAssets(assetBuilder *assets.AssetBuilder) err
c.Cluster.Spec.KubernetesVersion = versionWithoutV
}

var baseURL *url.URL
var baseURL string
var err error
if components.IsBaseURL(c.Cluster.Spec.KubernetesVersion) {
baseURL, err = url.Parse(c.Cluster.Spec.KubernetesVersion)
if err != nil {
return err
}
baseURL = c.Cluster.Spec.KubernetesVersion
} else {
baseURL, err = url.Parse("https://storage.googleapis.com/kubernetes-release/release/v" + c.Cluster.Spec.KubernetesVersion)
if err != nil {
return err
}
baseURL = "https://storage.googleapis.com/kubernetes-release/release/v" + c.Cluster.Spec.KubernetesVersion
}

k8sAssetsNames := []string{
Expand All @@ -961,8 +955,12 @@ func (c *ApplyClusterCmd) applyFileAssets(assetBuilder *assets.AssetBuilder) err
}

for _, a := range k8sAssetsNames {
k := &url.URL { }
k.Path = path.Join(baseURL.Path, a)
// TODO how do I parse this URL once?
k, err := url.Parse(baseURL)
if err != nil {
return err
}
k.Path = path.Join(k.Path, a)
u := k.String()
sha := fmt.Sprintf("%s.sha", u)

Expand Down

0 comments on commit 3de15b2

Please sign in to comment.