class QB::Ansible::Module::Response
Encapsulation of data that an Ansible module responds to Ansible with.
Ansible calls this a module's “return value”.
@see docs.ansible.com/ansible/latest/reference_appendices/common_return_values.html
Public Class Methods
new(values = {})
click to toggle source
Instantiate a new `QB::Ansible::Module::Response`.
Calls superclass method
# File lib/qb/ansible/module/response.rb, line 155 def initialize values = {} super() initialize_props values end
Public Instance Methods
convert_key(key)
click to toggle source
Uses {Symbol} keys, and they can not be empty. Will convert non-empty strings to their symbols.
@param [Symbol | String] key @return [Symbol]
# File lib/qb/ansible/module/response.rb, line 170 def convert_key key t.match key, t.non_empty_str, :to_sym.to_proc, t.non_empty_sym, key end
to_failure(msg:, warnings: [], depreciations: [], **values)
click to toggle source
Create a new response to represent a failure, copying the stuff that makes sense to keep from this one.
@param [type] arg_name
@todo Add name param description.
@return [return_type]
@todo Document return value.
# File lib/qb/ansible/module/response.rb, line 186 def to_failure msg:, warnings: [], depreciations: [], **values self.class.new \ failed: true, msg: msg, warnings: (self.warnings + warnings), depreciations: (self.depreciations + depreciations) end