Skip to content
This repository has been archived by the owner on Dec 7, 2023. It is now read-only.

Commit

Permalink
Better tarfile/docker image detection logic
Browse files Browse the repository at this point in the history
  • Loading branch information
twelho committed May 28, 2019
1 parent f80b06d commit e38cf84
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions cmd/ignite/cmd/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@ func RunBuild(out io.Writer, cmd *cobra.Command, args []string) error {
return err
}

// TODO: Better docker/tarfile detection
// Currently source is docker if the given path contains a tag separator ":"
if strings.Contains(buildOptions.source, ":") {
// If the source is a file, import it as a file, otherwise check if it's a docker image
if !util.FileExists(buildOptions.source) {
// Query docker for the image
out, err := util.ExecuteCommand("docker", "images", "-q", buildOptions.source)
if err != nil {
Expand Down Expand Up @@ -89,11 +88,6 @@ func RunBuild(out io.Writer, cmd *cobra.Command, args []string) error {
}

} else {
// Check if given tarfile exists
if !util.FileExists(buildOptions.source) {
return fmt.Errorf("input %q is not a file", buildOptions.source)
}

// Decompress given file to later be extracted into the disk image
// TODO: Either extract directly into image or intermediate tarfile from different formats
decompressor := archiver.FileCompressor{
Expand Down

0 comments on commit e38cf84

Please sign in to comment.