bin/d3helper in depot3-3.0.20 vs bin/d3helper in depot3-3.0.21
- old
+ new
@@ -54,10 +54,11 @@
ACTIONS = {
"--display-puppy-notification" => :display_puppy_notification,
"--rcpts-for-ea" => :rcpts_for_ea,
"--puppyq-for-ea" => :puppyq_for_ea,
+ "--import-jamf-receipts" => :import_receipts,
"--import-casper-receipts" => :import_receipts,
"--help" => :help,
"--version" => :show_version
}
@@ -78,10 +79,11 @@
ARGV << "--debug" if D3::DEBUG_FILE.exist?
opts = GetoptLong.new(
[ '--help', '-h', '-H', GetoptLong::NO_ARGUMENT ],
[ '--debug', '-d', GetoptLong::NO_ARGUMENT ],
+ [ '--import-jamf-receipts', GetoptLong::NO_ARGUMENT ],
[ '--import-casper-receipts', GetoptLong::NO_ARGUMENT ],
[ '--display-puppy-notification', GetoptLong::NO_ARGUMENT ],
[ '--rcpts-for-ea', GetoptLong::NO_ARGUMENT ],
[ '--puppyq-for-ea', GetoptLong::NO_ARGUMENT ],
[ '--version', '-v', GetoptLong::NO_ARGUMENT ],
@@ -94,10 +96,12 @@
@action = ACTIONS[opt]
when '--version'
@action = ACTIONS[opt]
when '--debug'
@debug = true
+ when '--import-jamf-receipts'
+ @action = ACTIONS[opt]
when '--import-casper-receipts'
@action = ACTIONS[opt]
when '--display-puppy-notification'
@action = ACTIONS[opt]
when '--rcpts-for-ea'
@@ -145,11 +149,11 @@
puts <<-USAGEBLURB
#{USAGE}
--display-puppy-notification Tell users that puppies need walking.
- --import-casper-receipts Import local Casper package receipts into
+ --import-jamf-receipts Import local Jamf Pro package receipts into
d3 receipts. Can be run repeatedly to
import for packages new to d3.
--rcpts-for-ea Generate Extension Attribute data about
the d3 receipts on this machine.
--help, -h, -H Show this help.
@@ -269,11 +273,11 @@
###
def import_receipts
- D3.log "Importing Casper Receipts for packages in d3", :warn
+ D3.log "Importing Jamf Pro Receipts for packages in d3", :warn
# this gets us a hash of jss package filenames -> pkg ids
d3_pkg_filenames = D3::Package.all_filenames.invert
# this is an array of current d3 receipt ids
@@ -298,11 +302,11 @@
# already been imported
next if d3_rcpt_ids.include? pkg_id
# If we're here, we need to import the receipt, so get the matching D3
# package and make a receipt from it.
- D3.log "Importing Casper Receipt #{jss_rcpt_name}", :warn
+ D3.log "Importing Jamf Pro Receipt #{jss_rcpt_name}", :warn
begin
d3_pkg = D3::Package.new id: pkg_id
# do we already have a rcpt for the package's basename? if so,
@@ -315,11 +319,11 @@
d3_rcpt = D3::Client::Receipt.new(
:basename => d3_pkg.basename,
:version => d3_pkg.version,
:revision => d3_pkg.revision,
- :admin => "imported-from-casper",
+ :admin => "imported-from-jamf",
:id => d3_pkg.id,
:status => d3_pkg.status ,
:jamf_rcpt_file => jss_rcpt,
:apple_pkg_ids => d3_pkg.apple_receipt_data.map{|rd| rd[:apple_pkg_id]},
:installed_at => jss_rcpt.mtime,
@@ -330,15 +334,15 @@
:pre_remove_script_id => d3_pkg.pre_remove_script_id,
:post_remove_script_id => d3_pkg.post_remove_script_id
)
D3::Client::Receipt.add_receipt d3_rcpt, :replace
rescue
- D3.log "ERROR importing Casper Receipt #{jss_rcpt_name}: #{$!}", :error
+ D3.log "ERROR importing Jamf Pro Receipt #{jss_rcpt_name}: #{$!}", :error
end
end #JSS::Client.receipts.each do |jss_rcpt|
- D3.log "Done importing Casper Receipts for packages in d3", :warn
+ D3.log "Done importing Jamf Pro Receipts for packages in d3", :warn
end #import_receipts
end # class App