Giter Club home page Giter Club logo

Comments (14)

sersut avatar sersut commented on June 15, 2024

Thanks for the issue @bknowles. Since knife is mostly an interactive tool having a log location for it wasn't at the top of our list. Do you have a scenario for which this is required?

from chef.

bknowles avatar bknowles commented on June 15, 2024

Yup. During a first boot operation of a node that is being bootstrapped, the logs don't get saved anywhere. There are situations where the only time Chef will be run on a node is during that bootstrap, because the node might be relatively ephemeral, or the client might decide that Chef is only used to install the software and not to do long-term maintenance with Chef.

Then there's the factory model, where you bootstrap a new node with a factory role, and then it is responsible for going to bootstrap all the other new nodes that need to be created. In that case, there is no way to pass the log_level or log_location information down from knife into the factory node that is being bootstrapped, or to pass that information down from the factory node to all the other nodes that are going to be bootstrapped.

Log information can be critical. Both log_level and log_location are things that we need to be able to communicate from our Chef workstation through the bootstrap process to the node being created, and through that factory node to all the other nodes that are going to be bootstrapped.

from chef.

sersut avatar sersut commented on June 15, 2024

Excellent thanks for sharing the scenario @bknowles. Definitely a super important scenario. In that case I think we want to have an option in the knife context here:

https://github.com/opscode/chef/blob/master/lib/chef/config.rb#L478-L490

Having a straight knife config options sounds as if we're trying to redirect the output of knife to a log file. Not that above context is used during bootstrap only.

Let me know if more clarification is needed on this.

Thanks for bringing this up.

from chef.

bknowles avatar bknowles commented on June 15, 2024

Okay, sounds like a good idea. Should we call these options "chef_log_level" and "chef_log_location"?

I'm fine with taking the standard defaults of :auto or :info for chef_log_level, and STDOUT for chef_log_location. I just want something that we can easily over-ride and make sure it gets passed all the way down.

from chef.

sersut avatar sersut commented on June 15, 2024

I think log_level and log_location is fine since they will be in in knife config_context.

We should pick the current defaults since we would like to preserve backwards compatibility.

from chef.

bknowles avatar bknowles commented on June 15, 2024

Will do.

from chef.

bknowles avatar bknowles commented on June 15, 2024

I am still working on the specs that need to be modified to suit.

Would you like me to commit and push what I've got so far, so that you can take a look?

from chef.

sersut avatar sersut commented on June 15, 2024

Do you think adding these to knife configure is critical @bknowles? It's somewhat problematic since the bootstrap settings need to be set as below in the config:

knife[:log_location] = "/foo/bar"

I think knife configure is primarily used for the relatively new users where this scenario seems to be somewhat of an advanced scenario. I'm 👍 on adding these options to bootstrap and rendering them on the client.rb prepared on the node that is being bootstrapped but leaning towards 👎 on adding these to knife configure.

Any additional thoughts on this @opscode/client-eng ?

from chef.

bknowles avatar bknowles commented on June 15, 2024

If knife configure is only for new users in setting up their knife.rb the first time, then I would be fine with removing this from that section of the code.

from chef.

bknowles avatar bknowles commented on June 15, 2024

Of course, you have to fix config_content in all the appropriate places, or you have to fix all the bootstrap configurations to be more like archlinux-gems.erb and explicitly specify exactly what all should go into the configuration file.

I'm not sure what the right way is to solve that problem.

from chef.

bknowles avatar bknowles commented on June 15, 2024

And let's not forget commit id 6c9d8c3

from chef.

artemyarulin avatar artemyarulin commented on June 15, 2024

👍 to this feature. I have about the same scenario as @bknowles mentioned but for the windows environments, so let's not forget to change https://github.com/opscode/knife-windows/blob/0aece756377e9c7127818a064113ccbf818eaca2/lib/chef/knife/core/windows_bootstrap_context.rb#L49-L50 as well. So, if you need any assistance on testing for Windows, just let me now, I'll be happy to help.

And just as a side note for anybody wandering how it could be implemented right now, I'm using cusom bootstrap template for Windows with only one change:

> <%= bootstrap_directory %>\client.rb (
 <%= config_content %>

 <%# Additional config overrides -%>
 <%= escape_and_echo('log_location "c:/chef/chef.log"') %>
 <%= escape_and_echo('log_level :debug') %>
)

from chef.

btm avatar btm commented on June 15, 2024

This is fixed in #5502 and chef/knife-windows#407.

The Chef changes are in 12.17.25+, with a stable release targeted for release on Monday. The knife-windows changes will be an upcoming release.

from chef.

btm avatar btm commented on June 15, 2024

chef/knife-windows#407 was released in knife-windows 1.8.0 today.

from chef.

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.