// Create implements ProjectFactory.Create using docker client. func (p *ProjectFactory) Create(c *cli.Context) (*project.Project, error) { context := &docker.Context{} context.LoggerFactory = logger.NewColorLoggerFactory() Populate(context, c) command.Populate(&context.Context, c) return docker.NewProject(context) }
func (p *ProjectFactory) Create(c *cli.Context) (*project.Project, error) { context := &rancher.Context{ RancherComposeFile: c.GlobalString("rancher-file"), Url: c.GlobalString("url"), AccessKey: c.GlobalString("access-key"), SecretKey: c.GlobalString("secret-key"), Uploader: &rancher.S3Uploader{}, } command.Populate(&context.Context, c) return rancher.NewProject(context) }
func (p *ProjectFactory) Create(c *cli.Context) (project.APIProject, error) { rancherComposeFile, err := rancher.ResolveRancherCompose(c.GlobalString("file"), c.GlobalString("rancher-file")) if err != nil { return nil, err } qLookup, err := rLookup.NewQuestionLookup(rancherComposeFile, &lookup.OsEnvLookup{}) if err != nil { return nil, err } envLookup, err := rLookup.NewFileEnvLookup(c.GlobalString("env-file"), qLookup) if err != nil { return nil, err } context := &rancher.Context{ Context: project.Context{ ResourceLookup: &rLookup.FileResourceLookup{}, EnvironmentLookup: envLookup, LoggerFactory: logger.NewColorLoggerFactory(), }, RancherComposeFile: c.GlobalString("rancher-file"), Url: c.GlobalString("url"), AccessKey: c.GlobalString("access-key"), SecretKey: c.GlobalString("secret-key"), PullCached: c.Bool("cached"), Uploader: &rancher.S3Uploader{}, Args: c.Args(), BindingsFile: c.GlobalString("bindings-file"), } qLookup.Context = context command.Populate(&context.Context, c) context.Upgrade = c.Bool("upgrade") || c.Bool("force-upgrade") context.ForceUpgrade = c.Bool("force-upgrade") context.Rollback = c.Bool("rollback") context.BatchSize = int64(c.Int("batch-size")) context.Interval = int64(c.Int("interval")) context.ConfirmUpgrade = c.Bool("confirm-upgrade") context.Pull = c.Bool("pull") return rancher.NewProject(context) }
// Populate updates the specified docker context based on command line arguments and subcommands. func Populate(context *docker.Context, c *cli.Context) { command.Populate(&context.Context, c) context.ConfigDir = c.String("configdir") opts := client.Options{} opts.TLS = c.GlobalBool("tls") opts.TLSVerify = c.GlobalBool("tlsverify") opts.TLSOptions.CAFile = c.GlobalString("tlscacert") opts.TLSOptions.CertFile = c.GlobalString("tlscert") opts.TLSOptions.KeyFile = c.GlobalString("tlskey") clientFactory, err := client.NewDefaultFactory(opts) if err != nil { logrus.Fatalf("Failed to construct Docker client: %v", err) } context.ClientFactory = clientFactory }