Closed anabel1012 closed 1 year ago
Reproduced on my side.
We will work on it for the v1.2.1
release.
Ok, I'm able to create the service from a template on minione when everything is configured so I'll need more informations.
I reproduced the error with flow_endpoint = ""
Did you define flow_endpoint
in the provider configuration ? (see doc)
Are you able to create a service from sunstone ? (the oneflow service has to be configured and running)
At least It appears that we're missing a basic check somewhere in the provider but overall it seems to work
Thank you for the quick answer!
Yes, I can create services from the GUI and they work correctly. However, I had not defined the variable flow_endpoint
but with the rest of the resources it works perfectly just pointing to endpoint
. If I define it, I get the following:
opennebula_service.ubuntu_service: Creating...
╷
│ Error: Failed to instantiate service
│
│ with opennebula_service.ubuntu_service,
│ on one_create_service.tf line 19, in resource "opennebula_service" "ubuntu_service":
│ 19: resource "opennebula_service" "ubuntu_service" {
│
│ <!DOCTYPE html>
│ <html>
│ <head>
│ <style type="text/css">
│ body { text-align:center;font-family:helvetica,arial;font-size:22px;
│ color:#888;margin:20px}
│ #c {margin:0 auto;width:500px;text-align:left}
│ </style>
│ </head>
│ <body>
│ <h2>Sinatra doesn’t know this ditty.</h2>
│ <img src='http://10.X.X.X:2474/__sinatra__/404.png'>
│ <div id="c">
│ Try this:
│ <pre>post '/RPC2/service_template/14/action' do
│ "Hello World"
│ end
│ </pre>
│ </div>
│ </body>
│ </html>
│
Not sure of what this error is, this seems to be an error returned from Goca: https://github.com/OpenNebula/one/blob/master/src/oca/go/src/goca/service_template.go#L136
But the Goca errors in service template resource lack of a bit of context, I suspect this to be returned at this line: https://github.com/OpenNebula/one/blob/master/src/oca/go/src/goca/service_template.go#L163
At first glance I don't know who made an error here, is oneflow properly configured ? is it an error from Goca ? from the provider ? There is some old issues around sinatra in the ONE repository, not sure it helps: https://github.com/OpenNebula/one/search?q=ditty&type=issues
This will require some more investigations
Thank you, I look forward to the resolution!
Do you have an estimated date for v1.2.1
release?
Hello @anabel1012,
I just merged the pull request fixing the crash. I keep the issue open for further investigation.
I took some content from the test files just to see if I was able to deploy a service (the vm_template
value has to be updated to select an existing template ID), and it works.
Even when I made some errors I got errors from OpenNebula etc.
So, are you able to make deploy something like this :
resource "opennebula_service_template" "service_template" {
name = "ig1-one-acceptance-svc"
permissions = "760"
template = <<EOF
{
"TEMPLATE": {
"BODY": {
"name": "ig1-one-acceptance-svc",
"deployment": "straight",
"roles": [{
"name": "master",
"cardinality": 3,
"vm_template": 2,
"min_vms": 2
}]
}
}
}
EOF
}
resource "opennebula_service" "service" {
name = "ig1-one-acceptance-svc-01"
permissions = "760"
template_id = opennebula_service_template.service_template.id
}
If yes, could you provide an example to reproduce your problem ?
As a side note I made some tests with minione, it seems that timeouts are sometimes a bit short and not user configurable, this should be improved.
Hello again @treywelsh @frousselet ! I saw that a new version was released so I have returned to the issue again. But the error is still the same with v1.2.2. See below:
Terraform will perform the following actions:
# opennebula_service.service will be created
+ resource "opennebula_service" "service" {
+ gid = (known after apply)
+ gname = (known after apply)
+ id = (known after apply)
+ name = "ig1-one-acceptance-svc-01"
+ networks = (known after apply)
+ permissions = "760"
+ roles = (known after apply)
+ state = (known after apply)
+ template_id = (known after apply)
+ uid = (known after apply)
+ uname = (known after apply)
}
# opennebula_service_template.service_template will be created
+ resource "opennebula_service_template" "service_template" {
+ gid = (known after apply)
+ gname = (known after apply)
+ id = (known after apply)
+ name = "ig1-one-acceptance-svc"
+ permissions = "760"
+ template = jsonencode(
{
+ TEMPLATE = {
+ BODY = {
+ deployment = "straight"
+ name = "ig1-one-acceptance-svc"
+ roles = [
+ {
+ cardinality = 3
+ min_vms = 2
+ name = "master"
+ vm_template = 2
},
]
}
}
}
)
+ uid = (known after apply)
+ uname = (known after apply)
}
Plan: 2 to add, 0 to change, 0 to destroy.
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
opennebula_service_template.service_template: Creating...
╷
│ Error: Failed to create the service template
│
│ with opennebula_service_template.service_template,
│ on one_resource_service.tf line 19, in resource "opennebula_service_template" "service_template":
│ 19: resource "opennebula_service_template" "service_template" {
│
│ <!DOCTYPE html>
│ <html>
│ <head>
│ <style type="text/css">
│ body { text-align:center;font-family:helvetica,arial;font-size:22px;
│ color:#888;margin:20px}
│ #c {margin:0 auto;width:500px;text-align:left}
│ </style>
│ </head>
│ <body>
│ <h2>Sinatra doesn’t know this ditty.</h2>
│ <img src='http://IP_FLOW_ENDPOINT/__sinatra__/404.png'>
│ <div id="c">
│ Try this:
│ <pre>post '/RPC2/service_template' do
│ "Hello World"
│ end
│ </pre>
│ </div>
│ </body>
│ </html>
│
╵
Do you have an estimated release date for version v1.3.0? Thanks!
@anabel1012 I hit a very similar issue with getting the Sinatra doesn’t know this ditty
error response. What worked for me was dropping the /RPC2
path from the flow endpoint.
Hi @anabel1012 the error comes from Sinatra (OneFlow API server) indicating that the endpoint is not valid. The /RPC2
path only applies to the main OpenNebula endpoint, not for the OneFlow endpoint. So, as @benjamb said, it should be removed.
I just realized that this error is also present in the documentation, so it should be fixed with this PR that I have already opened. Please confirm if after modifying the endpoint everything works as expected.
Description
Hello,
I am trying to deploy a service from Terraform but I find this error. Could you help me?
Terraform and Provider version
Affected resources and data sources
opennebula_service
Terraform configuration
Expected behavior
Service to be deployed
Actual behavior
The terraform-provider-opennebula_v1.2.0 plugin crashed!
Steps to Reproduce
terraform init terraform apply
Debug output
No response
Panic output
Important factoids
No response
References
No response