1

I am trying to use cloudify fabric plugin to run a simple command. When I install the blueprint I am getting following error.

Task failed 'fabric_plugin.tasks.run_commands' -> RecoverableError('FabricTaskError: Needed to prompt for a connection or sudo password (host: 10.10.1.10), but abort-on-prompts was set to True',)

Below is my entire blueprint file.

tosca_definitions_version: cloudify_dsl_1_0

imports:  
  - http://www.getcloudify.org/spec/cloudify/3.2/types.yaml
  - http://www.getcloudify.org/spec/fabric-plugin/1.2/plugin.yaml

inputs:

  host_ip:
      description: >
        The ip of the host the application will be deployed on

  agent_user:
      description: >
        Agent User.

  agent_private_key_path:
      description: >
        agent key path        

node_templates:

  host:
      type: cloudify.nodes.Compute
      properties:
        ip: { get_input: host_ip }
        install_agent:
          default: false
        cloudify_agent:
          user: { get_input: agent_user }
          key: { get_input: agent_private_key_path }

  example_node:
    type: cloudify.nodes.WebServer
    interfaces:
      cloudify.interfaces.lifecycle:
          start:
            implementation: fabric.fabric_plugin.tasks.run_commands
            inputs:
              commands:
                - ls -lh > ~/list-of-files.txt
    relationships:
    - type: cloudify.relationships.contained_in
      target: host

My inputs.yaml is

agent_private_key_path: /root/.ssh/id_rsa
agent_user: vagrant
host_ip: 10.10.1.10

When I update my blueprint to use following then it works. But is this necessary? I mean this information is already specified in the host. Why do I need to give it again with the fabric plugin.

     fabric_env:
        host_string: { get_input: host_ip }
        user: { get_input: agent_user }
        key_filename: { get_input: agent_private_key_path }

Is there anything I am doing wrong. I am just the beginner in this area, so any help will be appreciated.

yetanothercoder
  • 385
  • 2
  • 6
  • 15

1 Answers1

0

Fabric can fail due to many reasons, like missing key file, or wrong key file... generally speaking, you'll be seeing this kind of errors when there are issues SSHing into the application VMs , where the authentication using the private keypair fails (because its missing or because its a wrong one), in which case there will be a fallback to user/password authentication.

I can't give a more detailed answer without information regarding which Cloudify version you have installed and OS (Ubuntu, Centos, etc).

  • I am using cloudify 3.2 GA and Ubuntu OS. Blueprint does work when I give the i/p details to the fabric plugin. But not when it is just specified in the host. see I have updated my question with the new findings. – yetanothercoder Jul 16 '15 at 10:13
  • The fabric plugin uses a [credentials handler](https://github.com/cloudify-cosmo/cloudify-fabric-plugin/blob/1.2/fabric_plugin/tasks.py#L282) to determine what values to pass to hosts during SSH authentication. If you don't provide a fabric_env, then for the user it looks in the bootstrap context, or for the key it looks in the bootstrap context or an environment variable. It could be that one of these locations points to a value that is different than the one you are injecting in the fabric_env, for example, an authorized_keys file that has been changed. – earthmant Jul 16 '15 at 10:54