class Chef
DEPRECATION NOTE
This code will be removed in Chef 13 in favor of the code in Chef::ApiClientV1, which will be moved to this namespace. New development should occur in Chef::ApiClientV1 until the time before Chef 13.
COMPATIBILITY NOTE
This ApiClientV1 code attempts to make API V1 requests and falls back to API V0 requests when it fails. New development should occur here instead of Chef::ApiClient as this will replace that namespace when Chef 13 is released.
If you need to default to API V0 behavior (i.e. you need GET client to return a public key, etc), please use Chef::ApiClient and update your code to support API V1 before you pull in Chef 13.
- Author
-
Steven Murawski (<smurawski@chef.io>)
- Copyright
-
Copyright 2016, Chef Software, Inc.
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
ChefFS was designed to be a near-1:1 translation between Chef server endpoints and local data, so that it could be used for:
-
User editing, diffing and viewing of server content locally
-
knife download, upload and diff (supporting the above scenario)
-
chef-client -z (serving user repository directly)
This is the translation between chef-zero data stores (which correspond closely to server endpoints) and the ChefFS repository format.
|———————————–|———————————–| | chef-zero DataStore | ChefFS (repository) | |———————————–|———————————–| | <root> | org.json | | association_requests/NAME | invitations.json | | clients/NAME | clients/NAME.json | | cookbooks/NAME/VERSION | cookbooks/NAME/metadata.rb | | containers/NAME | containers/NAME.json | | data/BAG/ITEM | data_bags/BAG/ITEM.json | | environments/NAME | environments/NAME.json | | groups/NAME | groups/NAME.json | | nodes/NAME | nodes/NAME.json | | policies/NAME/REVISION | policies/NAME-REVISION.json | | policy_groups/NAME/policies/PNAME | policy_groups/NAME.json | | roles/NAME | roles/NAME.json | | sandboxes/ID | <not stored on disk, just memory> | | users/NAME | members.json | | file_store/COOKBOOK/VERSION/PATH | cookbooks/COOKBOOK/PATH | | **/_acl | acls/**.json | |———————————–|———————————–|
## The Code
There are two main entry points to ChefFS:
-
ChefServerRootDir represents the chef server (under an org) and surfaces a filesystem-like interface (FSBaseObject / FSBaseDir) that maps the REST API to the same format as you would have on disk.
-
ChefRepositoryFileSystemRootDir represents the local repository where you put your cookbooks, roles, policies, etc.
Because these two map to a common directory structure, diff, upload, download, and other filesystem operations, can easily be done in a generic manner.
These are instantiated by Chef::ChefFS::Config's `chef_fs` and `local_fs` methods.
- Author
-
Thom May (<thom@chef.io>)
- Copyright
-
Copyright 2012-2016, Chef Software Inc.
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- Author
-
John Keiser <jkeiser@chef.io>
- Copyright
-
Copyright 2015-2017, Chef Software Inc.
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- Author
-
Christopher Walters (<cw@chef.io>)
- Author
-
Tim Hinderliter (<tim@chef.io>)
- Copyright
-
Copyright 2010-2016, Chef Software Inc.
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
CookbookLoader class loads the cookbooks lazily as read
- Author
-
Adam Leff (<adamleff@chef.io)
- Author
-
Ryan Cragun (<ryan@chef.io>)
- Copyright
-
Copyright 2012-2016, Chef Software Inc.
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- Author
-
John Keiser <jkeiser@chef.io>
- Copyright
-
Copyright 2015-2016, Chef Software Inc.
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Structured deprecations have a unique URL associated with them, which must exist before the deprecation is merged.
- Author
-
Serdar Sutay (<serdar@chef.io>)
- Copyright
-
Copyright 2013-2016, Chef Software Inc.
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- Author
-
John Keiser (<jkeiser@chef.io>)
- Copyright
-
Copyright 2015-2016, Chef Software Inc.
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- Author
-
John Keiser (<jkeiser@chef.io>)
- Copyright
-
Copyright 2015-2016, Chef Software Inc.
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- Author
-
Adam Jacob (<adam@chef.io>)
- Copyright
-
Copyright 2008-2018, Chef Software Inc.
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Helper functions to access the windows registry from within recipes and the not_if/only_if blocks in resources. This only exposes the methods in the chef/win32/registry class which are reasonably side-effect-free. The actual modification of the registry should be done via the registry_key resource in a more idempotent way.
- Author
-
Lamont Granquist (<lamont@chef.io>)
- Copyright
-
Copyright 2013-2016, Chef Software Inc.
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
PURPOSE: This strategy preserves the inode, and will preserve modes + ownership
even if the user running chef cannot create that ownership (but has rights to the file). It is vulnerable to crashes in the middle of writing the file which could result in corruption or zero-length files.
- Author
-
Lamont Granquist (<lamont@chef.io>)
- Copyright
-
Copyright 2013-2016, Chef Software Inc.
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- Author
-
Daniel DeLeo (<dan@chef.io>)
- Copyright
-
Copyright 2011-2016, Chef Software, Inc.
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- Author
-
Stephen Delano (<stephen@chef.io>)
- Copyright
-
Copyright 2010-2016, Chef Software Inc.
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- Author
-
Tyler Cloke (<tyler@chef.io>)
- Copyright
-
Copyright 2015-2016, Chef Software, Inc.
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- Author
-
Tyler Cloke (<tyler@chef.io>)
- Copyright
-
Copyright 2015-2016, Chef Software, Inc.
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- Author
-
Tyler Cloke (<tyler@chef.io>)
- Copyright
-
Copyright 2015-2016, Chef Software, Inc.
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
DEPRECATION NOTE This code only remains to support users still operating with Open Source Chef Server 11 and should be removed once support for OSC 11 ends. New development should occur in user_create.rb.
DEPRECATION NOTE This code only remains to support users still operating with Open Source Chef Server 11 and should be removed once support for OSC 11 ends. New development should occur in the user_delete.rb.
DEPRECATION NOTE This code only remains to support users still operating with Open Source Chef Server 11 and should be removed once support for OSC 11 ends. New development should occur in user_edit.rb.
DEPRECATION NOTE This code only remains to support users still operating with Open Source Chef Server 11 and should be removed once support for OSC 11 ends. New development should occur in user_list.rb.
DEPRECATION NOTE This code only remains to support users still operating with Open Source Chef Server 11 and should be removed once support for OSC 11 ends. New development should occur in user_reregister.rb.
DEPRECATION NOTE This code only remains to support users still operating with Open Source Chef Server 11 and should be removed once support for OSC 11 ends. New development should occur in user_show.rb.
NOTE: only knife user command that is backwards compatible with OSC 11, so no deprecation warnings are necessary.
- Author
-
Tyler Cloke (tyler@chef.io)
- Copyright
-
Copyright 2015-2016, Chef Software, Inc.
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- Author
-
Adam Jacob (<adam@chef.io>)
- Author
-
Christopher Walters (<cw@chef.io>)
- Copyright
-
Copyright 2008-2016, Chef Software Inc.
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- Author
-
Adam Jacob (<adam@chef.io>)
- Copyright
-
Copyright 2008-2016, Chef Software Inc.
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- Author
-
Adam Jacob (<adam@chef.io>)
- Author
-
Steve Midgley (www.misuse.org/science)
- Copyright
-
Copyright 2009-2016, Chef Software Inc.
- Copyright
-
Copyright 2008-2016, Steve Midgley
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- Author
-
Daniel DeLeo (<dan@chef.io>)
- Copyright
-
Copyright 2010-2016, Chef Software Inc.
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
This is lifted from rails activesupport (note the copyright above): github.com/rails/rails/blob/9f84e60ac9d7bf07d6ae1bc94f3941f5b8f1a228/activesupport/lib/active_support/descendants_tracker.rb
- Author
-
Mark Mzyk <mmzyk@chef.io>
- Author
-
Seth Chisamore <schisamo@chef.io>
- Author
-
Bryan McLellan <btm@chef.io>
- Copyright
-
Copyright 2011-2016, Chef Software, Inc.
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- Author
-
Adam Jacob (<adam@chef.io>)
- Author
-
Christopher Walters (<cw@chef.io>)
- Copyright
-
Copyright 2008-2016, Chef Software Inc.
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
mixin to make this syntax work without specifying a source:
gem_package “/tmp/foo-x.y.z.gem” rpm_package “/tmp/foo-x.y-z.rpm” dpkg_package “/tmp/foo-x.y.z.deb”
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- Author
-
Seth Chisamore (<schisamo@chef.io>)
- Copyright
-
Copyright 2011-2017, Chef Software Inc.
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
The powershell_exec mixin provides in-process access to PowerShell engine via a COM interop (installed by the Chef Client installer).
powershell_exec returns a Chef::PowerShell object that provides 3 methods:
.result - returns a hash representing the results returned by executing the
PowerShell script block
.errors - this is an array of string containing any messages written to the
PowerShell error stream during execution
.error? - returns true if there were error messages written to the PowerShell
error stream during execution
Some examples of usage:
> powershell_exec(“(Get-Item c:\windows\system32\w32time.dll).VersionInfo”
).result["FileVersion"] => "10.0.14393.0 (rs1_release.160715-1616)"
> powershell_exec(“(get-process ruby).Mainmodule”).result
=> C:\\opscode\\chef\\embedded\\bin\\ruby.exe"
> powershell_exec(“$a = $true; $a”).result
=> true
> powershell_exec(“not-found”).errors
=> ["ObjectNotFound: (not-found:String) [], CommandNotFoundException: The term 'not-found' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. (at <ScriptBlock>, <No file>: line 1)"]
> powershell_exec(“not-found”).error?
=> true
> powershell_exec(“get-item c:\notfound -erroraction stop”) WIN32OLERuntimeError: (in OLE method `ExecuteScript': )
OLE error code:80131501 in System.Management.Automation The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Cannot find path 'C:\notfound' because it does not exist.
*Why use this and not powershell_out?* Startup time to invoke the PowerShell engine is much faster (over 7X faster in tests) than writing the PowerShell to disk, shelling out to powershell.exe and retrieving the .stdout or .stderr methods afterwards. Additionally we are able to have a higher fidelity conversation with PowerShell because we are now working with the objects that are returned by the script, rather than having to parse the stdout of powershell.exe to get a result.
*How does this work?* In .NET terms, when you run a PowerShell script block through the engine, behind the scenes you get a Collection<PSObject> returned and simply we are serializing this, adding any errors that were generated to a custom JSON string transferred in memory to Ruby. The easiest way to develop for this approach is to imagine that the last thing that happens in your PowerShell script block is “ConvertTo-Json”. That's exactly what we are doing here behind the scenes.
There are a handful of current limitations with this approach:
-
Windows UAC elevation is controlled by the token assigned to the account that Ruby.exe is running under.
-
Terminating errors will result in a WIN32OLERuntimeError and typically are handled as an exception.
-
There are no return/error codes, as we are not shelling out to powershell.exe but calling a method inline, no errors codes are returned.
-
There is no settable timeout on powershell_exec method execution.
-
It is not possible to impersonate another user running powershell, the credentials of the user running Chef Client are used.
- Author
-
Adam Edwards (<adamed@chef.io>)
- Author
-
Jay Mundrawala (<jdm@chef.io>)
- Copyright
-
Copyright 2015-2016, Chef Software, Inc.
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- Author
-
Seth Chisamore (<schisamo@chef.io>)
- Copyright
-
Copyright 2011-2016, Chef Software Inc.
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- Author
-
Adam Jacob (<adam@chef.io>)
- Copyright
-
Copyright 2008-2016, Chef Software, Inc.
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- Author
-
Jay Mundrawala (<jdm@chef.io>)
- Copyright
-
Copyright 2015-2016, Chef Software
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- Author
-
Dan DeLeo ( <dan@chef.io> )
- Author
-
Marc Paradise ( <marc@chef.io> )
- Copyright
-
Copyright 2012-2016, Chef Software, Inc.
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- Author
-
Jay Mundrawala(<jdm@chef.io>)
- Copyright
-
Copyright 2015-2016, Chef Software
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
example of a NodeMap entry for the user resource (as typed on the DSL):
:user=> [{:klass=>Chef::Resource::User::AixUser, :os=>"aix"}, {:klass=>Chef::Resource::User::DsclUser, :os=>"darwin"}, {:klass=>Chef::Resource::User::PwUser, :os=>"freebsd"}, {:klass=>Chef::Resource::User::LinuxUser, :os=>"linux"}, {:klass=>Chef::Resource::User::SolarisUser, :os=>["omnios", "solaris2"]}, {:klass=>Chef::Resource::User::WindowsUser, :os=>"windows"}],
the entries in the array are pre-sorted into priority order (blocks/platform_version/platform/platform_family/os/none) so that the first entry's :klass that matches the filter is returned when doing a get.
note that as this examples show filter values may be a scalar string or an array of scalar strings.
XXX: confusingly, in the *_priority_map the :klass may be an array of Strings of class names
- Author
-
Daniel DeLeo (<dan@chef.io>)
- Copyright
-
Copyright 2014-2016, Chef Software, Inc
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- Author
-
Adam Jacob (<adam@chef.io>)
- Copyright
-
Copyright 2008-2016, Chef Software Inc.
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
The Tao of File Providers:
- the content provider must always return a tempfile that we can delete/mv - do_create_file shall always create the file first and obey umask when perms are not specified - do_contents_changes may assume the destination file exists (simplifies exception checking, and always gives us something to diff against) - do_contents_changes must restore the perms to the dest file and not obliterate them with random tempfile permissions - do_acl_changes may assume perms were not modified between lcr and when it runs (although the file may have been created)
- Author
-
Dreamcat4 (<dreamcat4@gmail.com>)
- Copyright
-
Copyright 2009-2016, Chef Software Inc.
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- Author
-
AJ Christensen (<aj@chef.io>)
- Copyright
-
Copyright 2008-2016, Chef Software Inc.
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- Author
-
Dan Crosta (<dcrosta@late.am>)
- Copyright
-
Copyright 2012-2016, Chef Software Inc.
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- Author
-
Stephen Haynes (<sh@nomitor.com>)
- Copyright
-
Copyright 2009-2016, Chef Software Inc.
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- Author
-
Cary Penniman (<cary@rightscale.com>)
- Copyright
-
Copyright 2008-2017, Chef Software Inc.
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- Author
-
Thom May (<thom@chef.io>)
- Copyright
-
Copyright © 2016-2017, Chef Software Inc.
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
BUGGY AND DEPRECATED: This ruby code is known to not match the python implementation for version comparisons. The APIs here should probably be converted to talk to the PythonHelper or just abandonded completely.
e.g. this should just use Chef::Provider::Package::Yum::PythonHelper.instance.compare_versions(x,y)
The python_helper could be extended to support additional APIs in here to remove the ruby code entirely.
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
These are largely historical APIs, the YumCache object no longer exists and this is a fascade over the python helper class. It should be considered deprecated-lite and no new APIs should be added and should be added to the python_helper instead.
- Author
-
Jesse Campbell (<hikeit@gmail.com>)
- Author
-
Lamont Granquist (<lamont@chef.io>)
- Copyright
-
Copyright 2013-2016, Chef Software Inc.
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- Author
-
Adam Jacob (<adam@chef.io>)
- Author
-
AJ Christensen (<aj@chef.io>)
- Copyright
-
Copyright 2009-2017, Chef Software Inc.
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- Author
-
Phil Dibowitz (<phild@fb.com>)
- Copyright
-
Copyright 2013-2016, Facebook
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- Author
-
Seth Chisamore <schisamo@chef.io>
- Copyright
-
2011-2018, Chef Software, Inc <legal@chef.io>
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- Author
-
Xabier de Zuazo (<xabier@onddo.com>)
- Copyright
-
Copyright 2013-2016, Onddo Labs, SL.
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- Author
-
Adam Jacob (<adam@chef.io>)
- Author
-
Tyler Cloke (<tyler@chef.io>)
- Copyright
-
Copyright 2008-2016, Chef Software Inc.
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- Author
-
Michael Leinartas (<mleinartas@gmail.com>)
- Author
-
Tyler Cloke (<tyler@chef.io>)
- Copyright
-
Copyright 2010-2016, Michael Leinartas
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- Author
-
Phil Dibowitz (<phild@fb.com>)
- Copyright
-
Copyright 2013-2016, Facebook
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
NOTE: this was extracted from the Recipe DSL mixin, relevant specs are in spec/unit/recipe_spec.rb
ResourceCollection currently handles two tasks: 1) Keeps an ordered list of resources to use when converging the node 2) Keeps a unique list of resources (keyed as `type`) used for notifications
This class keeps the list of all known Resources in the order they are to be executed in. It also keeps a pointer to the most recently executed resource so we can add resources-to-execute after this point.
- Author
-
Daniel DeLeo (<dan@kallistec.com>)
- Copyright
-
Copyright 2009-2016, Daniel DeLeo
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- Author
-
Daniel DeLeo (<dan@chef.io>)
- Copyright
-
Copyright 2010-2016, Chef Software Inc.
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Why does this class exist? Why did we not just modify RunList/RunListItem?
TODO DEPRECATION NOTE This class will be replaced by Chef::UserV1 in Chef 13. It is the code to support the User object corresponding to the Open Source Chef Server 11 and only still exists to support users still on OSC 11.
Chef::UserV1 now supports Chef Server 12 and will be moved to this namespace in Chef 13.
New development should occur in Chef::UserV1. This file and corresponding osc_user knife files should be removed once client support for Open Source Chef Server 11 expires.
OSC 11 BACKWARDS COMPATIBILITY NOTE (remove after OSC 11 support ends)
In general, Chef::UserV1 is no longer expected to support Open Source Chef 11 Server requests. The object that handles those requests remain in the Chef::User namespace. This code will be moved to the Chef::User namespace as of Chef 13.
Exception: self.list is backwards compatible with OSC 11
- Author
-
Chris Bandy (<bandy.chris@gmail.com>)
- Copyright
-
Copyright 2014-2016, Chef Software Inc.
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- Author
-
Doug MacEachern (<dougm@vmware.com>)
- Copyright
-
Copyright 2010-2016, VMware, Inc.
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
this strictly wants x, x.y, or x.y.z version constraints in the target and will fail hard if it does not match. the semantics that we need here is that it must always do the best job that it can do and consume as much of the offered version as it can. since we accept arbitrarily parsed strings into node out of dozens or potentially hundreds of operating systems this parsing code needs to be fixed to never raise. the Gem::Version class is a better model, and in fact it might be a substantially better approach to base this class on Gem::Version and then do pre-mangling of things like windows version strings via e.g. `.gsub(/R/, '.')`. the raising behavior of this parser however, breaks the ProviderResolver in a not just buggy but a “completely unfit for purpose” way.
TL;DR: MUST follow the second part of “Be conservative in what you send, be liberal in what you accept”
- Author
-
Seth Falcon (<seth@chef.io>)
- Author
-
Christopher Walters (<cw@chef.io>)
- Copyright
-
Copyright 2010-2016, Chef Software Inc.
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
NOTE: this is fairly badly broken for its purpose and should not be used
unless it gets fixed. see chef/version/platform.
- Copyright
-
Copyright 2017, Noah Kantrowitz
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Constants
- CHEF_ROOT
- Config
- NIL_ARGUMENT
- NOT_PASSED
- VERSION
- Win32EventLogLoaded
- WorkstationConfigLoader
Attributes
Get the node object
@return [Chef::Node] node object of the chef-client run
Get the run context
@return [Chef::RunContext] ::run_context of the chef-client run
Public Class Methods
Emit a deprecation message.
@param [Symbol] type The message to send. This should refer to a class
defined in Chef::Deprecated
@param message An explicit message to display, rather than the generic one
associated with the deprecation.
@param location The location. Defaults to the caller who called you (since
generally the person who triggered the check is the one that needs to be fixed).
@example
Chef.deprecated(:my_deprecation, message: "This is deprecated!")
@api private this will likely be removed in favor of an as-yet unwritten
`Chef.log`
# File lib/chef/chef_class.rb, line 216 def deprecated(type, message, location = nil) location ||= Chef::Log.caller_location deprecation = Chef::Deprecated.create(type, message, location) # `run_context.events` is the primary deprecation target if we're in a # run. If we are not yet in a run, print to `Chef::Log`. if run_context && run_context.events run_context.events.deprecation(deprecation, location) else Chef::Log.deprecation(deprecation, location) end end
Register an event handler with user specified block
@return handler object
# File lib/chef/chef_class.rb, line 61 def event_handler(&block) dsl = Chef::EventDispatch::DSL.new("Chef client DSL") dsl.instance_eval(&block) end
Get the array of providers associated with a resource_name for the current node
@param resource_name [Symbol] name of the resource as a symbol
@return [Array<Class>] Priority Array of Provider Classes to use for the resource_name on the node
# File lib/chef/chef_class.rb, line 72 def get_provider_priority_array(resource_name) result = provider_priority_map.get_priority_array(node, resource_name.to_sym) result = result.dup if result result end
Get the array of resources associated with a resource_name for the current node
@param resource_name [Symbol] name of the resource as a symbol
@return [Array<Class>] Priority Array of Resource Classes to use for the resource_name on the node
# File lib/chef/chef_class.rb, line 85 def get_resource_priority_array(resource_name) result = resource_priority_map.get_priority_array(node, resource_name.to_sym) result = result.dup if result result end
# File lib/chef/chef_class.rb, line 228 def log_deprecation(message, location = nil) location ||= Chef::Log.caller_location Chef.deprecated(:generic, message, location) end
@api private Only for test dependency injection; not evenly implemented as yet.
# File lib/chef/chef_class.rb, line 235 def self.path_to(path) path end
@api private
# File lib/chef/chef_class.rb, line 191 def provider_handler_map @provider_handler_map ||= Chef::Platform::ProviderHandlerMap.instance end
@api private
# File lib/chef/chef_class.rb, line 180 def provider_priority_map # these slurp in the resource+provider world, so be exceedingly lazy about requiring them @provider_priority_map ||= Chef::Platform::ProviderPriorityMap.instance end
Resets the internal state
@api private
# File lib/chef/chef_class.rb, line 170 def reset! @run_context = nil @node = nil @provider_priority_map = nil @resource_priority_map = nil @provider_handler_map = nil @resource_handler_map = nil end
@api private
# File lib/chef/chef_class.rb, line 196 def resource_handler_map @resource_handler_map ||= Chef::Platform::ResourceHandlerMap.instance end
@api private
# File lib/chef/chef_class.rb, line 186 def resource_priority_map @resource_priority_map ||= Chef::Platform::ResourcePriorityMap.instance end
Sets the node object
@api private @param node [Chef::Node]
# File lib/chef/chef_class.rb, line 152 def set_node(node) @node = node end
Set the array of providers associated with a resource_name for the current node
@param resource_name [Symbol] name of the resource as a symbol @param priority_array [Class, Array<Class>] Class or Array of Classes to set as the priority for resource_name on the node @param filter [Hash] Chef::Nodearray-style filter
@return [Array<Class>] Modified Priority Array of Provider Classes to use for the resource_name on the node
# File lib/chef/chef_class.rb, line 100 def set_provider_priority_array(resource_name, priority_array, *filter, &block) result = provider_priority_map.set_priority_array(resource_name.to_sym, priority_array, *filter, &block) result = result.dup if result result end
Sets the ::provider_priority_map
@param ::provider_priority_map [Chef::Platform::providerPriorityMap]
@api private
# File lib/chef/chef_class.rb, line 143 def set_provider_priority_map(provider_priority_map) @provider_priority_map = provider_priority_map end
Get the array of resources associated with a resource_name for the current node
@param resource_name [Symbol] name of the resource as a symbol @param priority_array [Class, Array<Class>] Class or Array of Classes to set as the priority for resource_name on the node @param filter [Hash] Chef::Nodearray-style filter
@return [Array<Class>] Modified Priority Array of Resource Classes to use for the resource_name on the node
# File lib/chef/chef_class.rb, line 115 def set_resource_priority_array(resource_name, priority_array, *filter, &block) result = resource_priority_map.set_priority_array(resource_name.to_sym, priority_array, *filter, &block) result = result.dup if result result end
Sets the ::resource_priority_map
@param ::resource_priority_map [Chef::Platform::ResourcePriorityMap]
@api private
# File lib/chef/chef_class.rb, line 133 def set_resource_priority_map(resource_priority_map) @resource_priority_map = resource_priority_map end
Sets the ::run_context object
@param ::run_context [Chef::RunContext]
@api private
# File lib/chef/chef_class.rb, line 162 def set_run_context(run_context) @run_context = run_context end