dariusbakunas / terraform-provider-truenas

Experimental terraform provider to manage TrueNAS server
MIT License
72 stars 16 forks source link

Cannot create an enhanced time machine share #11

Closed damoun closed 1 year ago

damoun commented 1 year ago

I try to create a multi-user time machine but I've got the following error:

truenas_share_smb.time_machine: Creating...
╷
│ Error: error creating SMB share: 500 Internal Server Error
│ {
│  "message": "'name'",
│  "traceback": "Traceback (most recent call last):\n  File \"/usr/local/lib/python3.9/site-packages/middlewared/restful.py\", line 575, in do\n    result = await self.middleware.call(methodname, *method_args, **method_kwargs)\n  File \"/usr/local/lib/python3.9/site-packages/middlewared/main.py\", line 1278, in call\n    return await self._call(\n  File \"/usr/local/lib/python3.9/site-packages/middlewared/main.py\", line 1235, in _call\n    return await methodobj(*prepared_call.args)\n  File \"/usr/local/lib/python3.9/site-packages/middlewared/service.py\", line 495, in create\n    rv = await self.middleware._call(\n  File \"/usr/local/lib/python3.9/site-packages/middlewared/main.py\", line 1235, in _call\n    return await methodobj(*prepared_call.args)\n  File \"/usr/local/lib/python3.9/site-packages/middlewared/schema.py\", line 975, in nf\n    return await f(*args, **kwargs)\n  File \"/usr/local/lib/python3.9/site-packages/middlewared/plugins/smb.py\", line 824, in do_create\n    await self.clean(data, 'sharingsmb_create', verrors)\n  File \"/usr/local/lib/python3.9/site-packages/middlewared/plugins/smb.py\", line 1046, in clean\n    data['name'] = await self.name_exists(data, schema_name, verrors, id)\n  File \"/usr/local/lib/python3.9/site-packages/middlewared/plugins/smb.py\", line 1187, in name_exists\n    name = data['name']\nKeyError: 'name'\n"
│ }
│
│   with truenas_share_smb.time_machine,
│   on shares.tf line 1, in resource "truenas_share_smb" "time_machine":
│    1: resource "truenas_share_smb" "time_machine" {
│

From this line https://github.com/truenas/middleware/blob/TN-13.0-RELEASE/src/middlewared/middlewared/plugins/smb.py#L1186

My terraform code look like:

resource "truenas_share_smb" "time_machine" {
  enabled     = true
  name        = "Time Machine"
  path        = truenas_dataset.time_machine.mount_point
  acl         = true
  purpose     = "ENHANCED_TIMEMACHINE"
  comment     = "Created by terraform"
}

I'm running TrueNas 13.0 and I use the provider 0.11.0.

joneshf commented 1 year ago

👋 not a collaborator here, just a consumer of the provider. But, it might be because you're using TrueNAS Core 13.0 and version 0.11.0 of the provider was made for TrueNAS Scale 22.02. It sounds like supporting other versions would be ideal, but time is the missing bit. Dunno if that helps you in any way, but thought I'd mention it since I was passing by.

damoun commented 1 year ago

Good to know, thanks. Anyway, the code linked from TrueNAS middleware is use on both SCALE & CORE.

dariusbakunas commented 1 year ago

Yeah multiple version support is a big issue right now, seems like project is getting more popularity and I'm getting more requests from different TrueNAS versions. There is an open issue on their end to fix their API definitions, up to now I had to fix them by hand for every endpoint and that won't scale to support multiple versions.