github.com/Pankov404/juju@v0.0.0-20150703034450-be266991dceb/provider/local/utils.go (about) 1 // Copyright 2013 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package local 5 6 import ( 7 "github.com/juju/utils/packaging/manager" 8 "github.com/juju/utils/proxy" 9 10 "github.com/juju/juju/version" 11 ) 12 13 // isPackageInstalled is a helper function which instantiates a new 14 // PackageManager for the current system and checks whether the given package is 15 // installed. 16 var isPackageInstalled = func(pack string) bool { 17 // We know that there exists a package manager for this OS as the agent has 18 // been bootstrapped. 19 pacman, _ := manager.NewPackageManager(version.Current.Series) 20 return pacman.IsInstalled(pack) 21 } 22 23 // detectPackageProxies is a helper function which instantiates a new 24 // PackageManager for the current system and checks for package manager proxy 25 // settings. 26 var detectPackageProxies = func() (proxy.Settings, error) { 27 pacman, err := manager.NewPackageManager(version.Current.Series) 28 if err != nil { 29 return proxy.Settings{}, err 30 } 31 return pacman.GetProxySettings() 32 }