forked from juju/juju
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
01d1ada
commit 96429c2
Showing
84 changed files
with
1,317 additions
and
1,217 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package cloudinit | ||
|
||
import ( | ||
"github.com/juju/errors" | ||
|
||
"github.com/juju/juju/version" | ||
) | ||
|
||
type Renderer interface { | ||
|
||
// Mkdir returns an OS specific script for creating a directory | ||
Mkdir(path string) []string | ||
|
||
// WriteFile returns a command to write data | ||
WriteFile(filename string, contents string, permission int) []string | ||
|
||
// Render renders the userdata script for a particular OS type | ||
Render(conf *Config) ([]byte, error) | ||
|
||
// FromSlash returns the result of replacing each slash ('/') character | ||
// in path with a separator character. Multiple slashes are replaced by | ||
// multiple separators. | ||
|
||
FromSlash(path string) string | ||
// PathJoin will join a path using OS specific path separator. | ||
// This works for selected OS instead of current OS | ||
|
||
PathJoin(path ...string) string | ||
} | ||
|
||
// NewRenderer returns a Renderer interface for selected series | ||
func NewRenderer(series string) (Renderer, error) { | ||
operatingSystem, err := version.GetOSFromSeries(series) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
switch operatingSystem { | ||
case version.Windows: | ||
return &WindowsRenderer{}, nil | ||
case version.Ubuntu: | ||
return &UbuntuRenderer{}, nil | ||
default: | ||
return nil, errors.Errorf("No renderer could be found for %s", series) | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.