コード例 #1
0
ファイル: interface.go プロジェクト: Pankov404/juju
// New returns a new Config with no options set.
func New(series string) (CloudConfig, error) {
	os, err := version.GetOSFromSeries(series)
	if err != nil {
		return nil, err
	}
	switch os {
	case version.Windows:
		renderer, _ := shell.NewRenderer("powershell")
		return &windowsCloudConfig{
			&cloudConfig{
				series:   series,
				renderer: renderer,
				attrs:    make(map[string]interface{}),
			},
		}, nil
	case version.Ubuntu:
		renderer, _ := shell.NewRenderer("bash")
		return &ubuntuCloudConfig{
			&cloudConfig{
				series:    series,
				paccmder:  commands.NewAptPackageCommander(),
				pacconfer: config.NewAptPackagingConfigurer(series),
				renderer:  renderer,
				attrs:     make(map[string]interface{}),
			},
		}, nil
	case version.CentOS:
		renderer, _ := shell.NewRenderer("bash")
		return &centOSCloudConfig{
			&cloudConfig{
				series:    series,
				paccmder:  commands.NewYumPackageCommander(),
				pacconfer: config.NewYumPackagingConfigurer(series),
				renderer:  renderer,
				attrs:     make(map[string]interface{}),
			},
		}, nil
	default:
		return nil, errors.NotFoundf("cloudconfig for series %q", series)
	}
}
コード例 #2
0
ファイル: interface_test.go プロジェクト: sinzui/utils
// Copyright 2015 Canonical Ltd.
// Copyright 2015 Cloudbase Solutions SRL
// Licensed under the AGPLv3, see LICENCE file for details.

package config_test

import (
	"github.com/juju/utils/packaging/config"
)

var _ config.PackagingConfigurer = config.NewAptPackagingConfigurer("some-series")
var _ config.PackagingConfigurer = config.NewYumPackagingConfigurer("some-series")
コード例 #3
0
ファイル: yum_test.go プロジェクト: rogpeppe/juju-utils
func (s *YumSuite) SetUpSuite(c *gc.C) {
	s.pacconfer = config.NewYumPackagingConfigurer(testedSeriesCentOS)
}