Exemple #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)
	}
}
Exemple #2
0
func (s *AptSuite) SetUpSuite(c *gc.C) {
	s.paccmder = commands.NewAptPackageCommander()
}
Exemple #3
0
func (s *AptSuite) SetUpSuite(c *gc.C) {
	s.IsolationSuite.SetUpSuite(c)
	s.paccmder = commands.NewAptPackageCommander()
	s.pacman = manager.NewAptPackageManager()
}
Exemple #4
0
func (s *ManagerSuite) SetUpTest(c *gc.C) {
	s.IsolationSuite.SetUpTest(c)
}

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.
Exemple #5
0
// NewAptPackageManager returns a PackageManager for apt-based systems.
func NewAptPackageManager() PackageManager {
	return &apt{basePackageManager{commands.NewAptPackageCommander()}}
}