github.com/wallyworld/juju@v0.0.0-20161013125918-6cf1bc9d917a/provider/joyent/userdata.go (about)

     1  // Copyright 2015 Canonical Ltd.
     2  // Copyright 2015 Cloudbase Solutions SRL
     3  // Licensed under the AGPLv3, see LICENCE file for details.
     4  
     5  package joyent
     6  
     7  import (
     8  	"github.com/juju/errors"
     9  	jujuos "github.com/juju/utils/os"
    10  
    11  	"github.com/juju/juju/cloudconfig/cloudinit"
    12  	"github.com/juju/juju/cloudconfig/providerinit/renderers"
    13  )
    14  
    15  type JoyentRenderer struct{}
    16  
    17  func (JoyentRenderer) Render(cfg cloudinit.CloudConfig, os jujuos.OSType) ([]byte, error) {
    18  	switch os {
    19  	case jujuos.Ubuntu, jujuos.CentOS:
    20  		return renderers.RenderYAML(cfg)
    21  	default:
    22  		return nil, errors.Errorf("Cannot encode userdata for OS: %s", os.String())
    23  	}
    24  }