Terraform: provider/cobbler: 'repos' in cobbler_profile throw error

Created on 28 Feb 2017  ยท  6Comments  ยท  Source: hashicorp/terraform

Hi there,

As far as I can see this cobblerclient-related issue is likely to be for @jtopjian.
I want to specify repos inside a cobbler_profile but when used it fails with source data must be an array or slice, got string.
Somehow, afterwards the specified string IS SET in Cobbler --> Profile --> Profilename --> Repos.

Terraform Version

Terraform v0.8.7

Affected Resource(s)

  • Cobbler on CentOS Linux release 7.3.1611

    • cobbler-web-2.8.0-4.el7.noarch

    • cobbler-2.8.0-4.el7.x86_64

Terraform Configuration Files

Specific parts of the plan to be mentioned:

resource "cobbler_distro" "debian8-x86_64" {
  name       = "debian8-x86_64"
  breed      = "debian"
  os_version = "jessie"
  arch       = "x86_64"
  kernel     = "/var/www/cobbler/ks_mirror/debian8-x86_64/install.amd/vmlinuz"
  initrd     = "/var/www/cobbler/ks_mirror/debian8-x86_64/install.amd/initrd.gz"
}

resource "cobbler_profile" "debian-jessie" {
  name                = "debian-jessie"
  distro              = "debian8-x86_64"
  kickstart           = "/var/lib/cobbler/kickstarts/debian8-virtual.seed"
  ks_meta             = "release=8"
  kernel_options      = "ipv6.disable=1"
  name_servers        = ["192.168.178.3", "8.8.8.8"] # Should be a list
  name_servers_search = ["internal"]
  repos               = ["debian8-x86_64"] # Should be a list
}

Debug Output

2 error(s) occurred:

* cobbler_system.server: Cobbler System: Error Creating: error: "<class 'cobbler.cexceptions.CX'>:'invalid profile name: debian-jessie'" code: 1
* cobbler_profile.debian-jessie: Cobbler Profile: Error Creating: 1 error(s) decoding:

* 'repos': source data must be an array or slice, got string

Expected Behavior

Just like 'name_servers' and 'name_servers_search' I was expecting 'repos' to be interpreted as a list. As far as I can see in @jtopjian's code (link), 'repos' is interpreted identical to 'name_servers':

NameServers  []string `mapstructure:"name_servers"`
Repos        []string `mapstructure:"repos"`

but the error output suggests different.

Actual Behavior

The Terraform plan fails due to errors in the 'cobbler_profile'.

bug providecobbler

All 6 comments

@hbokh Thanks for the report - I'll look into this. :)

While your at it, management = true in aresource "cobbler_system" for an interface is not doing anything either.
If wanted I can create a new ticket for that specific part.

@hbokh Thanks for the heads up on that one, too. I'll take a look. If it's a simple fix, I'll just roll it into the original reported bug. But if not, I'll let you know to open a separate issue :)

I hope to have some time today / tomorrow to look at this.

@hbokh #12452 should fix both issues.

The repos bug was because Cobbler wants repos to be a space-separated string. Cobbler will split the string internally, but the API will always want a string and will send a string back.

The management issue was a typo (managment and not management).

If you're able to test #12542 locally by compiling Terraform, give it a shot and let me know if you're still seeing the problem. But if you're not, that should be OK. I did enough testing that I'm fairly confident both of these issues are fixed.

After (re-)compiling Terraform, both fixes seems to be working over here.
Thanks heaps!

FYI and off-topic - Cobbler returns an error through Terraform now:

error: "<type 'exceptions.AttributeError'>:'NoneType' object has no attribute 'get_conceptual_parent'"

but that seems to be related to a bug like this: Cobbler v2.8 iPXE/gPXE Internal Server Error.

I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings