Method: Jamf::Prestage::ClassMethods#unassign
- Defined in:
- lib/jamf/api/jamf_pro/mixins/prestage.rb
#unassign(*sns_to_unassign, from_prestage:, cnx: Jamf.cnx) ⇒ Jamf::PrestageScope
Unassign one or more serialNumber from a prestage
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
# File 'lib/jamf/api/jamf_pro/mixins/prestage.rb', line 189 def unassign(*sns_to_unassign, from_prestage:, cnx: Jamf.cnx) prestage_id = valid_id from_prestage raise Jamf::NoSuchItemError, "No #{self} matching '#{from_prestage}'" unless prestage_id # upcase all sns sns_to_unassign.map!(&:to_s) sns_to_unassign.map!(&:upcase) # get the current scope of the prestage spath = scope_path(prestage_id) scope = INSTANCE_SCOPE_OBJECT.new cnx.get(spath) new_scope_sns = scope.assignments.map(&:serialNumber) new_scope_sns -= sns_to_unassign update_scope(spath, new_scope_sns, scope.versionLock, cnx) end |