Cloudify文件插件“不允许操作”错误

时间:2019-02-20 16:16:10

标签: amazon-ec2 cloudify

我正在尝试使用cloudify.nodes.File类型将文件复制到VM,但是遇到权限错误,我很难弄清。

根据the documentation,我应该能够使用以下方法复制文件:

docker_yum_repo:
type: cloudify.nodes.File
properties:
  resource_config:
    resource_path: resources/docker.repo
    file_path: /etc/yum.repos.d/docker.repo
    owner: root:root
    mode: 644

我的蓝图的相关部分是:

vm_0:
  type: cloudify.nodes.aws.ec2.Instances
  properties:
    client_config: *client_config
    agent_config:
      install_method: none
      user: ubuntu
    resource_config:
      kwargs:
        ImageId: { get_attribute: [ ami, aws_resource_id ] }
        InstanceType: t2.micro
        UserData: { get_input: install_script }
        KeyName: automation
  relationships:
    - type: cloudify.relationships.depends_on
      target: ami
    - type: cloudify.relationships.depends_on
      target: nic_0
...
file_0:
  type: cloudify.nodes.File
  properties:
    resource_config:
      resource_path: resources/config/file.conf
      file_path: /home/ubuntu/file.conf
      owner: root:root
      mode: 644
  relationships:
    - type: cloudify.relationships.contained_in
      target: vm_0

但是,我一直收到错误消息:

2019-02-20 15:36:59.128  CFY <sbin> 'install' workflow execution failed:   RuntimeError: Workflow failed: Task failed 'cloudify_files.tasks.create' ->   [Errno 1] Operation not permitted: './file.conf'
Execution of workflow install for deployment sbin failed. [error=Traceback (most recent call last):
  File "/opt/mgmtworker/env/lib/python2.7/site-packages/cloudify/dispatch.py", line 571, in _remote_workflow_child_thread
workflow_result = self._execute_workflow_function()
  File "/opt/mgmtworker/env/lib/python2.7/site-packages/cloudify/dispatch.py", line 600, in _execute_workflow_function
result = self.func(*self.args, **self.kwargs)
  File "/opt/mgmtworker/env/lib/python2.7/site-packages/cloudify/plugins/workflows.py", line 30, in install
node_instances=set(ctx.node_instances))
  File "/opt/mgmtworker/env/lib/python2.7/site-packages/cloudify/plugins/lifecycle.py", line 29, in install_node_instances
processor.install()
  File "/opt/mgmtworker/env/lib/python2.7/site-packages/cloudify/plugins/lifecycle.py", line 102, in install
graph.execute()
  File "/opt/mgmtworker/env/lib/python2.7/site-packages/cloudify/workflows/tasks_graph.py", line 237, in execute
raise self._error
RuntimeError: Workflow failed: Task failed 'cloudify_files.tasks.create' -> [Errno 1] Operation not permitted: './file.conf'

我为file_path尝试了一些不同的值:“ / home / ubuntu / file.conf”,“ / tmp / file.conf”和“ ./file.conf”(如错误输出),但每次都会收到相同的权限错误。我也尝试过这种关系:cloudify.relationships.depends_on也没有成功。

我正在通过其Docker映像使用Cloudify Manager 4.5.5。

有人看过这个问题吗?我使用插件不正确吗?这是“最佳实践”还是我应该创建一个已经具有所有必需文件并在AWS上启动了新文件的新VM?

谢谢!

更新 我忘了提及,如果我尝试将文件的所有者设置为ubuntu:ubuntu,则会收到关于找不到用户的错误消息:

2019-02-20 16:19:21.743  CFY <sbin> 'install' workflow execution failed:     RuntimeError: Workflow failed: Task failed 'cloudify_files.tasks.create' -> 'getpwnam(): name not found: ubuntu'
Execution of workflow install for deployment sbin failed. [error=Traceback (most recent call last):
  File "/opt/mgmtworker/env/lib/python2.7/site-packages/cloudify/dispatch.py", line 571, in _remote_workflow_child_thread
workflow_result = self._execute_workflow_function()
  File "/opt/mgmtworker/env/lib/python2.7/site-packages/cloudify/dispatch.py", line 600, in _execute_workflow_function
result = self.func(*self.args, **self.kwargs)
  File "/opt/mgmtworker/env/lib/python2.7/site-packages/cloudify/plugins/workflows.py", line 30, in install
node_instances=set(ctx.node_instances))
  File "/opt/mgmtworker/env/lib/python2.7/site-packages/cloudify/plugins/lifecycle.py", line 29, in install_node_instances
processor.install()
  File "/opt/mgmtworker/env/lib/python2.7/site-packages/cloudify/plugins/lifecycle.py", line 102, in install
graph.execute()
  File "/opt/mgmtworker/env/lib/python2.7/site-packages/cloudify/workflows/tasks_graph.py", line 237, in execute
raise self._error
RuntimeError: Workflow failed: Task failed 'cloudify_files.tasks.create' -> 'getpwnam(): name not found: ubuntu'

VM似乎尚未准备好接收文件(因为它在安装生命周期中失败)。

1 个答案:

答案 0 :(得分:0)

在“ resource_config”块中尝试“ use_sudo:true”。还添加如下接口块: interfaces: cloudify.interfaces.lifecycle: create: executor: host_agent delete: executor: host_agent

如果不覆盖执行程序,它将在管理器上运行(这可能就是为什么您看到“ ubuntu”用户不存在的原因)。