Skip to content

Commit

Permalink
Check if skippedFiles directory exists everywhere, why not
Browse files Browse the repository at this point in the history
  • Loading branch information
emosbaugh committed Jul 24, 2020
1 parent 866834c commit f85a6fd
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 6 deletions.
6 changes: 5 additions & 1 deletion ffi/main.go
Expand Up @@ -98,7 +98,11 @@ func UpdateCheck(socket, fromArchivePath, namespace string) {
filepath.Join(tmpRoot, "upstream"),
filepath.Join(tmpRoot, "base"),
filepath.Join(tmpRoot, "overlays"),
filepath.Join(tmpRoot, "skippedFiles"),
}

skippedFilesPath := filepath.Join(tmpRoot, "skippedFiles")
if _, err := os.Stat(skippedFilesPath); err == nil {
paths = append(paths, skippedFilesPath)
}

err = os.Remove(fromArchivePath)
Expand Down
6 changes: 5 additions & 1 deletion ffi/online.go
Expand Up @@ -161,7 +161,11 @@ func RewriteVersion(socket, fromArchivePath, outputFile, downstreamsStr, k8sName
filepath.Join(tmpRoot, "upstream"),
filepath.Join(tmpRoot, "base"),
filepath.Join(tmpRoot, "overlays"),
filepath.Join(tmpRoot, "skippedFiles"),
}

skippedFilesPath := filepath.Join(tmpRoot, "skippedFiles")
if _, err := os.Stat(skippedFilesPath); err == nil {
paths = append(paths, skippedFilesPath)
}

if err := tarGz.Archive(paths, outputFile); err != nil {
Expand Down
12 changes: 10 additions & 2 deletions ffi/updatedownload.go
Expand Up @@ -119,7 +119,11 @@ func UpdateDownload(socket, fromArchivePath, namespace, registryJson, cursor str
filepath.Join(tmpRoot, "upstream"),
filepath.Join(tmpRoot, "base"),
filepath.Join(tmpRoot, "overlays"),
filepath.Join(tmpRoot, "skippedFiles"),
}

skippedFilesPath := filepath.Join(tmpRoot, "skippedFiles")
if _, err := os.Stat(skippedFilesPath); err == nil {
paths = append(paths, skippedFilesPath)
}

err = os.Remove(fromArchivePath)
Expand Down Expand Up @@ -294,7 +298,11 @@ func UpdateDownloadFromAirgap(socket, fromArchivePath, namespace, registryJson,
filepath.Join(tmpRoot, "upstream"),
filepath.Join(tmpRoot, "base"),
filepath.Join(tmpRoot, "overlays"),
filepath.Join(tmpRoot, "skippedFiles"),
}

skippedFilesPath := filepath.Join(tmpRoot, "skippedFiles")
if _, err := os.Stat(skippedFilesPath); err == nil {
paths = append(paths, skippedFilesPath)
}

err = os.Remove(fromArchivePath)
Expand Down
5 changes: 4 additions & 1 deletion integration/replicated/generate.go
Expand Up @@ -144,7 +144,10 @@ func generateExpectedFilesystem(namespace, rawArchivePath string) ([]byte, error
path.Join(tmpRootDir, "upstream"),
path.Join(tmpRootDir, "base"),
path.Join(tmpRootDir, "overlays"),
path.Join(tmpRootDir, "skippedFiles"),
}
skippedFilesPath := path.Join(tmpRootDir, "skippedFiles")
if _, err := os.Stat(skippedFilesPath); err == nil {
paths = append(paths, skippedFilesPath)
}
if err := tarGz.Archive(paths, archiveFile); err != nil {
return nil, errors.Wrap(err, "failed to create archive")
Expand Down
6 changes: 5 additions & 1 deletion pkg/pull/archive.go
Expand Up @@ -32,7 +32,11 @@ func writeArchiveAsConfigMap(pullOptions PullOptions, u *upstreamtypes.Upstream,
path.Join(pullOptions.RootDir, u.Name, "upstream"),
path.Join(pullOptions.RootDir, u.Name, "base"),
path.Join(pullOptions.RootDir, u.Name, "overlays"),
path.Join(pullOptions.RootDir, u.Name, "skippedFiles"),
}

skippedFilesPath := path.Join(pullOptions.RootDir, "skippedFiles")
if _, err := os.Stat(skippedFilesPath); err == nil {
paths = append(paths, skippedFilesPath)
}

tempDir, err := ioutil.TempDir("", "kots")
Expand Down

0 comments on commit f85a6fd

Please sign in to comment.