lib/d3/package/server_actions.rb in depot3-3.0.22 vs lib/d3/package/server_actions.rb in depot3-3.0.26

- old
+ new

@@ -279,11 +279,11 @@ else code = args[:source] end # get the new script into the JSS - script = JSS::Script.new :id => :new, :name => args[:script_name] + script = JSS::Script.make :name => args[:script_name] script.contents = code script.category = args[:script_category] new_script_id = script.save # update our knowledge of all JSS scripts so the next steps don't fail. @@ -304,11 +304,11 @@ self.post_remove_script_id = new_script_id end # delete the old? if args[:delete_current] and old_script_id - JSS::Script.new(:id => old_script_id).delete if JSS::Script.all_ids.include? old_script_id + JSS::Script.fetch(:id => old_script_id).delete if JSS::Script.all_ids.include? old_script_id end new_script_id end # new_script @@ -344,11 +344,11 @@ deprecated_ids_to_keep.compact! # delete them if we should deprecated_ids.each do |id| next if deprecated_ids_to_keep.include? id - victim = D3::Package.new(:id => id) + victim = D3::Package.fetch(:id => id) victim.delete( admin: admin, keep_scripts: false, keep_in_jss: false, rwpw: D3::Admin::Auth.rw_credentials(:dist)[:password] @@ -376,10 +376,10 @@ end # delete them if we should skipped_ids.each do |id| next if skipped_ids_to_keep.include? id - victim = D3::Package.new(:id => id) + victim = D3::Package.fetch(:id => id) victim.delete( admin: admin, keep_scripts: false, keep_in_jss: false, rwpw: D3::Admin::Auth.rw_credentials(:dist)[:password]