aboutsummaryrefslogtreecommitdiff
path: root/libvirt
diff options
context:
space:
mode:
authorDario Maiocchi <dmaiocchi@suse.com>2017-11-09 22:18:58 +0100
committerDario Maiocchi <dmaiocchi@suse.com>2017-11-16 11:26:28 +0100
commitb79acdd0924791aa424e37497128619a0f481f05 (patch)
tree6c9a70640be060be2c3354cd0c7afd3da875bcf1 /libvirt
parent3d306829f3b1ce9d598222a0bc1fecb05e0c39ef (diff)
downloadterraform-provider-libvirt-b79acdd0924791aa424e37497128619a0f481f05.tar
terraform-provider-libvirt-b79acdd0924791aa424e37497128619a0f481f05.tar.gz
don't use underscores in Go names
Diffstat (limited to 'libvirt')
-rw-r--r--libvirt/cloudinit_def_test.go4
-rw-r--r--libvirt/coreos_ignition_def.go2
-rw-r--r--libvirt/resource_libvirt_domain.go50
-rw-r--r--libvirt/resource_libvirt_network.go4
-rw-r--r--libvirt/resource_libvirt_volume_test.go12
-rw-r--r--libvirt/utils_test.go16
6 files changed, 44 insertions, 44 deletions
diff --git a/libvirt/cloudinit_def_test.go b/libvirt/cloudinit_def_test.go
index 30dfb2f3..9461fb1b 100644
--- a/libvirt/cloudinit_def_test.go
+++ b/libvirt/cloudinit_def_test.go
@@ -136,9 +136,9 @@ func TestMergeUserDataIntoEmptyUserDataRaw(t *testing.T) {
}
func TestMergeUserDataIntoUserDataRawGivesPrecedenceToRawData(t *testing.T) {
- ud_key := "user-data-key"
+ udKey := "user-data-key"
ud := CloudInitUserData{
- SSHAuthorizedKeys: []string{ud_key},
+ SSHAuthorizedKeys: []string{udKey},
}
var userDataRaw = `
diff --git a/libvirt/coreos_ignition_def.go b/libvirt/coreos_ignition_def.go
index 084979fc..60acc107 100644
--- a/libvirt/coreos_ignition_def.go
+++ b/libvirt/coreos_ignition_def.go
@@ -131,7 +131,7 @@ func (ign *defIgnition) createFile() (string, error) {
file = true
if _, err := os.Stat(ign.Content); err != nil {
var js map[string]interface{}
- if err_conf := json.Unmarshal([]byte(ign.Content), &js); err_conf != nil {
+ if errConf := json.Unmarshal([]byte(ign.Content), &js); errConf != nil {
return "", fmt.Errorf("coreos_ignition 'content' is neither a file "+
"nor a valid json object %s", ign.Content)
}
diff --git a/libvirt/resource_libvirt_domain.go b/libvirt/resource_libvirt_domain.go
index fadc62a6..40bed468 100644
--- a/libvirt/resource_libvirt_domain.go
+++ b/libvirt/resource_libvirt_domain.go
@@ -224,17 +224,17 @@ func resourceLibvirtDomainCreate(d *schema.ResourceData, meta interface{}) error
}
if ignition, ok := d.GetOk("coreos_ignition"); ok {
- //var fw_cfg []defCmd
- var fw_cfg []libvirtxml.DomainQEMUCommandlineArg
+ //var fwCfg []defCmd
+ var fwCfg []libvirtxml.DomainQEMUCommandlineArg
ignitionKey, err := getIgnitionVolumeKeyFromTerraformID(ignition.(string))
if err != nil {
return err
}
- ign_str := fmt.Sprintf("name=opt/com.coreos/config,file=%s", ignitionKey)
- fw_cfg = append(fw_cfg, libvirtxml.DomainQEMUCommandlineArg{"-fw_cfg"})
- fw_cfg = append(fw_cfg, libvirtxml.DomainQEMUCommandlineArg{ign_str})
+ ignStr := fmt.Sprintf("name=opt/com.coreos/config,file=%s", ignitionKey)
+ fwCfg = append(fwCfg, libvirtxml.DomainQEMUCommandlineArg{"-fw_cfg"})
+ fwCfg = append(fwCfg, libvirtxml.DomainQEMUCommandlineArg{ignStr})
QemuCmdline := &libvirtxml.DomainQEMUCommandline{
- Args: fw_cfg,
+ Args: fwCfg,
}
domainDef.QEMUCommandline = QemuCmdline
}
@@ -248,20 +248,20 @@ func resourceLibvirtDomainCreate(d *schema.ResourceData, meta interface{}) error
domainDef.Devices.Graphics = nil
} else {
if graphics, ok := d.GetOk("graphics"); ok {
- graphics_map := graphics.(map[string]interface{})
+ graphicsMap := graphics.(map[string]interface{})
domainDef.Devices.Graphics = []libvirtxml.DomainGraphic{
libvirtxml.DomainGraphic{},
}
- if graphics_type, ok := graphics_map["type"]; ok {
- domainDef.Devices.Graphics[0].Type = graphics_type.(string)
+ if graphicsType, ok := graphicsMap["type"]; ok {
+ domainDef.Devices.Graphics[0].Type = graphicsType.(string)
}
- if autoport, ok := graphics_map["autoport"]; ok {
+ if autoport, ok := graphicsMap["autoport"]; ok {
domainDef.Devices.Graphics[0].AutoPort = autoport.(string)
}
- if listen_type, ok := graphics_map["listen_type"]; ok {
+ if listenType, ok := graphicsMap["listen_type"]; ok {
domainDef.Devices.Graphics[0].Listeners = []libvirtxml.DomainGraphicListener{
libvirtxml.DomainGraphicListener{
- Type: listen_type.(string),
+ Type: listenType.(string),
},
}
}
@@ -269,10 +269,10 @@ func resourceLibvirtDomainCreate(d *schema.ResourceData, meta interface{}) error
}
if cpu, ok := d.GetOk("cpu"); ok {
- cpu_map := cpu.(map[string]interface{})
- if cpu_mode, ok := cpu_map["mode"]; ok {
+ cpuMap := cpu.(map[string]interface{})
+ if cpuMode, ok := cpuMap["mode"]; ok {
domainDef.CPU = &libvirtxml.DomainCPU{
- Mode: cpu_mode.(string),
+ Mode: cpuMode.(string),
}
}
}
@@ -294,15 +294,15 @@ func resourceLibvirtDomainCreate(d *schema.ResourceData, meta interface{}) error
}
if nvram, ok := d.GetOk("nvram"); ok {
- nvram_map := nvram.(map[string]interface{})
+ nvramMap := nvram.(map[string]interface{})
- nvramFile := nvram_map["file"].(string)
+ nvramFile := nvramMap["file"].(string)
if _, err := os.Stat(nvramFile); os.IsNotExist(err) {
return fmt.Errorf("Could not find nvram file '%s'.", nvramFile)
}
nvramTemplateFile := ""
- if nvram_template, ok := nvram_map["template"]; ok {
- nvramTemplateFile = nvram_template.(string)
+ if nvramTemplate, ok := nvramMap["template"]; ok {
+ nvramTemplateFile = nvramTemplate.(string)
if _, err := os.Stat(nvramTemplateFile); os.IsNotExist(err) {
return fmt.Errorf("Could not find nvram template file '%s'.", nvramTemplateFile)
}
@@ -319,8 +319,8 @@ func resourceLibvirtDomainCreate(d *schema.ResourceData, meta interface{}) error
bootDeviceCount := d.Get("boot_device.#").(int)
for i := 0; i < bootDeviceCount; i++ {
prefix := fmt.Sprintf("boot_device.%d", i)
- if boot_map, ok := d.GetOk(prefix + ".dev"); ok {
- for _, dev := range boot_map.([]interface{}) {
+ if bootMap, ok := d.GetOk(prefix + ".dev"); ok {
+ for _, dev := range bootMap.([]interface{}) {
bootDevice.Dev = dev.(string)
bootDevices = append(bootDevices, bootDevice)
}
@@ -347,16 +347,16 @@ func resourceLibvirtDomainCreate(d *schema.ResourceData, meta interface{}) error
Port: &consoleTargetPort,
}
}
- if source_path, ok := d.GetOk(consolePrefix + ".source_path"); ok {
+ if sourcePath, ok := d.GetOk(consolePrefix + ".source_path"); ok {
console.Source = &libvirtxml.DomainChardevSource{
- Path: source_path.(string),
+ Path: sourcePath.(string),
}
}
- if target_type, ok := d.GetOk(consolePrefix + ".target_type"); ok {
+ if targetType, ok := d.GetOk(consolePrefix + ".target_type"); ok {
if console.Target == nil {
console.Target = &libvirtxml.DomainConsoleTarget{}
}
- console.Target.Type = target_type.(string)
+ console.Target.Type = targetType.(string)
}
consoles = append(consoles, console)
}
diff --git a/libvirt/resource_libvirt_network.go b/libvirt/resource_libvirt_network.go
index da201634..f1cc46de 100644
--- a/libvirt/resource_libvirt_network.go
+++ b/libvirt/resource_libvirt_network.go
@@ -248,12 +248,12 @@ func resourceLibvirtNetworkCreate(d *schema.ResourceData, meta interface{}) erro
networkDef.IPs = ipsPtrsLst
}
- if dns_forward_count, ok := d.GetOk("dns_forwarder.#"); ok {
+ if dnsForwardCount, ok := d.GetOk("dns_forwarder.#"); ok {
dns := libvirtxml.NetworkDNS{
Forwarders: []libvirtxml.NetworkDNSForwarder{},
}
- for i := 0; i < dns_forward_count.(int); i++ {
+ for i := 0; i < dnsForwardCount.(int); i++ {
forward := libvirtxml.NetworkDNSForwarder{}
forwardPrefix := fmt.Sprintf("dns_forwarder.%d", i)
if address, ok := d.GetOk(forwardPrefix + ".address"); ok {
diff --git a/libvirt/resource_libvirt_volume_test.go b/libvirt/resource_libvirt_volume_test.go
index 95cabadb..107149df 100644
--- a/libvirt/resource_libvirt_volume_test.go
+++ b/libvirt/resource_libvirt_volume_test.go
@@ -84,7 +84,7 @@ func testAccCheckLibvirtVolumeDoesNotExists(n string, volume *libvirt.StorageVol
func TestAccLibvirtVolume_Basic(t *testing.T) {
var volume libvirt.StorageVol
- const testAccCheckLibvirtVolumeConfig_basic = `
+ const testAccCheckLibvirtVolumeConfigBasic = `
resource "libvirt_volume" "terraform-acceptance-test-1" {
name = "terraform-test"
size = 1073741824
@@ -96,7 +96,7 @@ func TestAccLibvirtVolume_Basic(t *testing.T) {
CheckDestroy: testAccCheckLibvirtVolumeDestroy,
Steps: []resource.TestStep{
resource.TestStep{
- Config: testAccCheckLibvirtVolumeConfig_basic,
+ Config: testAccCheckLibvirtVolumeConfigBasic,
Check: resource.ComposeTestCheckFunc(
testAccCheckLibvirtVolumeExists("libvirt_volume.terraform-acceptance-test-1", &volume),
resource.TestCheckResourceAttr(
@@ -124,12 +124,12 @@ func TestAccLibvirtVolume_DownloadFromSource(t *testing.T) {
t.Fatal(err)
}
- const testAccCheckLibvirtVolumeConfig_source = `
+ const testAccCheckLibvirtVolumeConfigSource = `
resource "libvirt_volume" "terraform-acceptance-test-2" {
name = "terraform-test"
source = "%s"
}`
- config := fmt.Sprintf(testAccCheckLibvirtVolumeConfig_source, url)
+ config := fmt.Sprintf(testAccCheckLibvirtVolumeConfigSource, url)
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
@@ -151,7 +151,7 @@ func TestAccLibvirtVolume_DownloadFromSource(t *testing.T) {
func TestAccLibvirtVolume_Format(t *testing.T) {
var volume libvirt.StorageVol
- const testAccCheckLibvirtVolumeConfig_format = `
+ const testAccCheckLibvirtVolumeConfigFormat = `
resource "libvirt_volume" "terraform-acceptance-test-3" {
name = "terraform-test"
format = "raw"
@@ -164,7 +164,7 @@ func TestAccLibvirtVolume_Format(t *testing.T) {
CheckDestroy: testAccCheckLibvirtVolumeDestroy,
Steps: []resource.TestStep{
resource.TestStep{
- Config: testAccCheckLibvirtVolumeConfig_format,
+ Config: testAccCheckLibvirtVolumeConfigFormat,
Check: resource.ComposeTestCheckFunc(
testAccCheckLibvirtVolumeExists("libvirt_volume.terraform-acceptance-test-3", &volume),
resource.TestCheckResourceAttr(
diff --git a/libvirt/utils_test.go b/libvirt/utils_test.go
index cdcf05b9..c702637e 100644
--- a/libvirt/utils_test.go
+++ b/libvirt/utils_test.go
@@ -36,11 +36,11 @@ func TestIPsRange(t *testing.T) {
}
func TestWaitForSuccessEverythingFine(t *testing.T) {
- wait_sleep := WAIT_SLEEP_INTERVAL
- wait_timeout := WAIT_TIMEOUT
+ waitSleep := WAIT_SLEEP_INTERVAL
+ waitTimeout := WAIT_TIMEOUT
defer func() {
- WAIT_SLEEP_INTERVAL = wait_sleep
- WAIT_TIMEOUT = wait_timeout
+ WAIT_SLEEP_INTERVAL = waitSleep
+ WAIT_TIMEOUT = waitTimeout
}()
WAIT_TIMEOUT = 1 * time.Second
@@ -58,11 +58,11 @@ func TestWaitForSuccessEverythingFine(t *testing.T) {
}
func TestWaitForSuccessBrokenFunction(t *testing.T) {
- wait_sleep := WAIT_SLEEP_INTERVAL
- wait_timeout := WAIT_TIMEOUT
+ waitSleep := WAIT_SLEEP_INTERVAL
+ waitTimeout := WAIT_TIMEOUT
defer func() {
- WAIT_SLEEP_INTERVAL = wait_sleep
- WAIT_TIMEOUT = wait_timeout
+ WAIT_SLEEP_INTERVAL = waitSleep
+ WAIT_TIMEOUT = waitTimeout
}()
WAIT_TIMEOUT = 1 * time.Second