Class: Windoo::Patch
- Inherits:
-
BaseClasses::JSONObject
- Object
- BaseClasses::JSONObject
- Windoo::Patch
- Includes:
- Mixins::APICollection, Mixins::Patch::Component
- Defined in:
- lib/windoo/objects/patch.rb
Overview
A patch represents a specific version of a Software Title.
Constant Summary collapse
- RSRC_PATH =
Constants
'patches'
- CONTAINER_CLASS =
Windoo::SoftwareTitle
- JSON_ATTRIBUTES =
Attributes
{ # @!attribute patchId # @return [Integer] The id number of this patch patchId: { class: :Integer, identifier: :primary, do_not_send: true, readonly: true }, # @!attribute softwareTitleId # @return [Integer] The id number of the title which uses this patch softwareTitleId: { class: :Integer, do_not_send: true, readonly: true }, # @!attribute absoluteOrderId # @return [Integer] The zero-based position of this patch among # all those used by the title. Should be identical to the Array index # of this patch in the #patches attribute of the SoftwareTitle # instance that uses this patch. # NOTE: This can only be changed via methods called on the # PatchManager that contains the patch. absoluteOrderId: { class: :Integer, readonly: true }, # @!attribute enabled # @return [Boolean] Is this patch enabled? enabled: { class: :Boolean }, # @!attribute version # @return [String] The version on the title installed by this patch version: { class: :String, required: true }, # @!attribute releaseDate # @return [Time] When this patch was released releaseDate: { class: :Time, required: true, to_ruby: :to_time, to_api: :time_to_api }, # @!attribute standalone # @return [Boolean] Can this patch be installed as an initial installation? # If not, it must be applied to an already-installed version of this title. # NOTE: This is for reporting only, it is not used in patch policies standalone: { class: :Boolean }, # @!attribute minimumOperatingSystem # @return [String] The lowest version of the OS that can run this patch # NOTE: This is for reporting only. If there is a minimumOperatingSystem # You'll still need to specify it in the capabilities for this patch. minimumOperatingSystem: { class: :String, required: true }, # @!attribute reboot # @return [Boolean] Does the patch require a reboot after installation? reboot: { class: :Boolean }, # @!attribute killApps # @return [Array<Windoo::KillApp>] The apps that must be quit before # installing this patch killApps: { class: Windoo::KillAppManager, do_not_send: true, readonly: true }, # @!attribute components # @return [Array<Windoo::Component>] The components of this patch. # NOTE: there can be only one! component: { class: Windoo::Component, do_not_send: true, readonly: true }, # @!attribute capabilities # @return [Array<Windoo::CapabilityManager>] The criteria which identify # computers capable of running, and thus installing, this patch. capabilities: { class: Windoo::CapabilityManager, do_not_send: true, readonly: true } }.freeze
Constants inherited from BaseClasses::JSONObject
BaseClasses::JSONObject::PP_OMITTED_INST_VARS
Instance Attribute Summary collapse
-
#absoluteOrderId ⇒ Integer
The zero-based position of this patch among all those used by the title.
-
#capabilities ⇒ Array<Windoo::CapabilityManager>
The criteria which identify computers capable of running, and thus installing, this patch.
-
#components ⇒ Array<Windoo::Component>
The components of this patch.
-
#enabled ⇒ Boolean
Is this patch enabled?.
-
#killApps ⇒ Array<Windoo::KillApp>
The apps that must be quit before installing this patch.
-
#minimumOperatingSystem ⇒ String
The lowest version of the OS that can run this patch NOTE: This is for reporting only.
-
#patchId ⇒ Integer
The id number of this patch.
-
#reboot ⇒ Boolean
Does the patch require a reboot after installation?.
-
#releaseDate ⇒ Time
When this patch was released.
-
#softwareTitleId ⇒ Integer
The id number of the title which uses this patch.
-
#standalone ⇒ Boolean
Can this patch be installed as an initial installation? If not, it must be applied to an already-installed version of this title.
-
#version ⇒ String
The version on the title installed by this patch.
Attributes inherited from BaseClasses::JSONObject
Instance Method Summary collapse
-
#disable ⇒ Object
Disable this Patch.
-
#enable ⇒ Object
Enable this Patch.
-
#initialize(**init_data) ⇒ Patch
constructor
Constructor.
-
#local_absoluteOrderId=(new_index) ⇒ void
Update the local absoluteOrderId without updating it on the server.
Methods included from Mixins::Patch::Component
#add_component, #delete_component
Methods included from Mixins::APICollection
#==, #cnx, #container, #create_on_server, #delete, #deleted_id, included, #pretty_print_instance_variables, #primary_id, #softwareTitle, #update_on_server
Methods inherited from BaseClasses::JSONObject
attribute_already_parsed?, ident_keys, json_attributes, json_attributes_parsed, mutable?, parse_json_attributes, #pretty_print_instance_variables, primary_id_key, required_attributes, #to_api, #to_json, validate_attr
Constructor Details
#initialize(**init_data) ⇒ Patch
Constructor
137 138 139 140 141 |
# File 'lib/windoo/objects/patch.rb', line 137 def initialize(**init_data) super @capabilities = Windoo::CapabilityManager.new @capabilities, container: self @killApps = Windoo::KillAppManager.new @killApps, container: self end |
Instance Attribute Details
#absoluteOrderId ⇒ Integer
Returns The zero-based position of this patch among all those used by the title. Should be identical to the Array index of this patch in the #patches attribute of the SoftwareTitle instance that uses this patch. NOTE: This can only be changed via methods called on the PatchManager that contains the patch.
|
# File 'lib/windoo/objects/patch.rb', line 48
|
#capabilities ⇒ Array<Windoo::CapabilityManager>
Returns The criteria which identify computers capable of running, and thus installing, this patch.
|
# File 'lib/windoo/objects/patch.rb', line 123
|
#components ⇒ Array<Windoo::Component>
Returns The components of this patch. NOTE: there can be only one!.
|
# File 'lib/windoo/objects/patch.rb', line 114
|
#enabled ⇒ Boolean
Returns Is this patch enabled?.
|
# File 'lib/windoo/objects/patch.rb', line 60
|
#killApps ⇒ Array<Windoo::KillApp>
Returns The apps that must be quit before installing this patch.
|
# File 'lib/windoo/objects/patch.rb', line 105
|
#minimumOperatingSystem ⇒ String
Returns The lowest version of the OS that can run this patch NOTE: This is for reporting only. If there is a minimumOperatingSystem You’ll still need to specify it in the capabilities for this patch.
|
# File 'lib/windoo/objects/patch.rb', line 90
|
#patchId ⇒ Integer
Returns The id number of this patch.
|
# File 'lib/windoo/objects/patch.rb', line 31
|
#reboot ⇒ Boolean
Returns Does the patch require a reboot after installation?.
|
# File 'lib/windoo/objects/patch.rb', line 99
|
#releaseDate ⇒ Time
Returns When this patch was released.
|
# File 'lib/windoo/objects/patch.rb', line 73
|
#softwareTitleId ⇒ Integer
Returns The id number of the title which uses this patch.
|
# File 'lib/windoo/objects/patch.rb', line 40
|
#standalone ⇒ Boolean
Returns Can this patch be installed as an initial installation? If not, it must be applied to an already-installed version of this title. NOTE: This is for reporting only, it is not used in patch policies.
|
# File 'lib/windoo/objects/patch.rb', line 82
|
#version ⇒ String
Returns The version on the title installed by this patch.
|
# File 'lib/windoo/objects/patch.rb', line 66
|
Instance Method Details
#disable ⇒ Object
Disable this Patch
165 166 167 168 169 170 |
# File 'lib/windoo/objects/patch.rb', line 165 def disable return unless enabled? self.enabled = false :disabled end |
#enable ⇒ Object
Enable this Patch
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'lib/windoo/objects/patch.rb', line 147 def enable return if enabled? if capabilities.empty? || component.nil? || component.criteria.empty? raise Windoo::MissingDataError, 'Patches must have at least one capability, and a component with at least one criterion, before they can be enabled' end self.enabled = true # Update the currentVersion of our title to this version if this patch is the # newest enabled patch container.currentVersion = version if container.patches.all_enabled.first == self :enabled end |
#local_absoluteOrderId=(new_index) ⇒ void
Only allow this to be called from a PatchManager.
This method returns an undefined value.
Update the local absoluteOrderId without updating it on the server.
Why??
Because changing the value on the server for one criterion using #absoluteOrderId= will automatically change it on the server for all the others.
After changing one on the server and updating that one in the local array, the ArrayManager will use this, without updating the server, to change the value for all others in the array to match their array index.
206 207 208 |
# File 'lib/windoo/objects/patch.rb', line 206 def local_absoluteOrderId=(new_index) @absoluteOrderId = new_index end |