Dan,
The behavior difference makes sense to me.
package 'tmux', when not installed, should install the latest available
package, similar to the file resource - populate with the latest available
content.
Adding modifiers to constrain the behavior, such as version and
create_if_missing, extend the behavior to a subset/specific set of rules.
Etsy had blogged about using package resources with upgrade taking down a
significant set of their code, not using the base install method, and
devised some foodcritic rules to help them prevent hitting that problem
again - by ensuring not using the upgrade action, and requiring use of a
version variable to prevent version mismatch.
I think the current behavior works, possibly needs some better
documentation for newcomers, but other than that I believe it to be simple
and concise.
-M
On Wed, Oct 2, 2013 at 3:56 PM, Daniel DeLeo dan@kallistec.com wrote:
On Wednesday, October 2, 2013 at 12:33 PM, Brian Hatfield wrote:
No. I strongly object to this.
action :upgrade exists and is sufficient.
The question isn't whether action :install and action :upgrade should
exist or have different behavior, but rather one of what default is most
desirable given the tradeoffs of each. By comparison, the default action on
a file is "create" which really means "create_or_update"; you can use
action :create_if_missing if you want to avoid updating the files.
If action :install performed upgrades, it would absolutely destroy things,
for example running MongoDB using the 10gen repos and having a 2.2 database
upgrade to 2.4 behind your back, etc.
The reason we bring this up is the flip side of this coin. If the package
in your repo gets updated, then a new machine you bring up with the same
recipes will create a different system than your machines you provisioned
before the repo update. This seems surprising, no?
So the question is one of
-
user expectations: What should package "tmux"
do when there's a newer
version available?
-
consistency: Is it weird/confusing that files get updated by default,
but packages do not? Is it confusing that this default behavior means you
can build a box with the exact same recipes and get a different result?
-
pragmatic reason to be inconsistent: the risk of upgrading packages by
default is so great that it's better if everyone using Chef learns that
this is inconsistent, and why, and how to deal with it.
Thoughts?
Brian
--
Daniel DeLeo