diff options
-rw-r--r-- | libvirt/cloudinit_def.go | 8 | ||||
-rw-r--r-- | libvirt/cloudinit_def_test.go | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/libvirt/cloudinit_def.go b/libvirt/cloudinit_def.go index f681488b..a159d759 100644 --- a/libvirt/cloudinit_def.go +++ b/libvirt/cloudinit_def.go @@ -23,7 +23,7 @@ import ( const USERDATA string = "user-data" const METADATA string = "meta-data" -type UserDataStruct struct { +type CloudInitUserData struct { SSHAuthorizedKeys []string `yaml:"ssh_authorized_keys"` } @@ -35,7 +35,7 @@ type defCloudInit struct { InstanceID string `yaml:"instance-id"` } UserDataRaw string `yaml:"user_data"` - UserData UserDataStruct + UserData CloudInitUserData } // Creates a new cloudinit with the defaults @@ -335,7 +335,7 @@ func downloadISO(virConn *libvirt.VirConnection, volume libvirt.VirStorageVol) ( } // Convert a UserData instance to a map with string as key and interface as value -func convertUserDataToMap(data UserDataStruct) (map[string]interface{}, error) { +func convertUserDataToMap(data CloudInitUserData) (map[string]interface{}, error) { userDataMap := make(map[string]interface{}) // This is required to get the right names expected by cloud-init @@ -349,7 +349,7 @@ func convertUserDataToMap(data UserDataStruct) (map[string]interface{}, error) { return userDataMap, err } -func mergeUserDataIntoUserDataRaw(userData UserDataStruct, userDataRaw string) (string, error) { +func mergeUserDataIntoUserDataRaw(userData CloudInitUserData, userDataRaw string) (string, error) { userDataMap, err := convertUserDataToMap(userData) if err != nil { return "", err diff --git a/libvirt/cloudinit_def_test.go b/libvirt/cloudinit_def_test.go index 2472e019..30dfb2f3 100644 --- a/libvirt/cloudinit_def_test.go +++ b/libvirt/cloudinit_def_test.go @@ -69,7 +69,7 @@ func TestCreateISONoExteralTool(t *testing.T) { } func TestConvertUserDataToMapPreservesCloudInitNames(t *testing.T) { - ud := UserDataStruct{ + ud := CloudInitUserData{ SSHAuthorizedKeys: []string{"key1"}, } @@ -85,7 +85,7 @@ func TestConvertUserDataToMapPreservesCloudInitNames(t *testing.T) { } func TestMergeEmptyUserDataIntoUserDataRaw(t *testing.T) { - ud := UserDataStruct{} + ud := CloudInitUserData{} var userDataRaw = ` new-key: new-value-set-by-extra @@ -114,7 +114,7 @@ ssh_authorized_keys: } func TestMergeUserDataIntoEmptyUserDataRaw(t *testing.T) { - ud := UserDataStruct{ + ud := CloudInitUserData{ SSHAuthorizedKeys: []string{"key1"}, } var userDataRaw string @@ -137,7 +137,7 @@ func TestMergeUserDataIntoEmptyUserDataRaw(t *testing.T) { func TestMergeUserDataIntoUserDataRawGivesPrecedenceToRawData(t *testing.T) { ud_key := "user-data-key" - ud := UserDataStruct{ + ud := CloudInitUserData{ SSHAuthorizedKeys: []string{ud_key}, } |