GithubHelp home page GithubHelp logo

Comments (5)

double-z avatar double-z commented on May 28, 2024

just saw the new connect_to_node method that was just added, would/could this be used to fix this?

1a7b0b3#diff-be5a958b4e4a234b0cef0ff4d6162be5R71

from chef-provisioning.

jkeiser avatar jkeiser commented on May 28, 2024

In general, make_url_available_to_remote is called by setup_convergence. What precisely is failing?

I totally get the intent of your change, and it makes sense to me, but I'm curious exactly what command or recipe you are running to trigger this error.

from chef-provisioning.

double-z avatar double-z commented on May 28, 2024

so to further elaborate.

if i first start chef zero as a daemon like so:
vagrant@master:/vagrant/test$ /opt/chef/bin/chef-zero -H 192.168.33.27 -p 6900 -d

and then run the following recipe:

    require 'chef_metal'
    require 'chef_metal_ssh/ssh_provisioner'
    require 'chef/config'

    with_chef_server "http://192.168.33.27:6900", {
      :client_name => Chef::Config[:node_name],
      :signing_key_filename => Chef::Config[:client_key]
    }

    machine "one" do
      # action :converge
      action :create
      provisioner ChefMetalSsh::SshProvisioner.new
      provisioner_options 'target_ip' => '192.168.33.21',
                          'ssh_user' => 'vagrant',
                          'ssh_options' => {
                            'password' => 'vagrant'
                          }
    end

it creates properly and create action can run over and over.
same with the converge action, it finds the chef_server then converges and can be run over and over.
so this is gtg. no problems.

the issue i'm seeing arises when using with_chef_local_server with the converge action. the create action is fine and can be run repeatedly no prob. converge, not so much.

this is the recipe run here, again no zero server running as a daemon. as such port forwarding to the target is used(for the create action anyway in this case) and required.

    with_chef_local_server :chef_repo_path => "/vagrant/test"

    machine "one" do
      action :create
      converge true  
      provisioner ChefMetalSsh::SshProvisioner.new
      provisioner_options 'target_ip' => '192.168.33.21',
                          'ssh_user' => 'vagrant',
                          'ssh_options' => {
                            'password' => 'vagrant'
                          }
    end

so the above with the create action can be run over and over. use converge true: no problem, forces comverge regardless of if create action up-to-date, client on remote target runs, everybody good.

if however, after the machine is created with the create action, the action is switched from create to converge, it blows up. with the patches referenced above - which essentially at the end of the day fires the transport/ssh make_url_available_to_remote method - this error does not occur, and converge action runs happily.

so, changing the recipe to this:

    with_chef_local_server :chef_repo_path => "/vagrant/test"

    machine "one" do
      action :converge
      provisioner ChefMetalSsh::SshProvisioner.new
      provisioner_options 'target_ip' => '192.168.33.21',
                          'ssh_user' => 'vagrant',
                          'ssh_options' => {
                            'password' => 'vagrant'
                          }
    end

