首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >openstack热能不识别key_name参数

openstack热能不识别key_name参数
EN

Stack Overflow用户
提问于 2018-05-18 20:22:14
回答 3查看 1.8K关注 0票数 0

为什么?

我的笔记本电脑上部署了openstack。我试着用热来制造一个堆栈。

我已经创建了一个键盘openstack keypair create heat_key > heat_key.priv,它是由nova nova keypair-list识别的,给出了以下输出:

代码语言:javascript
复制
+----------+------+-------------------------------------------------+
| Name     | Type | Fingerprint                                     |
+----------+------+-------------------------------------------------+
| heat_key | ssh  | 0b:7a:36:20:e2:e3:19:3b:ab:a1:95:ac:67:41:67:d7 |
+----------+------+-------------------------------------------------+

这是我的简单的热门模板:

代码语言:javascript
复制
heat_template_version: 2013-05-23

description: Hot Template to deploy a single server

parameters:
  image_id:
    type: string
    description: Image ID
  key_name:
    type: string
    description: name of keypair to enable ssh to the instance

resources:
  test_stack:
    type: OS::Nova::Server
    properties:
      name: "test_stack"
      image: { get_param: image_id }
      flavor: "ds1G"
      key_name:{ get_param: key_name }

outputs:
  test_stack_ip:
    description: IP of the server
    value: { get_attr: [ test_stack, first_address ] }

当我试图创建堆栈时

代码语言:javascript
复制
openstack stack create -t myTemp.hot --parameter key_name=heat_key --parameter image_id=trusty-server-cloudimg-amd64-disk1 test_stack

我得到以下错误

代码语言:javascript
复制
ERROR: Property error: : resources.test_stack.properties: : Unknown Property key_name:{ get_param

我尝试过使用不同版本的模板,但是我得到了相同的错误。

知道为什么会这样吗?

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2018-05-21 13:49:52

YAML文件最糟糕的部分是,它是空间敏感的,所以在编辑或复制HEAT的conetent时需要非常小心。"key_name“和"{”之间没有空格,这就是它失败的原因。

key_name:{ get_param: key_pair_name }

只要把an extra space放在这些之间,它就能工作了。我测试过:-)

key_name:{ get_param: key_pair_name }

票数 1
EN

Stack Overflow用户

发布于 2018-05-19 03:32:54

尝试将参数名key_name更改为其他名称并执行它

代码语言:javascript
复制
heat_template_version: 2015-10-15

description: Hot Template to deploy a single server

parameters:
  image_id:
    type: string
    description: Image ID
  key_pair_name:
    type: string
    description: name of keypair to enable ssh to the instance

resources:
  test_stack:
    type: OS::Nova::Server
    properties:
      name: "test_stack"
      image: { get_param: image_id }
      flavor: "ds1G"
      key_name: { get_param: key_pair_name }

outputs:
  test_stack_ip:
    description: IP of the server
    value: { get_attr: [ test_stack, first_address ] }
票数 0
EN

Stack Overflow用户

发布于 2018-05-23 22:40:30

我能够通过提供参数中的细节来做到这一点。为我工作的PFB样本脚本。

代码语言:javascript
复制
heat_template_version: 2016-10-14

description: Admin VM - Test Heat
parameters:
  image_name_1:
    type: string
    label: Centos-7.0
    description: Centos Linux 7.0
    default: Centos-7.0
  network_id_E1:
    type: string
    label: 58e867ce-841c-48cf-8116-e72d998dbc89
    description: Admin External Network
    default: Admin
  network_id_E1:
    type: string
    label: 4f69c8e5-8f52-4804-89e0-2c8232f9f3aa
    description: Internal-1 Network
    default: SR-IOV Interface
  network_id_I2:
    type: string
    label: 28120cdb-7e8b-4e8b-821f-7c7d8df37c1d
    description: Internal-2 Network
    default: Internal-2
  KeyName:
    type: string
    default: IO_Perf_Cnt
    description: Name of an existing key pair to use for the instance
    constraints:
      - custom_constraint: nova.keypair
        description: Must name a public key (pair) known to Nova
resources:
  AdminVM1:
    type: OS::Nova::Server
    properties:
      availability_zone: naz3
      image:  { get_param: image_name_1 }
      flavor: 4vcpu_8192MBmem_40GBdisk
      key_name: { get_param: KeyName }
      networks:
        - network: { get_param : network_id_E1 }
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50418750

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档