ruby-jss 1.4.1 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGES.md +95 -0
- data/THANKS.md +3 -2
- data/lib/jamf.rb +18 -17
- data/lib/jamf/api/base_classes/collection_resource.rb +613 -0
- data/lib/jamf/api/{abstract_classes → base_classes}/json_object.rb +109 -101
- data/lib/jamf/api/{abstract_classes → base_classes}/prestage.rb +55 -30
- data/lib/jamf/api/{abstract_classes → base_classes}/resource.rb +10 -6
- data/lib/jamf/api/{abstract_classes → base_classes}/singleton_resource.rb +4 -3
- data/lib/jamf/api/connection.rb +13 -9
- data/lib/jamf/api/connection/api_error.rb +8 -8
- data/lib/jamf/api/connection/token.rb +16 -15
- data/lib/jamf/api/json_objects/device_enrollment_device.rb +14 -7
- data/lib/jamf/api/json_objects/{location.rb → device_enrollment_device_sync_state.rb} +27 -41
- data/lib/jamf/api/json_objects/device_enrollment_sync_status.rb +1 -1
- data/lib/jamf/api/json_objects/{attachment.rb → locale.rb} +14 -23
- data/lib/jamf/api/json_objects/md_prestage_name.rb +1 -1
- data/lib/jamf/api/json_objects/md_prestage_names.rb +2 -2
- data/lib/jamf/api/json_objects/md_prestage_skip_setup_items.rb +50 -1
- data/lib/jamf/api/json_objects/prestage_assignment.rb +2 -2
- data/lib/jamf/api/json_objects/prestage_location.rb +3 -3
- data/lib/jamf/api/json_objects/prestage_purchasing_data.rb +7 -7
- data/lib/jamf/api/json_objects/prestage_scope.rb +1 -1
- data/lib/jamf/api/{resources/collection_resources → json_objects}/time_zone.rb +9 -23
- data/lib/jamf/api/mixins/{abstract.rb → base_class.rb} +34 -16
- data/lib/jamf/api/mixins/bulk_deletable.rb +27 -6
- data/lib/jamf/api/mixins/change_log.rb +201 -51
- data/lib/jamf/api/{resources/collection_resources/computer.rb → mixins/filterable.rb} +19 -17
- data/lib/jamf/api/mixins/pageable.rb +208 -0
- data/lib/jamf/api/{json_objects/installed_application.rb → mixins/sortable.rb} +33 -33
- data/lib/jamf/api/resources/collection_resources/building.rb +16 -9
- data/lib/jamf/api/resources/collection_resources/category.rb +5 -4
- data/lib/jamf/api/resources/collection_resources/computer_prestage.rb +12 -5
- data/lib/jamf/api/resources/collection_resources/department.rb +0 -2
- data/lib/jamf/api/resources/collection_resources/device_enrollment.rb +10 -10
- data/lib/jamf/api/resources/collection_resources/inventory_preload_record.rb +11 -3
- data/lib/jamf/api/resources/collection_resources/mobile_device_prestage.rb +25 -23
- data/lib/jamf/api/resources/collection_resources/script.rb +61 -25
- data/lib/jamf/api/resources/singleton_resources/app_store_country_codes.rb +15 -5
- data/lib/jamf/api/resources/singleton_resources/locales.rb +155 -0
- data/lib/jamf/api/resources/singleton_resources/time_zones.rb +213 -0
- data/lib/jamf/client.rb +3 -3
- data/lib/jamf/client/management_action.rb +2 -3
- data/lib/jamf/composer.rb +2 -2
- data/lib/jamf/utility.rb +35 -7
- data/lib/jamf/validate.rb +63 -24
- data/lib/jamf/version.rb +1 -1
- data/lib/jss.rb +2 -2
- data/lib/jss/api_connection.rb +114 -406
- data/lib/jss/api_object.rb +3 -19
- data/lib/jss/api_object/categorizable.rb +1 -1
- data/lib/jss/api_object/computer.rb +13 -0
- data/lib/jss/api_object/configuration_profile.rb +61 -5
- data/lib/jss/api_object/directory_binding_type.rb +66 -60
- data/lib/jss/api_object/directory_binding_type/active_directory.rb +71 -34
- data/lib/jss/api_object/directory_binding_type/admitmac.rb +536 -467
- data/lib/jss/api_object/directory_binding_type/centrify.rb +21 -7
- data/lib/jss/api_object/directory_binding_type/open_directory.rb +4 -4
- data/lib/jss/api_object/distribution_point.rb +2 -2
- data/lib/jss/api_object/dock_item.rb +102 -96
- data/lib/jss/api_object/extendable.rb +1 -1
- data/lib/jss/api_object/group.rb +33 -2
- data/lib/jss/api_object/network_segment.rb +45 -13
- data/lib/jss/api_object/patch_source.rb +10 -9
- data/lib/jss/api_object/policy.rb +155 -25
- data/lib/jss/api_object/printer.rb +10 -4
- data/lib/jss/api_object/scopable.rb +10 -15
- data/lib/jss/api_object/scopable/scope.rb +31 -30
- data/lib/jss/api_object/script.rb +242 -352
- data/lib/jss/api_object/user.rb +1 -1
- data/lib/jss/client/management_action.rb +1 -2
- data/lib/jss/composer.rb +2 -2
- data/lib/jss/exceptions.rb +3 -0
- data/lib/jss/server.rb +15 -0
- data/lib/jss/utility.rb +213 -45
- data/lib/jss/version.rb +1 -1
- metadata +46 -64
- data/lib/jamf/api/abstract_classes/advanced_search.rb +0 -86
- data/lib/jamf/api/abstract_classes/collection_resource.rb +0 -433
- data/lib/jamf/api/abstract_classes/generic_reference.rb +0 -145
- data/lib/jamf/api/abstract_classes/prestage_skip_setup_items.rb +0 -126
- data/lib/jamf/api/json_objects/account_prefs.rb +0 -79
- data/lib/jamf/api/json_objects/android_details.rb +0 -139
- data/lib/jamf/api/json_objects/appletv_details.rb +0 -110
- data/lib/jamf/api/json_objects/cellular_network.rb +0 -151
- data/lib/jamf/api/json_objects/computer_prestage_skip_setup_items.rb +0 -67
- data/lib/jamf/api/json_objects/criterion.rb +0 -152
- data/lib/jamf/api/json_objects/extension_attribute_value.rb +0 -128
- data/lib/jamf/api/json_objects/installed_certificate.rb +0 -53
- data/lib/jamf/api/json_objects/installed_configuration_profile.rb +0 -67
- data/lib/jamf/api/json_objects/installed_ebook.rb +0 -58
- data/lib/jamf/api/json_objects/installed_provisioning_profile.rb +0 -59
- data/lib/jamf/api/json_objects/ios_details.rb +0 -244
- data/lib/jamf/api/json_objects/mobile_device_details.rb +0 -219
- data/lib/jamf/api/json_objects/mobile_device_security.rb +0 -101
- data/lib/jamf/api/json_objects/purchasing_data.rb +0 -125
- data/lib/jamf/api/mixins/locatable.rb +0 -124
- data/lib/jamf/api/mixins/referable.rb +0 -92
- data/lib/jamf/api/resources/collection_resources/account.rb +0 -163
- data/lib/jamf/api/resources/collection_resources/advanced_mobile_device_search.rb +0 -52
- data/lib/jamf/api/resources/collection_resources/advanced_user_search.rb +0 -52
- data/lib/jamf/api/resources/collection_resources/extension_attribute.rb +0 -45
- data/lib/jamf/api/resources/collection_resources/mobile_device.rb +0 -315
- data/lib/jamf/api/resources/collection_resources/site.rb +0 -77
- data/lib/jamf/api/resources/singleton_resources/authorization.rb +0 -88
- data/lib/jamf/api/resources/singleton_resources/client_checkin_settings.rb +0 -139
- data/lib/jamf/api/resources/singleton_resources/reenrollment_settings.rb +0 -95
|
@@ -106,7 +106,7 @@ module JSS
|
|
|
106
106
|
# @return [void]
|
|
107
107
|
def workstation_mode=(newvalue)
|
|
108
108
|
|
|
109
|
-
raise JSS::InvalidDataError, "workstation_mode must be true or false." unless newvalue.is_a?
|
|
109
|
+
raise JSS::InvalidDataError, "workstation_mode must be true or false." unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass)
|
|
110
110
|
|
|
111
111
|
@workstation_mode = newvalue
|
|
112
112
|
|
|
@@ -125,7 +125,7 @@ module JSS
|
|
|
125
125
|
# @return [void]
|
|
126
126
|
def overwrite_existing=(newvalue)
|
|
127
127
|
|
|
128
|
-
raise JSS::InvalidDataError, "overwrite_existing must be true or false." unless newvalue.is_a?
|
|
128
|
+
raise JSS::InvalidDataError, "overwrite_existing must be true or false." unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass)
|
|
129
129
|
|
|
130
130
|
@overwrite_existing = newvalue
|
|
131
131
|
|
|
@@ -144,7 +144,7 @@ module JSS
|
|
|
144
144
|
# @return [void]
|
|
145
145
|
def update_PAM=(newvalue)
|
|
146
146
|
|
|
147
|
-
raise JSS::InvalidDataError, "update_PAM must be true or false." unless newvalue.is_a?
|
|
147
|
+
raise JSS::InvalidDataError, "update_PAM must be true or false." unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass)
|
|
148
148
|
|
|
149
149
|
@update_PAM = newvalue
|
|
150
150
|
|
|
@@ -163,9 +163,16 @@ module JSS
|
|
|
163
163
|
# @return [void]
|
|
164
164
|
def zone=(newvalue)
|
|
165
165
|
|
|
166
|
-
|
|
166
|
+
new =
|
|
167
|
+
if newvalue.to_s.empty?
|
|
168
|
+
JSS::BLANK
|
|
169
|
+
else
|
|
170
|
+
# Data Check
|
|
171
|
+
raise JSS::InvalidDataError, "zone must be a string." unless newvalue.is_a? String
|
|
172
|
+
newvalue
|
|
173
|
+
end
|
|
167
174
|
|
|
168
|
-
@zone =
|
|
175
|
+
@zone = new
|
|
169
176
|
|
|
170
177
|
self.container&.should_update
|
|
171
178
|
end
|
|
@@ -182,9 +189,16 @@ module JSS
|
|
|
182
189
|
# @return [void]
|
|
183
190
|
def preferred_domain_server=(newvalue)
|
|
184
191
|
|
|
185
|
-
|
|
192
|
+
new =
|
|
193
|
+
if newvalue.to_s.empty?
|
|
194
|
+
JSS::BLANK
|
|
195
|
+
else
|
|
196
|
+
# Data Check
|
|
197
|
+
raise JSS::InvalidDataError, "preferred_domain_server must be a string." unless newvalue.is_a? String
|
|
198
|
+
newvalue
|
|
199
|
+
end
|
|
186
200
|
|
|
187
|
-
@preferred_domain_server =
|
|
201
|
+
@preferred_domain_server = new
|
|
188
202
|
|
|
189
203
|
self.container&.should_update
|
|
190
204
|
end
|
|
@@ -93,7 +93,7 @@ module JSS
|
|
|
93
93
|
# @return [void]
|
|
94
94
|
def encrypt_using_ssl=(newvalue)
|
|
95
95
|
|
|
96
|
-
raise JSS::InvalidDataError, "encrypt_using_ssl must be true or false." unless newvalue.is_a?
|
|
96
|
+
raise JSS::InvalidDataError, "encrypt_using_ssl must be true or false." unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass)
|
|
97
97
|
|
|
98
98
|
@encrypt_using_ssl = newvalue
|
|
99
99
|
|
|
@@ -112,7 +112,7 @@ module JSS
|
|
|
112
112
|
# @return [void]
|
|
113
113
|
def perform_secure_bind=(newvalue)
|
|
114
114
|
|
|
115
|
-
raise JSS::InvalidDataError, "perform_secure_bind must be true or false." unless newvalue.is_a?
|
|
115
|
+
raise JSS::InvalidDataError, "perform_secure_bind must be true or false." unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass)
|
|
116
116
|
|
|
117
117
|
@perform_secure_bind = newvalue
|
|
118
118
|
|
|
@@ -131,7 +131,7 @@ module JSS
|
|
|
131
131
|
# @return [void]
|
|
132
132
|
def use_for_authentication=(newvalue)
|
|
133
133
|
|
|
134
|
-
raise JSS::InvalidDataError, "use_for_authentication must be true or false." unless newvalue.is_a?
|
|
134
|
+
raise JSS::InvalidDataError, "use_for_authentication must be true or false." unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass)
|
|
135
135
|
|
|
136
136
|
@use_for_authentication = newvalue
|
|
137
137
|
|
|
@@ -150,7 +150,7 @@ module JSS
|
|
|
150
150
|
# @return [void]
|
|
151
151
|
def use_for_contacts=(newvalue)
|
|
152
152
|
|
|
153
|
-
raise JSS::InvalidDataError, "use_for_contacts must be true or false." unless newvalue.is_a?
|
|
153
|
+
raise JSS::InvalidDataError, "use_for_contacts must be true or false." unless newvalue.is_a?(TrueClass) || newvalue.is_a(FalseClass)
|
|
154
154
|
|
|
155
155
|
@use_for_contacts = newvalue
|
|
156
156
|
|
|
@@ -24,8 +24,9 @@
|
|
|
24
24
|
###
|
|
25
25
|
|
|
26
26
|
module JSS
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
# Module Variables
|
|
29
30
|
#####################################
|
|
30
31
|
|
|
31
32
|
# Module Methods
|
|
@@ -40,98 +41,103 @@ module JSS
|
|
|
40
41
|
# @see JSS::APIObject
|
|
41
42
|
#
|
|
42
43
|
class DockItem < JSS::APIObject
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
######################
|
|
122
|
-
private
|
|
123
|
-
|
|
124
|
-
# the xml formated data for adding or updating this in the JSS
|
|
125
|
-
#
|
|
126
|
-
def rest_xml
|
|
127
|
-
doc = REXML::Document.new APIConnection::XML_HEADER
|
|
128
|
-
ns = doc.add_element RSRC_OBJECT_KEY.to_s
|
|
129
|
-
ns.add_element('name').text = @name
|
|
130
|
-
ns.add_element('type').text = @type.to_s
|
|
131
|
-
ns.add_element('path').text = @path.to_s
|
|
132
|
-
doc.to_s
|
|
133
|
-
end # rest_xml
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
# Mix-Ins
|
|
47
|
+
#####################################
|
|
48
|
+
include JSS::Creatable
|
|
49
|
+
include JSS::Updatable
|
|
50
|
+
|
|
51
|
+
# Class Methods
|
|
52
|
+
#####################################
|
|
53
|
+
|
|
54
|
+
# Class Constants
|
|
55
|
+
#####################################
|
|
56
|
+
|
|
57
|
+
# The Dock Item type
|
|
58
|
+
DOCK_ITEM_TYPE = %w[
|
|
59
|
+
App
|
|
60
|
+
File
|
|
61
|
+
Folder
|
|
62
|
+
].freeze
|
|
63
|
+
|
|
64
|
+
# The base for REST resources of this class
|
|
65
|
+
RSRC_BASE = 'dockitems'.freeze
|
|
66
|
+
|
|
67
|
+
# the hash key used for the JSON list output of all objects in the JSS
|
|
68
|
+
RSRC_LIST_KEY = :dock_items
|
|
69
|
+
|
|
70
|
+
# The hash key used for the JSON object output.
|
|
71
|
+
# It's also used in various error messages
|
|
72
|
+
RSRC_OBJECT_KEY = :dock_item
|
|
73
|
+
|
|
74
|
+
# the object type for this object in
|
|
75
|
+
# the object history table.
|
|
76
|
+
# See {APIObject#add_object_history_entry}
|
|
77
|
+
# OBJECT_HISTORY_OBJECT_TYPE = 41
|
|
78
|
+
|
|
79
|
+
# Attributes
|
|
80
|
+
#####################################
|
|
81
|
+
attr_reader :id
|
|
82
|
+
attr_reader :name
|
|
83
|
+
attr_reader :type
|
|
84
|
+
attr_reader :path
|
|
85
|
+
|
|
86
|
+
# Constructor
|
|
87
|
+
# @see JSS::APIObject.initialize
|
|
88
|
+
#####################################
|
|
89
|
+
def initialize(args = {})
|
|
90
|
+
super args
|
|
91
|
+
|
|
92
|
+
@type = 'App' if @init_data[:type].nil?
|
|
93
|
+
@type = @init_data[:type]
|
|
94
|
+
@path = @init_data[:path]
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# Public Instance Methods
|
|
98
|
+
#####################################
|
|
99
|
+
|
|
100
|
+
# set the type
|
|
101
|
+
#
|
|
102
|
+
# @param newval[String] the new app type
|
|
103
|
+
#
|
|
104
|
+
# @return [void]
|
|
105
|
+
#
|
|
106
|
+
def type=(newval)
|
|
107
|
+
raise JSS::InvalidDataError, 'Type must be a string' unless newval.is_a? String
|
|
108
|
+
raise JSS::InvalidDataError, "Type must be one of the following: #{DOCK_ITEM_TYPE}; not #{newval}" unless DOCK_ITEM_TYPE.include? newval.to_s
|
|
109
|
+
|
|
110
|
+
@type = newval
|
|
111
|
+
@need_to_update = true
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
# set the path
|
|
115
|
+
#
|
|
116
|
+
# @param newval[String] the new app path
|
|
117
|
+
def path=(newval)
|
|
118
|
+
raise JSS::InvalidDataError, 'Path must be a String' unless newval.is_a? String
|
|
119
|
+
|
|
120
|
+
@path = newval
|
|
121
|
+
@need_to_update = true
|
|
134
122
|
end
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
123
|
+
|
|
124
|
+
# private instance methods
|
|
125
|
+
######################
|
|
126
|
+
private
|
|
127
|
+
|
|
128
|
+
# the xml formated data for adding or updating this in the JSS
|
|
129
|
+
#
|
|
130
|
+
def rest_xml
|
|
131
|
+
doc = REXML::Document.new APIConnection::XML_HEADER
|
|
132
|
+
ns = doc.add_element RSRC_OBJECT_KEY.to_s
|
|
133
|
+
ns.add_element('name').text = @name
|
|
134
|
+
ns.add_element('type').text = @type.to_s
|
|
135
|
+
ns.add_element('path').text = @path.to_s
|
|
136
|
+
doc.to_s
|
|
137
|
+
end # rest_xml
|
|
138
|
+
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
end
|
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
#
|
|
24
24
|
#
|
|
25
25
|
|
|
26
|
-
#
|
|
27
26
|
module JSS
|
|
28
27
|
|
|
29
28
|
# Sub-Modules
|
|
@@ -221,6 +220,7 @@ module JSS
|
|
|
221
220
|
eaxml = REXML::Element.new('extension_attributes')
|
|
222
221
|
@extension_attributes.each do |ea|
|
|
223
222
|
next unless @changed_eas.include? ea[:name]
|
|
223
|
+
|
|
224
224
|
ea_el = eaxml.add_element('extension_attribute')
|
|
225
225
|
ea_el.add_element('name').text = ea[:name]
|
|
226
226
|
|
data/lib/jss/api_object/group.rb
CHANGED
|
@@ -241,7 +241,7 @@ module JSS
|
|
|
241
241
|
#
|
|
242
242
|
# @param retries [Integer] If calculate_members is true, refetching the
|
|
243
243
|
# group to re-read the membership can happen too fast, the JSS won't know
|
|
244
|
-
# it exists yet and will throw a
|
|
244
|
+
# it exists yet and will throw a NoSuchItem error. If that
|
|
245
245
|
# happens, try again this many times with a 1 second pause between attempts.
|
|
246
246
|
#
|
|
247
247
|
def create(calculate_members: true, retries: 10)
|
|
@@ -256,7 +256,7 @@ module JSS
|
|
|
256
256
|
begin
|
|
257
257
|
refresh_members
|
|
258
258
|
break
|
|
259
|
-
rescue
|
|
259
|
+
rescue
|
|
260
260
|
sleep 1
|
|
261
261
|
tries += 1
|
|
262
262
|
end # begin
|
|
@@ -311,6 +311,37 @@ module JSS
|
|
|
311
311
|
super
|
|
312
312
|
end
|
|
313
313
|
|
|
314
|
+
# Change static group to smart group
|
|
315
|
+
#
|
|
316
|
+
# @param args[Hash] the options and settings use for switching the computer group from static group to smart group
|
|
317
|
+
#
|
|
318
|
+
# @option args criteria[Array] The criterias to be user for the smart group
|
|
319
|
+
def set_smart(*params)
|
|
320
|
+
return if @is_smart
|
|
321
|
+
|
|
322
|
+
params[:criteria] = [] if params[:criteria].nil?
|
|
323
|
+
|
|
324
|
+
criteria = params[:criteria]
|
|
325
|
+
|
|
326
|
+
@is_smart = true
|
|
327
|
+
@need_to_update = true
|
|
328
|
+
end
|
|
329
|
+
|
|
330
|
+
# Change smart group to static group
|
|
331
|
+
#
|
|
332
|
+
# @param args[Hash] the options and settings use for switching the computer group from smart group to static group
|
|
333
|
+
#
|
|
334
|
+
# @option args preserve_members[Boolean] Should the smart group preserve it's current members?
|
|
335
|
+
def set_static(*params)
|
|
336
|
+
return unless @is_smart
|
|
337
|
+
|
|
338
|
+
preserve_members = params.include? :preserve_members
|
|
339
|
+
|
|
340
|
+
@is_smart = false
|
|
341
|
+
|
|
342
|
+
clear() unless preserve_members
|
|
343
|
+
end
|
|
344
|
+
|
|
314
345
|
# How many members of the group?
|
|
315
346
|
#
|
|
316
347
|
# @return [Integer] the number of members of the group
|
|
@@ -435,9 +435,10 @@ module JSS
|
|
|
435
435
|
@starting_address <= thing.range.begin && @ending_address >= thing.range.end
|
|
436
436
|
else
|
|
437
437
|
thing = IPAddr.new thing.to_s
|
|
438
|
-
range.
|
|
438
|
+
range.cover? thing
|
|
439
439
|
end
|
|
440
440
|
end
|
|
441
|
+
alias cover? include?
|
|
441
442
|
|
|
442
443
|
### Does this network segment equal another?
|
|
443
444
|
### equality means the ranges are equal
|
|
@@ -459,9 +460,17 @@ module JSS
|
|
|
459
460
|
### @return [void]
|
|
460
461
|
###
|
|
461
462
|
def building=(newval)
|
|
462
|
-
new =
|
|
463
|
-
|
|
464
|
-
|
|
463
|
+
new =
|
|
464
|
+
if newval.to_s.empty?
|
|
465
|
+
JSS::BLANK
|
|
466
|
+
else
|
|
467
|
+
id = JSS::Building.valid_id newval
|
|
468
|
+
raise JSS::MissingDataError, "No building matching '#{newval}'" unless id
|
|
469
|
+
|
|
470
|
+
JSS::Building.map_all_ids_to(:name)[id]
|
|
471
|
+
end
|
|
472
|
+
|
|
473
|
+
@building = new
|
|
465
474
|
@need_to_update = true
|
|
466
475
|
end
|
|
467
476
|
|
|
@@ -484,9 +493,16 @@ module JSS
|
|
|
484
493
|
### @return [void]
|
|
485
494
|
###
|
|
486
495
|
def department=(newval)
|
|
487
|
-
new =
|
|
488
|
-
|
|
489
|
-
|
|
496
|
+
new =
|
|
497
|
+
if newval.to_s.empty?
|
|
498
|
+
JSS::BLANK
|
|
499
|
+
else
|
|
500
|
+
id = JSS::Department.valid_id newval
|
|
501
|
+
raise JSS::MissingDataError , "No department matching '#{newval}' in the JSS" unless id
|
|
502
|
+
|
|
503
|
+
JSS::Department.map_all_ids_to(:name)[id]
|
|
504
|
+
end
|
|
505
|
+
@department = new
|
|
490
506
|
@need_to_update = true
|
|
491
507
|
end
|
|
492
508
|
|
|
@@ -531,9 +547,17 @@ module JSS
|
|
|
531
547
|
### @return [void]
|
|
532
548
|
###
|
|
533
549
|
def netboot_server=(newval)
|
|
534
|
-
new =
|
|
535
|
-
|
|
536
|
-
|
|
550
|
+
new =
|
|
551
|
+
if newval.to_s.empty?
|
|
552
|
+
JSS::BLANK
|
|
553
|
+
else
|
|
554
|
+
id = JSS::NetBootServer.valid_id newval
|
|
555
|
+
raise JSS::MissingDataError, "No netboot_server matching '#{newval}' in the JSS" unless id
|
|
556
|
+
|
|
557
|
+
JSS::NetbootServer.map_all_ids_to(:name)[id]
|
|
558
|
+
end
|
|
559
|
+
|
|
560
|
+
@netboot_server = new
|
|
537
561
|
@need_to_update = true
|
|
538
562
|
end
|
|
539
563
|
|
|
@@ -544,9 +568,17 @@ module JSS
|
|
|
544
568
|
### @return [void]
|
|
545
569
|
###
|
|
546
570
|
def swu_server=(newval)
|
|
547
|
-
new =
|
|
548
|
-
|
|
549
|
-
|
|
571
|
+
new =
|
|
572
|
+
if newval.to_s.empty?
|
|
573
|
+
JSS::BLANK
|
|
574
|
+
else
|
|
575
|
+
id = JSS::SoftwareUpdateServer.valid_id newval
|
|
576
|
+
raise JSS::MissingDataError, "No swu_server matching '#{newval}' in the JSS" unless id
|
|
577
|
+
|
|
578
|
+
JSS::SoftwareUpdateServer.map_all_ids_to(:name)[id]
|
|
579
|
+
end
|
|
580
|
+
|
|
581
|
+
@swu_server = new
|
|
550
582
|
@need_to_update = true
|
|
551
583
|
end
|
|
552
584
|
|