示例#1
0
// 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
func (s *YumSuite) SetUpSuite(c *gc.C) {
	s.IsolationSuite.SetUpSuite(c)
	s.paccmder = commands.NewYumPackageCommander()
	s.pacman = manager.NewYumPackageManager()
}
示例#3
0
文件: yum_test.go 项目: juju/utils
func (s *YumSuite) SetUpSuite(c *gc.C) {
	s.paccmder = commands.NewYumPackageCommander()
}
示例#4
0
func (s *ManagerSuite) TearDownTest(c *gc.C) {
	s.IsolationSuite.TearDownTest(c)
}

func (s *ManagerSuite) TearDownSuite(c *gc.C) {
	s.IsolationSuite.TearDownSuite(c)
}

var (
	// aptCmder is the commands.PackageCommander for apt-based
	// systems whose commands will be checked against.
	aptCmder = commands.NewAptPackageCommander()

	// yumCmder is the commands.PackageCommander for yum-based
	// systems whose commands will be checked against.
	yumCmder = commands.NewYumPackageCommander()

	// testedPackageName is the package name used in all
	// single-package testing scenarios.
	testedPackageName = "test-package"

	// testedRepoName is the repository name used in all
	// repository-related tests.
	testedRepoName = "some-repo"

	// testedProxySettings is the set of proxy settings used in
	// all proxy-related tests.
	testedProxySettings = proxy.Settings{
		Http:  "http://some-proxy.domain",
		Https: "https://some-proxy.domain",
		Ftp:   "ftp://some-proxy.domain",
示例#5
0
文件: interface.go 项目: sinzui/utils
// NewYumPackageManager returns a PackageManager for yum-based systems.
func NewYumPackageManager() PackageManager {
	return &yum{basePackageManager{commands.NewYumPackageCommander()}}
}