sous-chefs / consul

Development repository for the consul cookbook

Home Page:https://supermarket.chef.io/cookbooks/consul

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

consul 3.1.0 issue when testing with hashicorp-vault 3.0.0 git code

knightorc opened this issue · comments

I'm investigating this issue.

Testing pre release hashicorp-vault and I'm seeing it mucking with consul, 3.0.0 and 3.1.0

libraries/consul_service_windows.rb line 49)

      [execute] 'consul.exe' is not recognized as an internal or external command,
                operable program or batch file.

      ================================================================================
      Error executing action `run` on resource 'execute[Reload consul]'
      ================================================================================

      Mixlib::ShellOut::ShellCommandFailed
      ------------------------------------
      Expected process to exit with [0], but received '1'
      ---- Begin output of consul.exe reload ----
      STDOUT:
      STDERR: 'consul.exe' is not recognized as an internal or external command,
      operable program or batch file.
      ---- End output of consul.exe reload ----
      Ran consul.exe reload returned 1

      Cookbook Trace:
      ---------------
      C:/chef/cache/cookbooks/poise/files/halite_gem/poise/helpers/notifying_block.rb:69:in `notifying_block'
      C:/chef/cache/cookbooks/consul/libraries/consul_service_windows.rb:48:in `action_reload'

      Resource Declaration:
      ---------------------
      # In C:/chef/cache/cookbooks/consul/libraries/consul_service_windows.rb

       49:           execute 'Reload consul' do
       50:             command 'consul.exe reload' + (new_resource.acl_token ? " -token=#{new_resource.acl_token}" : '')
       51:             cwd ::File.dirname(new_resource.program)
       52:             action :run
       53:           end
       54:         end

      Compiled Resource:
      ------------------
      # Declared in C:/chef/cache/cookbooks/consul/libraries/consul_service_windows.rb:49:in `block in action_reload'

      execute("Reload consul") do
        action [:run]
        default_guard_interpreter :execute
        command "consul.exe reload"
        backup 5
        cwd "C:\\Program Files\\vault\\0.8.4"
        returns 0
        user nil
        declared_type :execute
        cookbook_name "consul"
        domain nil
      end

      System Info:
      ------------
      chef_version=13.9.1
      platform=windows
      platform_version=6.1.7601
      ruby=ruby 2.4.3p205 (2017-12-14 revision 61247) [x64-mingw32]
      program_name=c:/opscode/chef/embedded/bin/chef-client
      executable=c:/opscode/chef/embedded/bin/chef-client

Specifically noticed this cwd "C:\\Program Files\\vault\\0.8.4" which was weird. should be consul not vault

This is being polluted cwd ::File.dirname(new_resource.program)

Both cookbooks have in their helper.rb library ( I believe this is where the issue stems from)

consul

    def config_prefix_path
      windows? ? join_path(program_files, 'consul') : join_path('/etc', 'consul')
    end

...

Chef::Node.send(:include, ConsulCookbook::Helpers)

hashicorp-vault

    def config_prefix_path
      windows? ? join_path(program_files, 'vault') : join_path('/etc', 'vault')
    end

...

Chef::Node.send(:include, VaultCookbook::Helpers)

Offending Node.send lines....

I'll look at how difficult it would be to switch it to

extend VaultCookbook::Helpers
or
extend ConsulCookbook::Helpers

and remove the Chef::Node.send

where necessary and possibly submit a PR for you consideration.

Closed via #500

if this is incorrecrt pleas reopen

commented

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.