# Unable to import templates with 5.4.1? Ruby Error?

**URL:** <https://forum.opennebula.io/t/unable-to-import-templates-with-5-4-1-ruby-error/4964>\
**Category:** Product Support\
**Created:** [September 22, 2017, 12:39am UTC](https://forum.opennebula.io/t/unable-to-import-templates-with-5-4-1-ruby-error/4964 "2017-09-22T00:39:34Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![flabr04](https://avatars.discourse-cdn.com/v4/letter/f/d2c977/32.png) [@flabr04](https://forum.opennebula.io/u/flabr04)\
**Post date:** [September 22, 2017, 12:39am UTC](https://forum.opennebula.io/t/unable-to-import-templates-with-5-4-1-ruby-error/4964/1 "2017-09-22T00:39:34Z")

</div>

## Please, describe the problem here and provide additional information below (if applicable)

Added vcenter and host/datastore to 5.4.1 install, went to import template and get a error " There was an error trying to create an image for disk in vcenter template. Reason: ManagedObjectNotFound: The object ‘vim.VirtualMachine:undefined’ has already been deleted or has not been completely created "

The template and souce VM are fine in vCenter. Never seen this before.

**Versions of the related components and OS (frontend, hypervisors, VMs):**

vCenter 6.5 U1, Host is 6.0.0, 2494585

**Steps to reproduce:**  
Import existing VM template  
**Current results:**

Fails with

There was an error trying to create an image for disk in vcenter template. Reason: ManagedObjectNotFound: The object ‘vim.VirtualMachine:undefined’ has already been deleted or has not been completely created ["/usr/lib/one/ruby/vendors/rbvmomi/lib/rbvmomi/connection.rb:61:in `parse_response'", "/usr/lib/one/ruby/vendors/rbvmomi/lib/rbvmomi/connection.rb:90:in`call’", “/usr/lib/one/ruby/vendors/rbvmomi/lib/rbvmomi/basic\_types.rb:211:in `_call'", "/usr/lib/one/ruby/vendors/rbvmomi/lib/rbvmomi/basic_types.rb:74:in`block (2 levels) in init’”, “/usr/lib/one/ruby/vendors/rbvmomi/lib/rbvmomi/basic\_types.rb:189:in `_get_property'", "/usr/lib/one/ruby/vendors/rbvmomi/lib/rbvmomi/basic_types.rb:35:in`block (2 levels) in init’”, “/usr/lib/one/ruby/vcenter\_driver/virtual\_machine.rb:78:in `get_dc'", "/usr/lib/one/ruby/vcenter_driver/virtual_machine.rb:230:in`import\_vcenter\_disks’”, “/usr/lib/one/sunstone/routes/vcenter.rb:338:in `block in '", "/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:1611:in`call’”, “/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:1611:in `block in compile!'", "/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:975:in`[]’”, “/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:975:in `block (3 levels) in route!'", "/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:994:in`route\_eval’”, “/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:975:in `block (2 levels) in route!'", "/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:1015:in`block in process\_route’”, “/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:1013:in `catch'", "/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:1013:in`process\_route’”, “/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:973:in `block in route!'", "/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:972:in`each’”, “/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:972:in `route!'", "/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:1085:in`block in dispatch!’”, “/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:in `block in invoke'", "/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:in`catch’”, “/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:in `invoke'", "/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:1082:in`dispatch!’”, “/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:907:in `block in call!'", "/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:in`block in invoke’”, “/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:in `catch'", "/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:in`invoke’”, “/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:907:in `call!'", "/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:895:in`call’”, “/usr/local/share/gems/gems/rack-1.6.4/lib/rack/commonlogger.rb:33:in `call'", "/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:219:in`call’”, “/usr/local/share/gems/gems/rack-1.6.4/lib/rack/deflater.rb:35:in `call'", "/usr/local/share/gems/gems/rack-1.6.4/lib/rack/session/abstract/id.rb:225:in`context’”, “/usr/local/share/gems/gems/rack-1.6.4/lib/rack/session/abstract/id.rb:220:in `call'", "/usr/local/share/gems/gems/rack-protection-1.5.3/lib/rack/protection/xss_header.rb:18:in`call’”, “/usr/local/share/gems/gems/rack-protection-1.5.3/lib/rack/protection/path\_traversal.rb:16:in `call'", "/usr/local/share/gems/gems/rack-protection-1.5.3/lib/rack/protection/json_csrf.rb:18:in`call’”, “/usr/local/share/gems/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call'", "/usr/local/share/gems/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in`call’”, “/usr/local/share/gems/gems/rack-protection-1.5.3/lib/rack/protection/frame\_options.rb:31:in `call'", "/usr/local/share/gems/gems/rack-1.6.4/lib/rack/nulllogger.rb:9:in`call’”, “/usr/local/share/gems/gems/rack-1.6.4/lib/rack/head.rb:13:in `call'", "/usr/local/share/gems/gems/rack-1.6.4/lib/rack/methodoverride.rb:22:in`call’”, “/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/show\_exceptions.rb:25:in `call'", "/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:182:in`call’”, “/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:2013:in `call'", "/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:1487:in`block in call’”, “/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:1787:in `synchronize'", "/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:1487:in`call’”, “/usr/local/share/gems/gems/thin-1.7.0/lib/thin/connection.rb:86:in `block in pre_process'", "/usr/local/share/gems/gems/thin-1.7.0/lib/thin/connection.rb:84:in`catch’”, “/usr/local/share/gems/gems/thin-1.7.0/lib/thin/connection.rb:84:in `pre_process'", "/usr/local/share/gems/gems/thin-1.7.0/lib/thin/connection.rb:50:in`block in process’”, “/usr/local/share/gems/gems/eventmachine-1.2.0.1/lib/eventmachine.rb:1076:in `call'", "/usr/local/share/gems/gems/eventmachine-1.2.0.1/lib/eventmachine.rb:1076:in`block in spawn\_threadpool’”]

**Expected results:**

Imported template

---

<div class="post-metadata">

**Author:** ![flabr04](https://avatars.discourse-cdn.com/v4/letter/f/d2c977/32.png) [@flabr04](https://forum.opennebula.io/u/flabr04)\
**Post date:** [September 22, 2017, 2:43am UTC](https://forum.opennebula.io/t/unable-to-import-templates-with-5-4-1-ruby-error/4964/2 "2017-09-22T02:43:06Z")

</div>

I do see this when I import the template - test- template [Cluster: testdrs - Template location: /]

not sure what is supposed to there for template location?

 ![541-error](https://canada1.discourse-cdn.com/flex031/uploads/opennebula/original/2X/b/b3fbfab6108ccd28a3ec83c7a8530784d327d125.png)

---

<div class="post-metadata">

**Author:** ![flabr04](https://avatars.discourse-cdn.com/v4/letter/f/d2c977/32.png) [@flabr04](https://forum.opennebula.io/u/flabr04)\
**Post date:** [September 22, 2017, 3:45am UTC](https://forum.opennebula.io/t/unable-to-import-templates-with-5-4-1-ruby-error/4964/3 "2017-09-22T03:45:00Z")

</div>

I am getting the same error with a vCenter 5.5 and 5.5 ESX host… bizzare. I will build a totally new Nebula host/DB env and test to see if I can reproduce this. the install of 5.4.1 and everything else via sunstone seems fine till i try to add templates.

---

<div class="post-metadata">

**Author:** ![Pascal](https://avatars.discourse-cdn.com/v4/letter/p/e9a140/32.png) [@Pascal](https://forum.opennebula.io/u/Pascal)\
**Post date:** [October 13, 2017, 8:10am UTC](https://forum.opennebula.io/t/unable-to-import-templates-with-5-4-1-ruby-error/4964/4 "2017-10-13T08:10:22Z")

</div>

Hello together,

we get the same error. Environment ist vCenter 6.5 U1 (Hosts are 6.0). In a previous version of OpenNebula (eg 5.2.0) importing templates ist still working fine.

I followed the advise in the following thread: [Error : Import Template Vcenter (Opennebula 5.4)](https://forum.opennebula.io/t/error-import-template-vcenter-opennebula-5-4/4672/10)

If you see tinovas post (a bit further down), but replacing the virtual\_machine.rb file does not work. You run into another error message. Sorry dont have the message anymore.

Seems to be a problem with the vCenter driver (maybe :)).

Greetings  
Pascal

---

<div class="post-metadata">

**Author:** ![tinova](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/tinova/32/25_2.png) [@tinova](https://forum.opennebula.io/u/tinova)\
**Post date:** [October 13, 2017, 11:01am UTC](https://forum.opennebula.io/t/unable-to-import-templates-with-5-4-1-ruby-error/4964/5 "2017-10-13T11:01:07Z")

</div>

Could you please redo the test (Brian and Pascal) with the /usr/lib/one/ruby/vcenter\_driver/virtual\_machine.rb with the file replaced?

> <https://github.com/OpenNebula/one/blob/master/src/vmm_mad/remotes/lib/vcenter_driver/virtual_machine.rb>

We need to know the exact error message. Thanks!

---

<div class="post-metadata">

**Author:** ![Pascal](https://avatars.discourse-cdn.com/v4/letter/p/e9a140/32.png) [@Pascal](https://forum.opennebula.io/u/Pascal)\
**Post date:** [October 13, 2017, 11:08am UTC](https://forum.opennebula.io/t/unable-to-import-templates-with-5-4-1-ruby-error/4964/6 "2017-10-13T11:08:10Z")

</div>

Hey,

thanks for your reply. I´ll rebuild it next week and tell you the result.

Greetings  
Pascal

---

<div class="post-metadata">

**Author:** ![Pascal](https://avatars.discourse-cdn.com/v4/letter/p/e9a140/32.png) [@Pascal](https://forum.opennebula.io/u/Pascal)\
**Post date:** [October 16, 2017, 7:23am UTC](https://forum.opennebula.io/t/unable-to-import-templates-with-5-4-1-ruby-error/4964/7 "2017-10-16T07:23:39Z")

</div>

Here we are!

Befor editing:

[before.txt](https://canada1.discourse-cdn.com/flex031/uploads/opennebula/original/2X/b/b636c101e4f8c4250cd63073fb3969b760c8161b.txt) (5.2 KB)

and after changing the “.rb” file, we got the following message:

[after.txt](https://canada1.discourse-cdn.com/flex031/uploads/opennebula/original/2X/9/9ca1d0c88d18f4fd20d162fdc963c2501f11784f.txt) (4.6 KB)

Greetings  
Pascal

---

<div class="post-metadata">

**Author:** ![UAnton](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/uanton/32/6309_2.png) [@UAnton](https://forum.opennebula.io/u/UAnton)\
**Post date:** [October 16, 2017, 1:40pm UTC](https://forum.opennebula.io/t/unable-to-import-templates-with-5-4-1-ruby-error/4964/8 "2017-10-16T13:40:59Z")

</div>

Hello,  
Have same problem

---

<div class="post-metadata">

**Author:** ![tinova](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/tinova/32/25_2.png) [@tinova](https://forum.opennebula.io/u/tinova)\
**Post date:** [October 17, 2017, 4:47pm UTC](https://forum.opennebula.io/t/unable-to-import-templates-with-5-4-1-ruby-error/4964/9 "2017-10-17T16:47:27Z")

</div>

Thanks for the detailed feedback.

From the provided stack trace, this seems to be the problem:

[VirtualMachine(“undefined”)]

So this is most likely a Sunstone (JavaScript) error.

- Does it happen consistently?
- Is it always with the same VM Template? Does it happen with only one VM Template, or with all of them?
- Does it work when you try to import it using “onevcenter templates” CLI tool?

---

<div class="post-metadata">

**Author:** ![UAnton](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/uanton/32/6309_2.png) [@UAnton](https://forum.opennebula.io/u/UAnton)\
**Post date:** [October 18, 2017, 8:25am UTC](https://forum.opennebula.io/t/unable-to-import-templates-with-5-4-1-ruby-error/4964/10 "2017-10-18T08:25:58Z")

</div>

Hello,  
Import using CLI works!

---

<div class="post-metadata">

**Author:** ![mbu](https://avatars.discourse-cdn.com/v4/letter/m/ee7513/32.png) [@mbu](https://forum.opennebula.io/u/mbu)\
**Post date:** [October 18, 2017, 8:35am UTC](https://forum.opennebula.io/t/unable-to-import-templates-with-5-4-1-ruby-error/4964/11 "2017-10-18T08:35:19Z")

</div>

Hi,  
we also have the same problem.  
It happens consistently with every VM template.  
Importing CLI does not really work, During import it stops because of an incorrect password.  
Here what I have done:  
[root@vonecloud ~]# onevcenter templates --vcenter [vcenter.mydomain.com](http://vcenter.mydomain.com) --vuser vcenter\_admin  
Password:

Connecting to vCenter: [vcenter.mydomain.com](http://vcenter.mydomain.com)…done!

Looking for VM Templates…done!

Do you want to process datacenter Datacenter1 (y/[n])? y

- VM Template found:

What did I do wrong? Do I have to specify other credentials than the vCenter admins?

---

<div class="post-metadata">

**Author:** ![AbelC](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/abelc/32/5192_2.png) [@AbelC](https://forum.opennebula.io/u/AbelC)\
**Post date:** [October 18, 2017, 1:20pm UTC](https://forum.opennebula.io/t/unable-to-import-templates-with-5-4-1-ruby-error/4964/12 "2017-10-18T13:20:27Z")

</div>

Hi all,

I can’t reproduce it.I could read that the problem is  
`Trace: [VirtualMachine("undefined")]`

This may be because the vcenter\_ref is undefined from Sunstone. To identify the problem I need more data.

I have made a small script to run it in the chrome / firefox console to be able to know that it collects Sunstone from the request to ruby.

Steps:  
`- Get VM Template`  
`- Copy JS script in chrome / firefox console`

> trs = $(“#vcenter\_import\_table\_one1 tr”);
> 
> $.each(trs, function(key, value){  
> console.log($(‘.check\_item’, value).data(“import\_data”));  
> });

This script returns the data of each template, it would be interesting to send me the results of the problematic templates, and be able to detect the problem.

Thanks.

Regards,  
Abel.

---

<div class="post-metadata">

**Author:** ![tinova](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/tinova/32/25_2.png) [@tinova](https://forum.opennebula.io/u/tinova)\
**Post date:** [October 18, 2017, 1:32pm UTC](https://forum.opennebula.io/t/unable-to-import-templates-with-5-4-1-ruby-error/4964/13 "2017-10-18T13:32:05Z")

</div>

Manuel, your error message seems unrelated, would you mind opening a new topic?

Pascal, UAnton, we would appreciate Abel’s requested feedback to further debug this problem. Thanks!

---

<div class="post-metadata">

**Author:** ![ybizeul](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/ybizeul/32/5433_2.png) [@ybizeul](https://forum.opennebula.io/u/ybizeul)\
**Post date:** [October 19, 2017, 4:41pm UTC](https://forum.opennebula.io/t/unable-to-import-templates-with-5-4-1-ruby-error/4964/14 "2017-10-19T16:41:06Z")

</div>

Have the exact same problem.  
Here is the requested debug :

 ![48](https://canada1.discourse-cdn.com/flex031/uploads/opennebula/original/2X/7/70b4523f28dee729d14d9a0241cf3338b142c2ed.png)

Does it looks like the first item is undefined?

---

<div class="post-metadata">

**Author:** ![AbelC](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/abelc/32/5192_2.png) [@AbelC](https://forum.opennebula.io/u/AbelC)\
**Post date:** [October 20, 2017, 10:24am UTC](https://forum.opennebula.io/t/unable-to-import-templates-with-5-4-1-ruby-error/4964/15 "2017-10-20T10:24:32Z")

</div>

That’s not the problem  
The first one not defined is because an assignment to a variable is not performed. Thing of the JS.

---

<div class="post-metadata">

**Author:** ![Pascal](https://avatars.discourse-cdn.com/v4/letter/p/e9a140/32.png) [@Pascal](https://forum.opennebula.io/u/Pascal)\
**Post date:** [October 20, 2017, 11:21am UTC](https://forum.opennebula.io/t/unable-to-import-templates-with-5-4-1-ruby-error/4964/16 "2017-10-20T11:21:14Z")

</div>

Well thats what i got:

![2017-10-20_13-11-11](https://canada1.discourse-cdn.com/flex031/uploads/opennebula/original/2X/9/9521eaf6e2f94086acf8a94536d13e13edd41aea.png)

Im not a dev. In Sunstone, i go to the template task --\> VMs --\> Import:

Here i say get Template including credentials and vCenter name FQDN.

Opening a console in Firefox and run the script. Can u help me? 🙂

BTW output is empty.

Greetings  
Pascal

---

<div class="post-metadata">

**Author:** ![ybizeul](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/ybizeul/32/5433_2.png) [@ybizeul](https://forum.opennebula.io/u/ybizeul)\
**Post date:** [October 20, 2017, 11:37am UTC](https://forum.opennebula.io/t/unable-to-import-templates-with-5-4-1-ruby-error/4964/17 "2017-10-20T11:37:24Z")

</div>

You need to change the typographic quotes “‘” with bare ones on your keyboard. That’s around “`.check_item`” and “`import_data`”

---

<div class="post-metadata">

**Author:** ![Pascal](https://avatars.discourse-cdn.com/v4/letter/p/e9a140/32.png) [@Pascal](https://forum.opennebula.io/u/Pascal)\
**Post date:** [October 20, 2017, 12:04pm UTC](https://forum.opennebula.io/t/unable-to-import-templates-with-5-4-1-ruby-error/4964/18 "2017-10-20T12:04:15Z")

</div>

Hey! Like that?

 ![2017-10-20_13-57-41](https://canada1.discourse-cdn.com/flex031/uploads/opennebula/original/2X/4/40016f2521906216abe108258145fc9a7147e8d7.png)

iframe is: “[http://xxxxx/#templates-tab/form](http://xxxxx/#templates-tab/form)”

---

<div class="post-metadata">

**Author:** ![ybizeul](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/ybizeul/32/5433_2.png) [@ybizeul](https://forum.opennebula.io/u/ybizeul)\
**Post date:** [October 20, 2017, 7:19pm UTC](https://forum.opennebula.io/t/unable-to-import-templates-with-5-4-1-ruby-error/4964/19 "2017-10-20T19:19:54Z")

</div>

No, you are still typing typographic quotes

Replace them directly in the JS debugger, by typing "

Observe the difference in the quotes between line 1 and line 4

---

<div class="post-metadata">

**Author:** ![ybizeul](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/ybizeul/32/5433_2.png) [@ybizeul](https://forum.opennebula.io/u/ybizeul)\
**Post date:** [October 20, 2017, 7:30pm UTC](https://forum.opennebula.io/t/unable-to-import-templates-with-5-4-1-ruby-error/4964/20 "2017-10-20T19:30:12Z")

</div>

I had a datastore ISO file connected in my VM, but reverting it to Client Device, didn’t solve the issue.

[Next page](https://forum.opennebula.io/t/unable-to-import-templates-with-5-4-1-ruby-error/4964.md?page=2)
