Exemplo n.º 1
0
// ensureDependencies creates a set of install packages using AptGetPreparePackages
// and runs each set of packages through AptGetInstall
func ensureDependencies(series string) error {
	var err error
	aptGetInstallCommandList := apt.GetPreparePackages(requiredPackages, series)
	for _, commands := range aptGetInstallCommandList {
		err = apt.GetInstall(commands...)
		if err != nil {
			return err
		}
	}
	return err
}
Exemplo n.º 2
0
func (s *AptSuite) TestOnePackage(c *gc.C) {
	cmdChan := s.HookCommandOutput(&apt.CommandOutput, []byte{}, nil)
	err := apt.GetInstall("test-package")
	c.Assert(err, gc.IsNil)
	cmd := <-cmdChan
	c.Assert(cmd.Args, gc.DeepEquals, []string{
		"apt-get", "--option=Dpkg::Options::=--force-confold",
		"--option=Dpkg::options::=--force-unsafe-io", "--assume-yes", "--quiet",
		"install", "test-package",
	})
	c.Assert(cmd.Env[len(cmd.Env)-1], gc.Equals, "DEBIAN_FRONTEND=noninteractive")
}
Exemplo n.º 3
0
func (s *AptSuite) TestAptGetError(c *gc.C) {
	const expected = `E: frobnicator failure detected`
	cmdError := fmt.Errorf("error")
	cmdExpectedError := fmt.Errorf("apt-get failed: error")
	cmdChan := s.HookCommandOutput(&apt.CommandOutput, []byte(expected), cmdError)
	err := apt.GetInstall("foo")
	c.Assert(err, gc.DeepEquals, cmdExpectedError)
	cmd := <-cmdChan
	c.Assert(cmd.Args, gc.DeepEquals, []string{
		"apt-get", "--option=Dpkg::Options::=--force-confold",
		"--option=Dpkg::options::=--force-unsafe-io", "--assume-yes", "--quiet",
		"install", "foo",
	})
}
Exemplo n.º 4
0
func ensureDependencies() error {
	return apt.GetInstall(requiredPackages...)
}