Skip to content
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

Add apt_repository resource #4782

Merged
merged 1 commit into from
Apr 9, 2016
Merged

Add apt_repository resource #4782

merged 1 commit into from
Apr 9, 2016

Conversation

thommay
Copy link
Contributor

@thommay thommay commented Apr 1, 2016

🚧 needs more tests, but basic review appreciated 🚧

end

action :add do
converge_by "add apt repository for #{new_resource.name}" do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This means this resource will always be marked as updated which doesn't seem right?

@thommay thommay force-pushed the tm/apt_repository branch 5 times, most recently from b2c06ed to da230d2 Compare April 5, 2016 21:37
@thommay
Copy link
Contributor Author

thommay commented Apr 5, 2016

@chef/client-core ready for review…

resource_name :apt_repository
provides :apt_repository

property :repo_name, String, name_property: true, regex: [/^([a-z]|[A-Z]|[0-9]|_|-|\.)+$/]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this smells a bit like another brittle regex?

@lamont-granquist
Copy link
Contributor

looks like you addressed sous-chefs/apt#191 ?

end

def extract_fingerprints_from_cmd(cmd)
so = Mixlib::ShellOut.new(cmd, env: { "LANG" => "en_US", "LANGUAGE" => "en_US" })
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not entirely clear why you're going to Mixlib::ShellOut here instead of shell_out()?

@thommay
Copy link
Contributor Author

thommay commented Apr 8, 2016

it should fix sous-chefs/apt#191 ; sous-chefs/apt#192 ; sous-chefs/apt#200 at least. But I don't want to actually close them until i port this code back to the cookbook.

@lamont-granquist
Copy link
Contributor

just a couple of questions, but 👍 overall

end

def extract_fingerprints_from_cmd(cmd)
so = shell_out(cmd, env: { "LANG" => "en_US", "LANGUAGE" => "en_US" })
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think you can actually drop the lang stuff since this code should have you completely covered:

https://github.com/chef/chef/blob/master/chef-config/lib/chef-config/config.rb#L872-L922

including handling the case of servers that have no en_US.utf-8 or C.utf-8 support and falls back to C and yells at the user:

https://github.com/chef/chef/blob/master/chef-config/lib/chef-config/config.rb#L911

More or less stolen from the apt cookbook, but tweaked and fixes a heap
of bugs.
@thommay thommay merged commit 82811df into master Apr 9, 2016

property :repo_name, String, name_property: true
property :uri, String
property :distribution, String, default: lazy { node["lsb"]["codename"] }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love that this was added to core Chef, but...

@thommay Having this as a default is not a good idea because some Apt repos do not use a distribution and having this here makes it impossible to use those things. Also, it is a different behavior than the existing apt cookbook, which causes it to break backwards compatibility.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i belive this property is nillable so its not impossible?

(i admit i can't recall where we wound up with nillable properties in chef-12... its a bit difficult to keep straight...)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixing here: #4832

@chef chef locked and limited conversation to collaborators Nov 16, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Type: Enhancement Adds new functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants