Reputation: 1
I'm attempting to copy a file to a VM using the cloudify.nodes.File
type, but am running into a permission error that I'm having trouble figuring out.
According to the documentation, I should be able to copy a file by using:
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
The relevant portions of my blueprint are:
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
But, I keep receiving the error:
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'
I've tried a few different values for file_path
: "/home/ubuntu/file.conf", "/tmp/file.conf", and "./file.conf" (shown in the error output above), but I receive the same permission error each time. I've also tried the relationship: cloudify.relationships.depends_on
without any success as well.
I'm using Cloudify Manager 4.5.5 via their Docker image.
Has anyone seen this issue? Am I using the plugin incorrectly? And is this "best-practice" or should I create a new VM that already has all of the files necessary and have that spun-up on AWS?
Thanks in advance!
Update
I forgot to mention that if I try to set the owner of the file to ubuntu:ubuntu
, I get an error about the user not being found:
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'
It looks like the VM isn't yet ready to receive the file (since it's failing in the install lifecycle).
Upvotes: 0
Views: 99
Reputation: 1
Try "use_sudo: true" in the "resource_config" block. Also add an interfaces block like this:
interfaces:
cloudify.interfaces.lifecycle:
create:
executor: host_agent
delete:
executor: host_agent
If you don't override the executor, it will run on the manager (which is probably why you see "ubuntu" user not existing).
Upvotes: 0