-
Notifications
You must be signed in to change notification settings - Fork 116
fix for td-agent v4 #155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
fix for td-agent v4 #155
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,6 +25,9 @@ class Package | |
| class TdRubygems < Chef::Provider::Package::Rubygems | ||
|
|
||
| class TdGemEnvironment < AlternateGemEnvironment | ||
| def rubygems_version | ||
| Gem::VERSION | ||
| end | ||
| end | ||
|
|
||
| def initialize(new_resource, run_context = nil) | ||
|
|
@@ -40,6 +43,39 @@ def td_plugin_name | |
| "fluent-plugin-#{@new_resource.package_name}" | ||
| end | ||
|
|
||
| def rubygems_version | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we don't have to have this method definition if we use
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not expert, maybe for the same reason because in old chef version doesn't exists? but i'm opened to changes |
||
| shell_out!("#{gem_binary_path} --version").stdout.chomp | ||
| end | ||
|
|
||
| def install_via_gem_command(name, version) | ||
| Chef::Log.debug("Using #{rdoc_string}") | ||
| if @new_resource.source =~ /\.gem$/i | ||
| name = @new_resource.source | ||
| elsif @new_resource.clear_sources | ||
| src = " --clear-sources" | ||
| src << (@new_resource.source && " --source=#{@new_resource.source}" || "") | ||
| else | ||
| src = @new_resource.source && " --source=#{@new_resource.source} --source=#{Chef::Config[:rubygems_url]}" | ||
| end | ||
| if !version.nil? && version.length > 0 | ||
| shell_out_with_timeout!("#{gem_binary_path} install #{name} -q #{rdoc_string} -v \"#{version}\"#{src}#{opts}", :env => nil) | ||
| else | ||
| shell_out_with_timeout!("#{gem_binary_path} install \"#{name}\" -q #{rdoc_string} #{src}#{opts}", :env => nil) | ||
| end | ||
| end | ||
|
|
||
| def rdoc_string | ||
| if needs_nodocument? | ||
| "--no-document" | ||
| else | ||
| "--no-rdoc --no-ri" | ||
| end | ||
| end | ||
|
|
||
| def needs_nodocument? | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is your intention to override
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same reason this doesn't exists on chef 12/13 |
||
| Gem::Requirement.new(">= 3.0.0.beta1").satisfied_by?(Gem::Version.new(rubygems_version)) | ||
| end | ||
|
|
||
| def td_gem_binary_path | ||
| if major && major != '1' | ||
| # td-agent 2.x or later works with /opt | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get your intention to override the inherited
rubygems_versionhere 🤔https://github.com/chef/chef/blob/3f35e622fd9fc612bff3e5403e737f012aa9bd66/lib/chef/provider/package/rubygems.rb#L304-L306
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because in chef12 doesn't exists (still used by AWS Opsworks service)