厨房openstack步骤/例子

时间:2014-05-05 18:20:05

标签: chef openstack test-kitchen

我正在尝试使用带有kitchen-openstack的工具测试厨房,对我们的一些厨师食谱进行一些集成/功能测试。

但我无法让它发挥作用:( 我有一个.kitchen.yml,内容如下:

driver:
  name: openstack
  openstack_username: test
  openstack_api_key: test
  openstack_auth_url: http://<openstackServerIp>:35357/v2.0/
  require_chef_omnibus: latest
  image_ref: CentOS-6.5-Template
  flavor_ref: cloud.tiny
  openstack_tenant: test

provisioner:
  name: chef_solo

platforms:
  - name: centos-6.5

suites:
  - name: default
    run_list:
      - recipe[myTestChef::default]

当我做厨房时,我现在收到的东西创建默认 - centos-65是:

Message: Expected([200, 204]) <=> Actual(400 Bad Request)
  response => #<Excon::Response:0x00000001eed698 @data={:body=>"{\"error\": {\"message\": \"get_version_v2() got an unexpected keyword argument 'auth'\", \"code\": 400, \"title\": \"Bad Request\"}}", :headers=>{"Vary"=>"X-Auth-Token", "Content-Type"=>"application/json", "Content-Length"=>"121", "Date"=>"Mon, 05 May 2014 18:02:15 GMT"}, :status=>400, :remote_ip=>"<openstackServerIp>", :local_port=>34592, :local_address=>"192.168.10.32"}, @body="{\"error\": {\"message\": \"get_version_v2() got an unexpected keyword argument 'auth'\", \"code\": 400, \"title\": \"Bad Request\"}}", @headers={"Vary"=>"X-Auth-Token", "Content-Type"=>"application/json", "Content-Length"=>"121", "Date"=>"Mon, 05 May 2014 18:02:15 GMT"}, @status=400, @remote_ip="<openstackServerIp>", @local_port=34592, @local_address="192.168.10.32">

当我运行厨房清单时,我得到:

Instance           Driver     Provisioner  Last Action
default-centos-65  Openstack  ChefSolo     <Not Created>

我做错了什么?任何人都可以分享一些步骤或示例如何设置它吗?

我是从在OpenStack的同一个项目中创建的虚拟机运行的。

2 个答案:

答案 0 :(得分:1)

我发现了这个问题。我还必须指定:

  • server_name:<VMName to create>
  • network_ref:<the name of the network where the VM will be created>
  • public_key_path:/home/<some local user>/.ssh/id_rsa.pub
  • private_key_path:/home/<some local user>/.ssh/id_rsa
  • 用户名:<user to login into the VM that will be created>

public_key_path private_key_path 必须与将要创建虚拟机的 autorized_key 相关联。

这些最后3个SSH值是必需的,因此Kitchen可以连接到创建的虚拟机,以便它可以在那里应用厨师食谱。

答案 1 :(得分:1)

您从OpenStack获得的错误:

  

“get_version_v2()得到了一个意外的关键字参数'auth'\”

这是因为身份验证网址。使用libcloud连接到OpenStack API时遇到了同样的问题。

我在尝试什么:

http://localhost:5000/v2.0/

解决方案:

http://localhost:5000/
http://localhost:5000/v2.0/tokens/

来源:Connecting to the OpenStack installation