with the patch is cool, without results in this error:

    Starting Chef Client, version 11.12.2
    [2014-04-10T07:21:13+00:00] WARN: Run List override has been provided.
    [2014-04-10T07:21:13+00:00] WARN: Original Run List: []
    [2014-04-10T07:21:13+00:00] WARN: Overridden Run List: [recipe[ssh_test::both]]
    resolving cookbooks for run list: ["ssh_test::both"]
    Synchronizing Cookbooks:
      - ssh_test
    Compiling Cookbooks...
    Converging 1 resources
    Recipe: ssh_test::both
      * machine[one] action converge[2014-04-10T07:21:14+00:00] WARN: 
    * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
    SSL validation of HTTPS requests is disabled. HTTPS connections are still
    encrypted, but chef is not able to detect forged replies or man in the middle
    attacks.

    To fix this issue add an entry like this to your configuration file:

    ```
      # Verify all HTTPS connections (recommended)
      ssl_verify_mode :verify_peer

      # OR, Verify only connections to chef-server
      verify_api_cert true
    ```

    To check your SSL configuration, or troubleshoot errors, you can use the
    `knife ssl check` command like so:

    ```
      knife ssl check -c /etc/chef/client.rb
    ```

    * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 

    Starting Chef Client, version 11.12.2
    [2014-04-10T07:21:16+00:00] ERROR: Connection refused connecting to http://127.0.0.1:8900/nodes/one, retry 1/5
    [2014-04-10T07:21:21+00:00] ERROR: Connection refused connecting to http://127.0.0.1:8900/nodes/one, retry 2/5
    [2014-04-10T07:21:26+00:00] ERROR: Connection refused connecting to http://127.0.0.1:8900/nodes/one, retry 3/5
    [2014-04-10T07:21:31+00:00] ERROR: Connection refused connecting to http://127.0.0.1:8900/nodes/one, retry 4/5
    [2014-04-10T07:21:36+00:00] ERROR: Connection refused connecting to http://127.0.0.1:8900/nodes/one, retry 5/5

    ================================================================================
    Chef encountered an error attempting to load the node data for "one"
    ================================================================================


    Networking Error:
    -----------------
    Connection refused - Connection refused connecting to http://127.0.0.1:8900/nodes/one, giving up

    Your chef_server_url may be misconfigured, or the network could be down.



    Relevant Config Settings:
    -------------------------
    chef_server_url  "http://127.0.0.1:8900"



    [2014-04-10T07:21:41+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
    Chef Client failed. 0 resources updated in 26.971889762 seconds
    [2014-04-10T07:21:41+00:00] ERROR: Connection refused - Connection refused connecting to http://127.0.0.1:8900/nodes/one, giving up
    [2014-04-10T07:21:41+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

    ================================================================================
    Error executing action `converge` on resource 'machine[one]'
    ================================================================================


    RuntimeError
    ------------
    Error: command 'chef-client -l auto' exited with code 1.



    Resource Declaration:
    ---------------------
    # In /home/vagrant/.chef/local-mode-cache/cache/cookbooks/ssh_test/recipes/both.rb

     12: machine "one" do
     13:   action :converge
     14:   # action :create
     15:   # converge true
     16:   provisioner ChefMetalSsh::SshProvisioner.new
     17:   provisioner_options 'target_ip' => '192.168.33.21',
     18:                       'ssh_user' => 'vagrant',
     19:                       'ssh_options' => {
     20:                         'password' => 'vagrant'
     21:                       }
     22: end
     23: 



    Compiled Resource:
    ------------------
    # Declared in /home/vagrant/.chef/local-mode-cache/cache/cookbooks/ssh_test/recipes/both.rb:12:in `from_file'

    machine("one") do
      action [:converge]
      retries 0
      retry_delay 2
      guard_interpreter :default
      chef_server {:chef_server_url=>"http://127.0.0.1:8900", :options=>{}}
      provisioner #<ChefMetalSsh::SshProvisioner:0x000000026b20b8 @target_host="192.168.33.21", @convergence_strategy=#<ChefMetal::ConvergenceStrategy::InstallCached:0x000000021d0ba8 @client_rb_path="/etc/chef/client.rb", @client_pem_path="/etc/chef/client.pem", @chef_version=nil, @prerelease=nil, @package_cache_path="/home/vagrant/.chef/package_cache", @package_cache={}, @tmp_dir="/tmp", @package_cache_lock=#<Mutex:0x000000022a2c70>>>
      provisioner_options {"target_ip"=>"192.168.33.21", "ssh_user"=>"vagrant", "ssh_options"=>{"password"=>"vagrant"}}
      cookbook_name "ssh_test"
      recipe_name "both"
    end




    Running handlers:
    [2014-04-10T07:21:41+00:00] ERROR: Running exception handlers
    Running handlers complete

    [2014-04-10T07:21:41+00:00] ERROR: Exception handlers complete
    [2014-04-10T07:21:41+00:00] FATAL: Stacktrace dumped to /home/vagrant/.chef/local-mode-cache/cache/chef-stacktrace.out
    Chef Client failed. 0 resources updated in 30.451601391 seconds
    [2014-04-10T07:21:41+00:00] ERROR: machine[one] (ssh_test::both line 12) had an error: RuntimeError: Error: command 'chef-client -l auto' exited with code 1.

    [2014-04-10T07:21:41+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
    vagrant@master:/vagrant/test$ 

hope this helps

from chef-provisioning.

jkeiser avatar jkeiser commented on May 28, 2024

Ah, the converge action! Got it, thanks. That's what I needed to know. I'm bummed about the need to add a parameter to converge, though I understand why we have to. I'll either merge this or make it so we can just pass the chef_server object directly (which would be less onerous and allow the metal command line to still work).

from chef-provisioning.

double-z avatar double-z commented on May 28, 2024

cool cool, glad that helped. the way i did it was just to get it to 'work', your solution sounds mo prudent.

from chef-provisioning.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.