本文整理汇总了Golang中github.com/openshift/origin/pkg/cmd/util.ParseEnvironmentArguments函数的典型用法代码示例。如果您正苦于以下问题:Golang ParseEnvironmentArguments函数的具体用法?Golang ParseEnvironmentArguments怎么用?Golang ParseEnvironmentArguments使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ParseEnvironmentArguments函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: validate
// validate converts all of the arguments on the config into references to objects, or returns an error
func (c *AppConfig) validate() (app.ComponentReferences, app.SourceRepositories, cmdutil.Environment, cmdutil.Environment, error) {
b := c.refBuilder
c.addReferenceBuilderComponents(b)
b.AddGroups(c.Groups)
refs, repos, errs := b.Result()
if len(repos) > 0 {
repos[0].SetContextDir(c.ContextDir)
if len(repos) > 1 {
glog.Warningf("You have specified more than one source repository and a context directory. "+
"The context directory will be applied to the first repository: %q", repos[0])
}
}
if len(c.Strategy) != 0 && len(repos) == 0 {
errs = append(errs, fmt.Errorf("when --strategy is specified you must provide at least one source code location"))
}
env, duplicateEnv, envErrs := cmdutil.ParseEnvironmentArguments(c.Environment)
for _, s := range duplicateEnv {
glog.V(1).Infof("The environment variable %q was overwritten", s)
}
errs = append(errs, envErrs...)
parms, duplicateParms, parmsErrs := cmdutil.ParseEnvironmentArguments(c.TemplateParameters)
for _, s := range duplicateParms {
glog.V(1).Infof("The template parameter %q was overwritten", s)
}
errs = append(errs, parmsErrs...)
return refs, repos, env, parms, errors.NewAggregate(errs)
}
开发者ID:nitintutlani,项目名称:origin,代码行数:33,代码来源:newapp.go
示例2: validate
// validate converts all of the arguments on the config into references to objects, or returns an error
func (c *AppConfig) validate() (app.ComponentReferences, app.SourceRepositories, cmdutil.Environment, cmdutil.Environment, error) {
b := c.refBuilder
c.addReferenceBuilderComponents(b)
b.AddGroups(c.Groups)
refs, repos, errs := b.Result()
if len(c.Strategy) != 0 && len(repos) == 0 {
errs = append(errs, fmt.Errorf("when --strategy is specified you must provide at least one source code location"))
}
if c.BinaryBuild && (len(repos) > 0 || refs.HasSource()) {
errs = append(errs, fmt.Errorf("specifying binary builds and source repositories at the same time is not allowed"))
}
env, duplicateEnv, envErrs := cmdutil.ParseEnvironmentArguments(c.Environment)
for _, s := range duplicateEnv {
glog.V(1).Infof("The environment variable %q was overwritten", s)
}
errs = append(errs, envErrs...)
parms, duplicateParms, parmsErrs := cmdutil.ParseEnvironmentArguments(c.TemplateParameters)
for _, s := range duplicateParms {
glog.V(1).Infof("The template parameter %q was overwritten", s)
}
errs = append(errs, parmsErrs...)
return refs, repos, env, parms, errors.NewAggregate(errs)
}
开发者ID:arielcarrera,项目名称:origin,代码行数:29,代码来源:newapp.go
示例3: validate
// validate converts all of the arguments on the config into references to objects, or returns an error
func (c *AppConfig) validate() (app.ComponentReferences, app.SourceRepositories, cmdutil.Environment, cmdutil.Environment, error) {
b := c.refBuilder
b.AddComponents(c.DockerImages, func(input *app.ComponentInput) app.ComponentReference {
input.Argument = fmt.Sprintf("--docker-image=%q", input.From)
input.Resolver = c.dockerResolver
return input
})
b.AddComponents(c.ImageStreams, func(input *app.ComponentInput) app.ComponentReference {
input.Argument = fmt.Sprintf("--image=%q", input.From)
input.Resolver = c.imageStreamResolver
return input
})
b.AddComponents(c.Templates, func(input *app.ComponentInput) app.ComponentReference {
input.Argument = fmt.Sprintf("--template=%q", input.From)
input.Resolver = c.templateResolver
return input
})
b.AddComponents(c.TemplateFiles, func(input *app.ComponentInput) app.ComponentReference {
input.Argument = fmt.Sprintf("--file=%q", input.From)
input.Resolver = c.templateFileResolver
return input
})
b.AddComponents(c.Components, func(input *app.ComponentInput) app.ComponentReference {
input.Resolver = app.PerfectMatchWeightedResolver{
app.WeightedResolver{Resolver: c.imageStreamResolver, Weight: 0.0},
app.WeightedResolver{Resolver: c.templateResolver, Weight: 0.0},
app.WeightedResolver{Resolver: c.templateFileResolver, Weight: 0.0},
app.WeightedResolver{Resolver: c.dockerResolver, Weight: 2.0},
}
return input
})
b.AddGroups(c.Groups)
refs, repos, errs := b.Result()
if len(repos) > 0 {
repos[0].SetContextDir(c.ContextDir)
if len(repos) > 1 {
glog.Warningf("You have specified more than one source repository and a context directory. "+
"The context directory will be applied to the first repository: %q", repos[0])
}
}
if len(c.Strategy) != 0 && len(repos) == 0 {
errs = append(errs, fmt.Errorf("when --strategy is specified you must provide at least one source code location"))
}
env, duplicateEnv, envErrs := cmdutil.ParseEnvironmentArguments(c.Environment)
for _, s := range duplicateEnv {
glog.V(1).Infof("The environment variable %q was overwritten", s)
}
errs = append(errs, envErrs...)
parms, duplicateParms, parmsErrs := cmdutil.ParseEnvironmentArguments(c.TemplateParameters)
for _, s := range duplicateParms {
glog.V(1).Infof("The template parameter %q was overwritten", s)
}
errs = append(errs, parmsErrs...)
return refs, repos, env, parms, errors.NewAggregate(errs)
}
开发者ID:mignev,项目名称:origin,代码行数:61,代码来源:newapp.go
示例4: Complete
func (o *DockerbuildOptions) Complete(f *clientcmd.Factory, cmd *cobra.Command, args []string) error {
paths, envArgs, ok := cmdutil.SplitEnvironmentFromResources(args)
if !ok {
return kcmdutil.UsageError(cmd, "context directory must be specified before environment changes: %s", strings.Join(args, " "))
}
if len(paths) != 2 {
return kcmdutil.UsageError(cmd, "the directory to build and tag must be specified")
}
o.Arguments, _, _ = cmdutil.ParseEnvironmentArguments(envArgs)
o.Directory = paths[0]
o.Tag = paths[1]
if len(o.DockerfilePath) == 0 {
o.DockerfilePath = filepath.Join(o.Directory, "Dockerfile")
}
var mounts []dockerbuilder.Mount
for _, s := range o.MountSpecs {
segments := strings.Split(s, ":")
if len(segments) != 2 {
return kcmdutil.UsageError(cmd, "--mount must be of the form SOURCE:DEST")
}
mounts = append(mounts, dockerbuilder.Mount{SourcePath: segments[0], DestinationPath: segments[1]})
}
o.Mounts = mounts
client, err := docker.NewClientFromEnv()
if err != nil {
return err
}
o.Client = client
o.Keyring = credentialprovider.NewDockerKeyring()
return nil
}
开发者ID:abhgupta,项目名称:origin,代码行数:35,代码来源:dockerbuild.go
示例5: validate
func (c *AppConfig) validate() (cmdutil.Environment, cmdutil.Environment, error) {
var errs []error
env, duplicateEnv, envErrs := cmdutil.ParseEnvironmentArguments(c.Environment)
for _, s := range duplicateEnv {
fmt.Fprintf(c.ErrOut, "warning: The environment variable %q was overwritten", s)
}
errs = append(errs, envErrs...)
params, duplicateParams, paramsErrs := cmdutil.ParseEnvironmentArguments(c.TemplateParameters)
for _, s := range duplicateParams {
fmt.Fprintf(c.ErrOut, "warning: The template parameter %q was overwritten", s)
}
errs = append(errs, paramsErrs...)
return env, params, kutilerrors.NewAggregate(errs)
}
开发者ID:nak3,项目名称:origin,代码行数:17,代码来源:newapp.go
示例6: Complete
func (o *DockerbuildOptions) Complete(f *clientcmd.Factory, cmd *cobra.Command, args []string) error {
paths, envArgs, ok := cmdutil.SplitEnvironmentFromResources(args)
if !ok {
return kcmdutil.UsageError(cmd, "context directory must be specified before environment changes: %s", strings.Join(args, " "))
}
if len(paths) != 2 {
return kcmdutil.UsageError(cmd, "the directory to build and tag must be specified")
}
o.Arguments, _, _ = cmdutil.ParseEnvironmentArguments(envArgs)
o.Directory = paths[0]
o.Tag = paths[1]
if len(o.DockerfilePath) == 0 {
o.DockerfilePath = filepath.Join(o.Directory, "Dockerfile")
}
client, err := docker.NewClientFromEnv()
if err != nil {
return err
}
o.Client = client
o.Keyring = credentialprovider.NewDockerKeyring()
return nil
}
开发者ID:legionus,项目名称:origin,代码行数:24,代码来源:dockerbuild.go
注:本文中的github.com/openshift/origin/pkg/cmd/util.ParseEnvironmentArguments函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论