# os\_server fails with "Error in creating instance (Inner Exception: create() takes at least 4 non-keyword arguments (2 given))"

**URL:** <https://forum.ansible.com/t/os-server-fails-with-error-in-creating-instance-inner-exception-create-takes-at-least-4-non-keyword-arguments-2-given/22649>\
**Category:** Ansible Project\
**Created:** [September 26, 2016, 10:11pm UTC](https://forum.ansible.com/t/os-server-fails-with-error-in-creating-instance-inner-exception-create-takes-at-least-4-non-keyword-arguments-2-given/22649 "2016-09-26T22:11:32Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Richard\_Eggert](https://avatars.discourse-cdn.com/v4/letter/r/d9b06d/32.png) [@Richard\_Eggert](https://forum.ansible.com/u/Richard_Eggert)\
**Post date:** [September 26, 2016, 10:11pm UTC](https://forum.ansible.com/t/os-server-fails-with-error-in-creating-instance-inner-exception-create-takes-at-least-4-non-keyword-arguments-2-given/22649/1 "2016-09-26T22:11:32Z")

</div>

I managed to get the os\_server\_facts module working, but when I try to use the os\_server module to create a new VM instance, I get the following error:

Error in creating instance (Inner Exception: create() takes at least 4 non-keyword arguments (2 given))

No other meaningful diagnostic information is provided (even with “-v -v -v”), so I have no idea where to look. I couldn’t find anything specific to Ansible when I looked up the error message via Google. I couldn’t finding any direct calls to a method named “create” in os\_server.py, either.

---

<div class="post-metadata">

**Author:** ![David\_Shrewsbury1](https://avatars.discourse-cdn.com/v4/letter/d/7ab992/32.png) [@David\_Shrewsbury1](https://forum.ansible.com/u/David_Shrewsbury1)\
**Post date:** [September 27, 2016, 2:29pm UTC](https://forum.ansible.com/t/os-server-fails-with-error-in-creating-instance-inner-exception-create-takes-at-least-4-non-keyword-arguments-2-given/22649/2 "2016-09-27T14:29:42Z")

</div>

This is likely from the lower level python-novaclient library. Given all of your issues with  
version dependency hell, you’ve probably got some mix of libraries that just don’t gel  
together. If it’s possible, I’d highly recommend against using any Centos-based system.

---

<div class="post-metadata">

**Author:** ![Richard\_Eggert](https://avatars.discourse-cdn.com/v4/letter/r/d9b06d/32.png) [@Richard\_Eggert](https://forum.ansible.com/u/Richard_Eggert)\
**Post date:** [September 27, 2016, 4:57pm UTC](https://forum.ansible.com/t/os-server-fails-with-error-in-creating-instance-inner-exception-create-takes-at-least-4-non-keyword-arguments-2-given/22649/3 "2016-09-27T16:57:49Z")

</div>

Unfortunately, I don’t have a choice in this case.

---

<div class="post-metadata">

**Author:** ![Richard\_Eggert](https://avatars.discourse-cdn.com/v4/letter/r/d9b06d/32.png) [@Richard\_Eggert](https://forum.ansible.com/u/Richard_Eggert)\
**Post date:** [September 27, 2016, 5:24pm UTC](https://forum.ansible.com/t/os-server-fails-with-error-in-creating-instance-inner-exception-create-takes-at-least-4-non-keyword-arguments-2-given/22649/4 "2016-09-27T17:24:10Z")

</div>

Is there any way to obtain the stack trace of the original exception, so I could at least determine where the mismatch is occurring?

Rich

---

<div class="post-metadata">

**Author:** ![Richard\_Eggert](https://avatars.discourse-cdn.com/v4/letter/r/d9b06d/32.png) [@Richard\_Eggert](https://forum.ansible.com/u/Richard_Eggert)\
**Post date:** [September 27, 2016, 6:54pm UTC](https://forum.ansible.com/t/os-server-fails-with-error-in-creating-instance-inner-exception-create-takes-at-least-4-non-keyword-arguments-2-given/22649/5 "2016-09-27T18:54:51Z")

</div>

After digging through the source code, I believe I’ve tracked the problem down to the following call in \_tasks.py in Shade:

class ServerCreate(task\_manager.Task):  
def main(self, client):  
return client.nova\_client.servers.create(\*\*self.args)

This appears to be calling the following method from servers.py in novaclient:

def create(self, name, image, flavor, meta=None … and a bunch more parameters with default values)

I can only assume that self.args is only expanding into two values instead of the expected minimum 4.

I don’t know where the value of self.args comes from, however. I’m definitely passing a “name”, “flavor”, and “image” to the os\_server module.

Rich

---

<div class="post-metadata">

**Author:** ![Richard\_Eggert](https://avatars.discourse-cdn.com/v4/letter/r/d9b06d/32.png) [@Richard\_Eggert](https://forum.ansible.com/u/Richard_Eggert)\
**Post date:** [September 27, 2016, 7:25pm UTC](https://forum.ansible.com/t/os-server-fails-with-error-in-creating-instance-inner-exception-create-takes-at-least-4-non-keyword-arguments-2-given/22649/6 "2016-09-27T19:25:39Z")

</div>

I think I found the problem.

Over time, a line in Shade’s openstackcloud.py changed from this (in v1.1 and v1.2):

| 

server = self.manager.submitTask(\_tasks.ServerCreate(

 |
| | 

name=name, image=image, flavor=flavor, \*\*kwargs))

 |

to this (in v1.3-v1.11):

| 

server = self.manager.submitTask(\_tasks.ServerCreate(

 |
| | 

name=name, flavor=flavor, \*\*kwargs))

 |

to this (in v1.12+):

| 

server = self.manager.submit\_task(\_tasks.ServerCreate(

 |
| | 

name=name, \*\*kwargs))

 |

Downgrading to Shade 1.11.1 seems to have fixed the problem.

I finally managed to create a VM instance. Yay.

~Rich
