~juju-qa/ubuntu/xenial/juju/xenial-2.0-beta3

« back to all changes in this revision

Viewing changes to src/github.com/juju/juju/cloudconfig/cloudinit/utils.go

  • Committer: Martin Packman
  • Date: 2016-03-30 19:31:08 UTC
  • mfrom: (1.1.41)
  • Revision ID: martin.packman@canonical.com-20160330193108-h9iz3ak334uk0z5r
Merge new upstream source 2.0~beta3

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
        return cmds
34
34
}
35
35
 
36
 
// addPackagePreferencesCmds is a helper function which returns the bootcmds
37
 
// which set the given PackagePreferences.
38
 
func addPackagePreferencesCmds(cfg CloudConfig, prefs []packaging.PackagePreferences) []string {
39
 
        cmds := []string{}
40
 
        for _, pref := range prefs {
41
 
                prefFile, _ := cfg.getPackagingConfigurer().RenderPreferences(pref)
42
 
                data := []byte(prefFile)
43
 
                cmds = append(cmds, addFileCmds(pref.Path, data, 0644, false)...)
44
 
        }
45
 
 
46
 
        return cmds
47
 
}
48
 
 
49
36
// addFile is a helper function returns all the required shell commands to write
50
37
// a file (be it text or binary) with regards to the given parameters
51
38
// NOTE: if the file already exists, it will be overwritten.