lib/jss/api_object/package.rb in ruby-jss-0.9.2 vs lib/jss/api_object/package.rb in ruby-jss-0.10.0a1

- old
+ new

@@ -420,11 +420,11 @@ ### def switch_with_package=(new_val) return nil if new_val == @switch_with_package new_val = nil if new_val.to_s.empty? - raise JSS::NoSuchItemError, "No package named '#{new_val}' exists in the JSS" if new_val && (!self.class.all_names.include? new_val) + raise JSS::NoSuchItemError, "No package named '#{new_val}' exists in the JSS" if new_val && (!self.class.all_names(api: @api).include? new_val) new_val ||= DO_NOT_INSTALL @switch_with_package = new_val @need_to_update = true end @@ -458,11 +458,11 @@ ### @return [void] ### def upload_master_file(local_file_path, rw_pw, unmount = true) raise JSS::NoSuchItemError, 'Please create this package in the JSS before uploading it.' unless @in_jss - mdp = JSS::DistributionPoint.master_distribution_point + mdp = JSS::DistributionPoint.master_distribution_point api: @api destination = mdp.mount(rw_pw, :rw) + "#{DIST_POINT_PKGS_FOLDER}/#{@filename}" local_path = Pathname.new local_file_path raise JSS::NoSuchItemError, "Local file '#{@local_file}' doesn't exist" unless local_path.exist? @@ -518,11 +518,11 @@ ### ### @return [nil] ### def update_master_filename(old_file_name, new_file_name, rw_pw, unmount = true) raise JSS::NoSuchItemError, "#{old_file_name} does not exist in the jss." unless @in_jss - mdp = JSS::DistributionPoint.master_distribution_point + mdp = JSS::DistributionPoint.master_distribution_point api: @api pkgs_dir = mdp.mount(rw_pw, :rw) + DIST_POINT_PKGS_FOLDER.to_s old_file = pkgs_dir + old_file_name raise JSS::NoSuchItemError, "File not found on the master distribution point at #{DIST_POINT_PKGS_FOLDER}/#{old_file_name}." unless \ old_file.exist? @@ -546,11 +546,11 @@ ### @param unmount[Boolean] whether or not ot unount the distribution point when finished. ### ### @return [Boolean] was the file deleted? ### def delete_master_file(rw_pw, unmount = true) - mdp = JSS::DistributionPoint.master_distribution_point + mdp = JSS::DistributionPoint.master_distribution_point api: @api file = mdp.mount(rw_pw, :rw) + "#{DIST_POINT_PKGS_FOLDER}/#{@filename}" if file.exist? file.delete did_it = true else @@ -629,21 +629,21 @@ # in <9.72: jamf install -package foo.pkg -path http://mycasper.myorg.edu/CasperShare/Packages # but # in >=9.72: jamf install -package foo.pkg -path http://mycasper.myorg.edu/CasperShare/Packages/foo.pkg # append_at_vers = JSS.parse_jss_version('9.72')[:version] - our_vers = JSS.parse_jss_version(JSS.api_connection.server.raw_version)[:version] + our_vers = JSS.parse_jss_version(@api.server.raw_version)[:version] no_filename_in_url = (our_vers < append_at_vers) # use a provided alternative url for an http download if args[:alt_download_url] # we'll re-add the filename below if needed. src_path = args[:alt_download_url].chomp "/#{@filename}" # use our appropriate dist. point for download else - mdp = JSS::DistributionPoint.my_distribution_point + mdp = JSS::DistributionPoint.my_distribution_point api: @api ### how do we access our dist. point? with http? if mdp.http_downloads_enabled && !(args[:no_http]) using_http = true src_path = mdp.http_url