cmd: --blueprint
Moves the blueprint argument to a named argument; freeing up space to later be able to pass in multiple image types. This also slightly simplifies the case where we're building without a blueprint available. Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
This commit is contained in:
parent
ffb22eb837
commit
c1c60a3c77
2 changed files with 11 additions and 6 deletions
|
|
@ -84,15 +84,18 @@ func cmdManifestWrapper(cmd *cobra.Command, args []string, w io.Writer, archChec
|
|||
return nil, err
|
||||
}
|
||||
|
||||
var blueprintPath string
|
||||
imgTypeStr := args[0]
|
||||
if len(args) > 1 {
|
||||
blueprintPath = args[1]
|
||||
blueprintPath, err := cmd.Flags().GetString("blueprint")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
imgTypeStr := args[0]
|
||||
|
||||
bp, err := blueprintload.Load(blueprintPath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
distroStr, err = findDistro(distroStr, bp.Distro)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
@ -176,6 +179,7 @@ operating sytsems like centos and RHEL with easy customizations support.`,
|
|||
Args: cobra.RangeArgs(1, 2),
|
||||
Hidden: true,
|
||||
}
|
||||
manifestCmd.Flags().String("blueprint", "", `blueprint to customize an image`)
|
||||
manifestCmd.Flags().String("arch", "", `build manifest for a different architecture`)
|
||||
manifestCmd.Flags().String("distro", "", `build manifest for a different distroname (e.g. centos-9)`)
|
||||
manifestCmd.Flags().String("ostree-ref", "", `OSTREE reference`)
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package main_test
|
|||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
|
|
@ -166,7 +167,7 @@ func TestManifestIntegrationSmoke(t *testing.T) {
|
|||
"qcow2",
|
||||
"--arch=x86_64",
|
||||
"--distro=centos-9",
|
||||
makeTestBlueprint(t, testBlueprint),
|
||||
fmt.Sprintf("--blueprint=%s", makeTestBlueprint(t, testBlueprint)),
|
||||
})
|
||||
defer restore()
|
||||
|
||||
|
|
@ -318,7 +319,7 @@ func TestBuildIntegrationHappy(t *testing.T) {
|
|||
restore = main.MockOsArgs([]string{
|
||||
"build",
|
||||
"qcow2",
|
||||
makeTestBlueprint(t, testBlueprint),
|
||||
fmt.Sprintf("--blueprint=%s", makeTestBlueprint(t, testBlueprint)),
|
||||
"--distro", "centos-9",
|
||||
"--store", tmpdir,
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue