This new flag allows to add a file with registration data. This
is meant to eventually hold all sort of registrations like
ansible or satelite but initially only contains the redhat
subscription. Currently only JSON is supported.
It looks like:
```json:
{
"redhat": {
"subscription": {
"activation_key": "ak_123",
"organization": "org_123",
"server_url": "server_url_123",
"base_url": "base_url_123",
"insights": true,
"rhc": true,
"proxy": "proxy_123"
}
}
}
```
This is not part of the blueprint (today) because its more
ephemeral than the things we usually put into the blueprint.
This allows us to build images that are immediately registered. It
also keeps our options open in the future. If we move to a new
blueprint format where we support multiple blueprints and also
ephemeral data like this the "registrations" flag just becomes an
alias for "--blueprint".
82 lines
1.8 KiB
Go
82 lines
1.8 KiB
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"io"
|
|
"os"
|
|
|
|
"github.com/osbuild/images/pkg/cloud"
|
|
"github.com/osbuild/images/pkg/cloud/awscloud"
|
|
"github.com/osbuild/images/pkg/manifestgen"
|
|
"github.com/osbuild/images/pkg/reporegistry"
|
|
)
|
|
|
|
var (
|
|
GetOneImage = getOneImage
|
|
Run = run
|
|
FindDistro = findDistro
|
|
DescribeImage = describeImage
|
|
ProgressFromCmd = progressFromCmd
|
|
BasenameFor = basenameFor
|
|
)
|
|
|
|
func MockOsArgs(new []string) (restore func()) {
|
|
saved := os.Args
|
|
os.Args = append([]string{"argv0"}, new...)
|
|
return func() {
|
|
os.Args = saved
|
|
}
|
|
}
|
|
|
|
func MockOsStdout(new io.Writer) (restore func()) {
|
|
saved := osStdout
|
|
osStdout = new
|
|
return func() {
|
|
osStdout = saved
|
|
}
|
|
}
|
|
|
|
func MockOsStderr(new io.Writer) (restore func()) {
|
|
saved := osStderr
|
|
osStderr = new
|
|
return func() {
|
|
osStderr = saved
|
|
}
|
|
}
|
|
|
|
func MockNewRepoRegistry(f func() (*reporegistry.RepoRegistry, error)) (restore func()) {
|
|
saved := newRepoRegistry
|
|
newRepoRegistry = func(dataDir string, extraRepos []string) (*reporegistry.RepoRegistry, error) {
|
|
if dataDir != "" {
|
|
panic(fmt.Sprintf("cannot use custom dataDir %v in mock", dataDir))
|
|
}
|
|
return f()
|
|
}
|
|
return func() {
|
|
newRepoRegistry = saved
|
|
}
|
|
}
|
|
|
|
func MockDistroGetHostDistroName(f func() (string, error)) (restore func()) {
|
|
saved := distroGetHostDistroName
|
|
distroGetHostDistroName = f
|
|
return func() {
|
|
distroGetHostDistroName = saved
|
|
}
|
|
}
|
|
|
|
func MockAwscloudNewUploader(f func(string, string, string, *awscloud.UploaderOptions) (cloud.Uploader, error)) (restore func()) {
|
|
saved := awscloudNewUploader
|
|
awscloudNewUploader = f
|
|
return func() {
|
|
awscloudNewUploader = saved
|
|
}
|
|
}
|
|
|
|
func MockManifestgenDepsolver(new manifestgen.DepsolveFunc) (restore func()) {
|
|
saved := manifestgenDepsolver
|
|
manifestgenDepsolver = new
|
|
return func() {
|
|
manifestgenDepsolver = saved
|
|
}
|
|
}
|