This repository has been archived by the owner on Sep 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #60 from digitalrebar/metasetter
Meta Data Setting Stage, Task, Params and Template
- Loading branch information
Showing
6 changed files
with
71 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Description: The color for machines icon | ||
Meta: | ||
color: blue | ||
icon: info | ||
title: RackN Content | ||
Name: machine-meta/color | ||
Schema: | ||
type: string |
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,8 @@ | ||
Description: The icon for machines icon | ||
Meta: | ||
color: blue | ||
icon: info | ||
title: RackN Content | ||
Name: machine-meta/icon | ||
Schema: | ||
type: string |
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,10 @@ | ||
Description: Stage to assign the machine icon and color | ||
Meta: | ||
color: yellow | ||
icon: info | ||
Name: machine-meta | ||
Reboot: false | ||
RunnerWait: true | ||
Tasks: | ||
- machine-meta-setter | ||
|
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,14 @@ | ||
Description: A task to set the color and icon for a machine | ||
Meta: | ||
color: blue | ||
icon: info | ||
Name: machine-meta-setter | ||
OptionalParams: | ||
- "machine-meta/color" | ||
- "machine-meta/icon" | ||
Templates: | ||
- Contents: "" | ||
ID: machine-meta-setter.sh.tmpl | ||
Name: "Set Icons" | ||
Path: "" | ||
|
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,29 @@ | ||
#!/usr/bin/env bash | ||
# Set the Machine Meta: Icon and Color | ||
|
||
set -e | ||
|
||
export RS_UUID="{{.Machine.UUID}}" | ||
|
||
{{template "setup.tmpl" .}} | ||
|
||
{{if .ParamExists "machine-meta/color" -}} | ||
COLOR={{.Param "machine-meta/color"}} | ||
{{else -}} | ||
COLOR="black" | ||
{{end -}} | ||
|
||
{{if .ParamExists "machine-meta/icon" -}} | ||
ICON={{.Param "machine-meta/icon"}} | ||
{{else -}} | ||
ICON="server" | ||
{{end -}} | ||
|
||
echo "Setting the Color to $COLOR and Icon to $ICON" | ||
|
||
# do work! | ||
drpcli machines update $RS_UUID "{\"Meta\":{\"color\":\"$COLOR\", \"icon\": \"$ICON\"}}" | jq .Meta | ||
|
||
echo "Finished successfully" | ||
exit 0 | ||
|
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