How to combine a different provider with the Chef deploy resource?

185 views Asked by At

I am trying to create a recipe to deploy an application.

I would like to combine the Chef deploy resource with the Chef Mercurial provider. The readme of this provider suggest that it is easy to use with deploy resource. However, I'm not sure how to do this.

The mercurial resource is working as expected:

  mercurial deploy[:deploy_to] do
    repository deploy[:scm][:repository]
    ssh_key "/home/vagrant/.ssh/authorized_keys"
    ssh_ignore true
    branch true
    revision deploy[:scm][:revision]
    user deploy[:user]
    group deploy[:group]
    action :sync
  end

However I'm having trouble with the provider

  deploy deploy[:deploy_to] do
    repository deploy[:scm][:repository]
    user deploy[:user]
    group deploy[:group]
    revision deploy[:scm][:revision]
    environment deploy[:environment].to_hash
    scm_provider Chef::Provider::Mercurial
    action :deploy
  end

The error I'm getting is NoMethodError: undefined method 'ssh_key' for Chef::Resource::Deploy. This is probably due to the fact that the resource requires the ssh_key attribute. I don't know how to pass this attribute through when using the deploy resource.

How can I make this work? Does anyone have an example of how to use the Chef deploy resource with the Chef Mercurial provider?

0

There are 0 answers