Comments (10)
@wrightp it looks like we're getting scalars or arrays of scalars back from the mixlib-install API here, depending on conditions, which should probably be fixed in mixlib-install so it returns either an array or a scalar?
from chef_client_updater.
#artifact_info
will return a scalar if an exact artifact is found based on the query. If multiple artifacts match the query it will return an array of scalars for all matching artifacts. The team has had several discussions on whether to always return an array or to behave as it does now. If you have input please share.
from chef_client_updater.
it should be always array.
i'd actually state more strongly that ruby return types should be considered like the /should/ be strongly typed so they're predictable. also some of the positively worst bugs i've seen in the chef client codebase have come from having instance variables like @url
duck-typing and being settable to either a String or a URI -- which is slick and works fine until it all goes horribly wrong and become nearly impossible for smart people to reason about the behavior. i'm actually somewhat skeptical as well about automatic coercion on the input side of methods, and the stuff like #to_s
'ing an input parameter so you can use strings, or symbols or anything that stringifies is convenient but also can be very annoying down the road. sometimes its better to be strict and only accept one or the other and force the caller to do the explicit coercion (its possible that most of the time i've seen that go badly is the prior example where state gets stored which can be symbol, a string, or any other object that #to_s
es without explicit coercion and then down the road you buy yourself a heap of pain when someone feeds you a String when conventionally everyone has been using symbols and some consumer of the state explodes because you didn't understand the contract on the state was so loose).
TL;DR: strongly typed languages have some very good points.
from chef_client_updater.
Thanks. I concur. I'll propose this for 4.0.
from chef_client_updater.
its easy enough to coerce it to an array here as well, so i can fix this bug and get this issue closed
from chef_client_updater.
so @wrightp do i want .first or .last? i'm assuming .first?
Mixlib::Versioning.parse(Array.new(mixlib_install.artifact_info).first.version)
from chef_client_updater.
I have always used first in this case. All artifacts will be of the same version
from chef_client_updater.
ah i get it, cool.
from chef_client_updater.
To elaborate... The scalar value will be returned based on platform, platform version, architecture, product, product version, channel. The array will return all available platform permutations of channel, product, product versions if no platform information is provided to the constructor.
from chef_client_updater.
@lamont-granquist Is 3.x going to be released soon with this fix in it?
from chef_client_updater.
Related Issues (20)
- No checksum validation of handle.zip
- The PowerShell to reschedule the upgrade does not work (Windows) HOT 2
- "cannot load such file -- highline" after upgraded. HOT 8
- Direct Download - Unable to contain self signed certificate
- Require Chef Infra Client 12.5+
- Remove support for ChefDK
- Move the upgrade logic outside of Chef
- Chef client update fails on windows 7 citrix VDIs
- Cookbook removes scheduled task HOT 5
- Chef upgrade failing in windows10 version 2004 and later
- Cookbook hangs when upgrading on Solaris HOT 1
- Assumes `C:\opscode` exists HOT 1
- Calls mixlib-install even when `download_url_override` is set HOT 1
- Create Tag 3.12 HOT 4
- Deprecation warning for `unified_mode` HOT 2
- Latest release contains mac underscore files HOT 3
- The exec_command value cannot be overridden HOT 1
- Provide basic authentication when using download_url_override?
- Restart chef-client.service after upgrade
- product_name does not allow 'cinc' HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chef_client_updater.