Beispiel #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)
	}
}
Beispiel #2
0
// 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")
Beispiel #3
0
func (s *AptSuite) SetUpSuite(c *gc.C) {
	s.pacconfer = config.NewAptPackagingConfigurer(testedSeriesUbuntu)
}