depot3 0.0.0a1 → 3.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +55 -1
- data/bin/d3 +323 -0
- data/bin/d3admin +1011 -0
- data/bin/d3helper +354 -0
- data/bin/puppytime +334 -0
- data/data/d3/com.pixar.d3.RepoMan.plist +23 -0
- data/data/d3/d3.conf.example +507 -0
- data/data/d3/d3RepoMan.app/Contents/Frameworks/libswiftAppKit.dylib +0 -0
- data/data/d3/d3RepoMan.app/Contents/Frameworks/libswiftCore.dylib +0 -0
- data/data/d3/d3RepoMan.app/Contents/Frameworks/libswiftCoreData.dylib +0 -0
- data/data/d3/d3RepoMan.app/Contents/Frameworks/libswiftCoreGraphics.dylib +0 -0
- data/data/d3/d3RepoMan.app/Contents/Frameworks/libswiftCoreImage.dylib +0 -0
- data/data/d3/d3RepoMan.app/Contents/Frameworks/libswiftDarwin.dylib +0 -0
- data/data/d3/d3RepoMan.app/Contents/Frameworks/libswiftDispatch.dylib +0 -0
- data/data/d3/d3RepoMan.app/Contents/Frameworks/libswiftFoundation.dylib +0 -0
- data/data/d3/d3RepoMan.app/Contents/Frameworks/libswiftObjectiveC.dylib +0 -0
- data/data/d3/d3RepoMan.app/Contents/Info.plist +56 -0
- data/data/d3/d3RepoMan.app/Contents/MacOS/d3RepoMan +0 -0
- data/data/d3/d3RepoMan.app/Contents/PkgInfo +1 -0
- data/data/d3/d3RepoMan.app/Contents/Resources/Base.lproj/MainMenu.nib +0 -0
- data/data/d3/d3RepoMan.app/Contents/Resources/last-foreground-times-template.plist +5 -0
- data/data/d3/d3RepoMan.app/Contents/_CodeSignature/CodeResources +214 -0
- data/data/d3/puppytime/ImageLicenses.txt +165 -0
- data/data/d3/puppytime/notification_image +1 -0
- data/data/d3/puppytime/opt_out_image +1 -0
- data/data/d3/puppytime/slideshow/2008-07-11_White_German_Shepherd_pup_chilling_at_the_Coker_Arboretum.jpg +0 -0
- data/data/d3/puppytime/slideshow/2009-04-21_APBT_pup_on_deck.jpg +0 -0
- data/data/d3/puppytime/slideshow/A_puppy_Yorkie.jpg +0 -0
- data/data/d3/puppytime/slideshow/Alert_Pug_Puppy.jpg +0 -0
- data/data/d3/puppytime/slideshow/Australian_Cattle_Dog_puppies_04.JPG +0 -0
- data/data/d3/puppytime/slideshow/Beagle_puppy_Cadet.jpg +0 -0
- data/data/d3/puppytime/slideshow/Bernese_Mountain_Dog.jpg +0 -0
- data/data/d3/puppytime/slideshow/Bloodhound_Puppy.jpg +0 -0
- data/data/d3/puppytime/slideshow/Boston_terrier_with_toy.jpg +0 -0
- data/data/d3/puppytime/slideshow/Boxer_puppy_fawn_portrai.jpg +0 -0
- data/data/d3/puppytime/slideshow/Caracal_kitten.jpg +0 -0
- data/data/d3/puppytime/slideshow/Chihuahua_&_Doberman_Pup.jpg +0 -0
- data/data/d3/puppytime/slideshow/Cuccioli_di_Margot_a_35_gg_Basenjis.jpg +0 -0
- data/data/d3/puppytime/slideshow/Dalmatian_puppy_03.jpg +0 -0
- data/data/d3/puppytime/slideshow/GoldenRetrieverPuppyDaisyParker.JPG +0 -0
- data/data/d3/puppytime/slideshow/Green_eyed_beige_Chihuahua.jpg +0 -0
- data/data/d3/puppytime/slideshow/Let_Sleeping_Dogs_Lie.jpg +0 -0
- data/data/d3/puppytime/slideshow/Meatball_-_French_Bulldog_Puppy.jpg +0 -0
- data/data/d3/puppytime/slideshow/Oola_-_9_weeks.jpg +0 -0
- data/data/d3/puppytime/slideshow/Pancho0008.JPG +0 -0
- data/data/d3/puppytime/slideshow/Pomeranian_orange-sable_Coco.jpg +0 -0
- data/data/d3/puppytime/slideshow/Pug_puppy_001.jpg +0 -0
- data/data/d3/puppytime/slideshow/Puggle_puppy_6_weeks.JPG +0 -0
- data/data/d3/puppytime/slideshow/Puli_kan.jpg +0 -0
- data/data/d3/puppytime/slideshow/Puppy_French_Bulldog.jpg +0 -0
- data/data/d3/puppytime/slideshow/Rocco_the_Bulldog.jpg +0 -0
- data/data/d3/puppytime/slideshow/Rottweiler_Face.jpg +0 -0
- data/data/d3/puppytime/slideshow/Saint_Bernard_puppy.jpg +0 -0
- data/data/d3/puppytime/slideshow/Scottish_froment.jpg +0 -0
- data/data/d3/puppytime/slideshow/Shar_pei_puppy_(age_2_months).jpg +0 -0
- data/data/d3/puppytime/slideshow/Shiba-Inu_beim_Spielen_im_Schnee.JPG +0 -0
- data/data/d3/puppytime/slideshow/Smooth-coat_Border_Collie_puppy..jpg +0 -0
- data/data/d3/puppytime/slideshow/Smooth_Dachshund_puppies.jpg +0 -0
- data/data/d3/puppytime/slideshow/Snow_dog.jpg +0 -0
- data/data/d3/puppytime/slideshow/Taylor_the_Pembroke_Welsh_Corgi.png +0 -0
- data/data/d3/puppytime/slideshow/Weim_Pups_001.jpg +0 -0
- data/data/d3/puppytime/slideshow/Westie_pups.jpg +0 -0
- data/data/d3/puppytime/slideshow/Yellow_Labrador_puppies_(4165737325).jpg +0 -0
- data/lib/d3/admin/add.rb +451 -0
- data/lib/d3/admin/auth.rb +470 -0
- data/lib/d3/admin/edit.rb +297 -0
- data/lib/d3/admin/help.rb +396 -0
- data/lib/d3/admin/interactive.rb +972 -0
- data/lib/d3/admin/options.rb +454 -0
- data/lib/d3/admin/prefs.rb +204 -0
- data/lib/d3/admin/report.rb +727 -0
- data/lib/d3/admin/state.rb +42 -0
- data/lib/d3/admin/validate.rb +413 -0
- data/lib/d3/admin.rb +42 -0
- data/lib/d3/basename.rb +217 -0
- data/lib/d3/client/auth.rb +108 -0
- data/lib/d3/client/class_methods.rb +766 -0
- data/lib/d3/client/class_variables.rb +47 -0
- data/lib/d3/client/cli.rb +187 -0
- data/lib/d3/client/environment.rb +134 -0
- data/lib/d3/client/help.rb +110 -0
- data/lib/d3/client/lists.rb +314 -0
- data/lib/d3/client/receipt.rb +1173 -0
- data/lib/d3/client.rb +45 -0
- data/lib/d3/configuration.rb +319 -0
- data/lib/d3/constants.rb +60 -0
- data/lib/d3/database.rb +488 -0
- data/lib/d3/exceptions.rb +44 -0
- data/lib/d3/log.rb +271 -0
- data/lib/d3/package/aliases.rb +80 -0
- data/lib/d3/package/attributes.rb +97 -0
- data/lib/d3/package/class_methods.rb +817 -0
- data/lib/d3/package/class_variables.rb +46 -0
- data/lib/d3/package/client_actions.rb +293 -0
- data/lib/d3/package/constants.rb +58 -0
- data/lib/d3/package/constructor.rb +191 -0
- data/lib/d3/package/getters.rb +164 -0
- data/lib/d3/package/mixins.rb +39 -0
- data/lib/d3/package/private_methods.rb +227 -0
- data/lib/d3/package/questions.rb +95 -0
- data/lib/d3/package/server_actions.rb +683 -0
- data/lib/d3/package/setters.rb +326 -0
- data/lib/d3/package/validate.rb +448 -0
- data/lib/d3/package.rb +51 -0
- data/lib/d3/puppytime/pending_puppy.rb +108 -0
- data/lib/d3/puppytime/puppy_queue.rb +274 -0
- data/lib/d3/puppytime.rb +68 -0
- data/lib/d3/state.rb +105 -0
- data/lib/d3/utility.rb +325 -0
- data/lib/d3/version.rb +1 -1
- metadata +162 -9
@@ -0,0 +1,454 @@
|
|
1
|
+
### Copyright 2016 Pixar
|
2
|
+
###
|
3
|
+
### Licensed under the Apache License, Version 2.0 (the "Apache License")
|
4
|
+
### with the following modification; you may not use this file except in
|
5
|
+
### compliance with the Apache License and the following modification to it:
|
6
|
+
### Section 6. Trademarks. is deleted and replaced with:
|
7
|
+
###
|
8
|
+
### 6. Trademarks. This License does not grant permission to use the trade
|
9
|
+
### names, trademarks, service marks, or product names of the Licensor
|
10
|
+
### and its affiliates, except as required to comply with Section 4(c) of
|
11
|
+
### the License and to reproduce the content of the NOTICE file.
|
12
|
+
###
|
13
|
+
### You may obtain a copy of the Apache License at
|
14
|
+
###
|
15
|
+
### http://www.apache.org/licenses/LICENSE-2.0
|
16
|
+
###
|
17
|
+
### Unless required by applicable law or agreed to in writing, software
|
18
|
+
### distributed under the Apache License with the above modification is
|
19
|
+
### distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
20
|
+
### KIND, either express or implied. See the Apache License for the specific
|
21
|
+
### language governing permissions and limitations under the Apache License.
|
22
|
+
###
|
23
|
+
###
|
24
|
+
|
25
|
+
|
26
|
+
module D3
|
27
|
+
module Admin
|
28
|
+
|
29
|
+
# all the available actions
|
30
|
+
ACTIONS = %w{ add edit live delete info search report config help }
|
31
|
+
|
32
|
+
# these actions write to the server and
|
33
|
+
# need a legit admin, not one
|
34
|
+
# listed in D3.badmins.
|
35
|
+
#
|
36
|
+
ACTIONS_NEEDING_ADMIN = %w{ add edit live delete }
|
37
|
+
|
38
|
+
# the possible targets to config
|
39
|
+
CONFIG_TARGETS = %w{all jss db dist workspace pkg-id-prefix}
|
40
|
+
|
41
|
+
|
42
|
+
TRUE_VALUES = [true, /^true$/i, 1, /^y(es)?$/i]
|
43
|
+
FALSE_VALUES = [false, /^false$/i, nil, 0, /^no?$/i]
|
44
|
+
|
45
|
+
DFT_REQUIRED = "---Required---"
|
46
|
+
DFT_NONE = "none"
|
47
|
+
DFT_PKG_TYPE = :pkg
|
48
|
+
DFT_PKG_ID_PREFIX = "d3"
|
49
|
+
DFT_WORKSPACE = ENV['HOME']
|
50
|
+
DFT_EXPIRATION = 0
|
51
|
+
DFT_LIST_TYPE = :all
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
DISPLAY_TRUE_FALSE = Proc.new {|v| case v ; when *TRUE_VALUES then "true"; when *FALSE_VALUES then "false"; else "unknown" ; end }
|
56
|
+
DISPLAY_DFT_REQUIRED = Proc.new {|v| v.to_s.empty? ? DFT_REQUIRED : v }
|
57
|
+
DISPLAY_DFT_NONE = Proc.new{|v| v.to_s.empty? ? DFT_NONE : v }
|
58
|
+
DISPLAY_COMMA_SEP_LIST = Proc.new{|v| DISPLAY_DFT_NONE.call JSS.to_s_and_a(v)[:stringform] }
|
59
|
+
DISPLAY_PKG_TYPE = Proc.new{|v| v.to_s.start_with?('d') ? 'dmg' : 'pkg' }
|
60
|
+
DISPLAY_LIST_TYPE = Proc.new{|v| v.to_s.empty? ? DFT_LIST_TYPE : v }
|
61
|
+
|
62
|
+
# This hash provides details about how to handle all possible CLI option
|
63
|
+
# values for d3admin, be they input from the command-line or via a walkthru
|
64
|
+
#
|
65
|
+
# Each key matches a key/method in the @options OpenStruct in d3admin.
|
66
|
+
# representing the value for that option from the commandline.
|
67
|
+
#
|
68
|
+
# For each one, there is a sub-hash defining these things:
|
69
|
+
#
|
70
|
+
# :default => The global default value, before applying any
|
71
|
+
# inherited values from older pkgs, or user-specified values
|
72
|
+
# from the commandline or walkthru. Note these are the Ruby internal
|
73
|
+
# default values (e.g. nil) NOT the cli option default values
|
74
|
+
# (e.g. 'n') which are defined in the d3admins parse_cli method.
|
75
|
+
#
|
76
|
+
# :cli => the GetoptLong array for this commandline option
|
77
|
+
#
|
78
|
+
# :label => The lable for the value when when prompting for input
|
79
|
+
# or showing formatted details of the pkg.
|
80
|
+
#
|
81
|
+
# :display_conversion => A proc that converts the internally-used form of a value
|
82
|
+
# to something more human-readable
|
83
|
+
# (e.g. "none" instead of an empty string for a nil value)
|
84
|
+
#
|
85
|
+
# :get => the get_ method from D3::Admin::Interactive that is used to prompt for
|
86
|
+
# a new value for the attribute.
|
87
|
+
#
|
88
|
+
# :unsetable => This option can take "none" or "n" to set its value to nil
|
89
|
+
#
|
90
|
+
# :validate => the method from D3::Admin::Validate used to validate the
|
91
|
+
# value being provided and convert it to its internally-used form
|
92
|
+
#
|
93
|
+
#
|
94
|
+
OPTIONS = {
|
95
|
+
|
96
|
+
# General
|
97
|
+
help: {
|
98
|
+
:default => nil,
|
99
|
+
:cli => [ '--help', "-h", GetoptLong::NO_ARGUMENT ],
|
100
|
+
:label => "View help",
|
101
|
+
:display_conversion => DISPLAY_TRUE_FALSE,
|
102
|
+
:get => nil,
|
103
|
+
:validate => nil
|
104
|
+
},
|
105
|
+
extended_help: {
|
106
|
+
:default => nil,
|
107
|
+
:cli => [ '--extended-help','-H', GetoptLong::NO_ARGUMENT ],
|
108
|
+
:label => "View extended help",
|
109
|
+
:display_conversion => DISPLAY_TRUE_FALSE,
|
110
|
+
:get => nil,
|
111
|
+
:validate => nil
|
112
|
+
},
|
113
|
+
walkthru: {
|
114
|
+
:default => nil,
|
115
|
+
:cli => [ '--walkthru','-w', GetoptLong::NO_ARGUMENT ],
|
116
|
+
:label => "Walk-through",
|
117
|
+
:display_conversion => DISPLAY_TRUE_FALSE,
|
118
|
+
:get => nil,
|
119
|
+
:validate => nil
|
120
|
+
},
|
121
|
+
auto_confirm: {
|
122
|
+
:default => nil,
|
123
|
+
:cli => [ '--auto-confirm','-a', GetoptLong::NO_ARGUMENT ],
|
124
|
+
:label => "Auto-confirm",
|
125
|
+
:display_conversion => DISPLAY_TRUE_FALSE,
|
126
|
+
:get => nil,
|
127
|
+
:validate => nil
|
128
|
+
},
|
129
|
+
|
130
|
+
# Package Identification: Add/Edit/Info/Delete
|
131
|
+
|
132
|
+
package_name: {
|
133
|
+
:default => nil,
|
134
|
+
:cli => [ '--package-name', '-n', GetoptLong::REQUIRED_ARGUMENT ],
|
135
|
+
:label => "JSS Package Name",
|
136
|
+
:display_conversion => nil,
|
137
|
+
:get => :get_package_name,
|
138
|
+
:validate => :validate_package_name
|
139
|
+
},
|
140
|
+
filename: {
|
141
|
+
:default => nil,
|
142
|
+
:cli => [ '--filename', '-f', GetoptLong::REQUIRED_ARGUMENT ],
|
143
|
+
:label => "Dist. Point Filename",
|
144
|
+
:display_conversion => nil,
|
145
|
+
:get => :get_filename,
|
146
|
+
:validate => :validate_filename
|
147
|
+
},
|
148
|
+
|
149
|
+
# Add
|
150
|
+
|
151
|
+
import: {
|
152
|
+
:default => nil,
|
153
|
+
:cli => [ '--import', "-i", GetoptLong::OPTIONAL_ARGUMENT ],
|
154
|
+
:label => "Import existing JSS package",
|
155
|
+
:display_conversion => nil,
|
156
|
+
:get => :get_jss_package_for_import,
|
157
|
+
:validate => :validate_package_for_import
|
158
|
+
},
|
159
|
+
no_inherit: {
|
160
|
+
:default => nil,
|
161
|
+
:cli => [ '--no-inherit', "-I", GetoptLong::NO_ARGUMENT ],
|
162
|
+
:label => "Do not inherit from older pacakge",
|
163
|
+
:display_conversion => DISPLAY_TRUE_FALSE,
|
164
|
+
:get => nil,
|
165
|
+
:validate => nil
|
166
|
+
},
|
167
|
+
source_path: {
|
168
|
+
:default => nil,
|
169
|
+
:cli => [ '--source-path', '-s', GetoptLong::REQUIRED_ARGUMENT ],
|
170
|
+
:label => "Source path",
|
171
|
+
:display_conversion => DISPLAY_DFT_REQUIRED,
|
172
|
+
:get => :get_source_path,
|
173
|
+
:validate => :validate_source_path
|
174
|
+
},
|
175
|
+
package_build_type: {
|
176
|
+
:default => DFT_PKG_TYPE,
|
177
|
+
:cli => [ '--dmg', GetoptLong::NO_ARGUMENT ],
|
178
|
+
:label => "Package build type",
|
179
|
+
:display_conversion => DISPLAY_PKG_TYPE,
|
180
|
+
:get => :get_package_build_type,
|
181
|
+
:validate => :validate_package_build_type
|
182
|
+
},
|
183
|
+
pkg_preserve_owners: {
|
184
|
+
:default => nil,
|
185
|
+
:cli => [ '--preserve-owners', GetoptLong::NO_ARGUMENT ],
|
186
|
+
:label => "Preserve ownership in .pkg",
|
187
|
+
:display_conversion => DISPLAY_TRUE_FALSE,
|
188
|
+
:get => :get_pkg_preserve_owners,
|
189
|
+
:validate => :validate_yes_no
|
190
|
+
},
|
191
|
+
pkg_identifier: {
|
192
|
+
:default => nil,
|
193
|
+
:cli => [ '--pkg-id', '-p', GetoptLong::REQUIRED_ARGUMENT ],
|
194
|
+
:label => "Package identifier prefix",
|
195
|
+
:display_conversion => nil,
|
196
|
+
:get => :get_pkg_identifier,
|
197
|
+
:validate => :validate_package_identifier
|
198
|
+
},
|
199
|
+
workspace: {
|
200
|
+
:default => DFT_WORKSPACE,
|
201
|
+
:cli => [ '--workspace', '-W', GetoptLong::REQUIRED_ARGUMENT ],
|
202
|
+
:label => "Package build workspace",
|
203
|
+
:display_conversion => nil,
|
204
|
+
:get => :get_workspace,
|
205
|
+
:validate => :validate_workspace
|
206
|
+
},
|
207
|
+
|
208
|
+
# Add/Edit
|
209
|
+
version: {
|
210
|
+
:default => "1",
|
211
|
+
:cli => [ '--version', '-v', GetoptLong::REQUIRED_ARGUMENT ],
|
212
|
+
:label => "Version",
|
213
|
+
:display_conversion => DISPLAY_DFT_REQUIRED,
|
214
|
+
:get => :get_version,
|
215
|
+
:validate => :validate_version
|
216
|
+
},
|
217
|
+
revision: {
|
218
|
+
:default => 1,
|
219
|
+
:cli => [ '--revision', '-r', GetoptLong::REQUIRED_ARGUMENT ],
|
220
|
+
:label => "Revision",
|
221
|
+
:display_conversion => DISPLAY_DFT_REQUIRED,
|
222
|
+
:get => :get_revision,
|
223
|
+
:validate => :validate_revision
|
224
|
+
},
|
225
|
+
category: {
|
226
|
+
:default => D3::CONFIG.jss_default_pkg_category,
|
227
|
+
:cli => [ '--category', '-C', GetoptLong::REQUIRED_ARGUMENT ],
|
228
|
+
:label => "Category",
|
229
|
+
:display_conversion => nil,
|
230
|
+
:get => :get_category,
|
231
|
+
:unsetable => true,
|
232
|
+
:validate => :validate_category
|
233
|
+
},
|
234
|
+
oses: {
|
235
|
+
:default => nil,
|
236
|
+
:cli => [ '--oses', '-o', GetoptLong::REQUIRED_ARGUMENT ],
|
237
|
+
:label => "Limited to OS's",
|
238
|
+
:display_conversion => DISPLAY_COMMA_SEP_LIST,
|
239
|
+
:get => :get_oses,
|
240
|
+
:unsetable => true,
|
241
|
+
:validate => :validate_oses
|
242
|
+
},
|
243
|
+
cpu_type: {
|
244
|
+
:default => nil,
|
245
|
+
:cli => [ '--cpu_type', '-c', GetoptLong::REQUIRED_ARGUMENT ],
|
246
|
+
:label => "Limited to CPU type",
|
247
|
+
:display_conversion => DISPLAY_DFT_NONE,
|
248
|
+
:get => :get_cpu_type,
|
249
|
+
:unsetable => true,
|
250
|
+
:validate => :validate_cpu_type
|
251
|
+
},
|
252
|
+
reboot: {
|
253
|
+
:default => false,
|
254
|
+
:cli => [ '--reboot', '-R', GetoptLong::OPTIONAL_ARGUMENT ],
|
255
|
+
:label => "Needs Reboot",
|
256
|
+
:display_conversion => DISPLAY_TRUE_FALSE,
|
257
|
+
:get => :get_reboot,
|
258
|
+
:validate => :validate_yes_no
|
259
|
+
},
|
260
|
+
removable: {
|
261
|
+
:default => true,
|
262
|
+
:cli => [ '--removable', '-u', GetoptLong::OPTIONAL_ARGUMENT ],
|
263
|
+
:label => "Uninstallable",
|
264
|
+
:display_conversion => DISPLAY_TRUE_FALSE,
|
265
|
+
:get => :get_removable,
|
266
|
+
:validate => :validate_yes_no
|
267
|
+
},
|
268
|
+
remove_first: {
|
269
|
+
:default => false,
|
270
|
+
:cli => [ '--remove-first', '-F', GetoptLong::OPTIONAL_ARGUMENT ],
|
271
|
+
:label => "Uninstalls older installs",
|
272
|
+
:display_conversion => DISPLAY_TRUE_FALSE,
|
273
|
+
:get => :get_remove_first,
|
274
|
+
:validate => :validate_yes_no
|
275
|
+
},
|
276
|
+
prohibiting_process: {
|
277
|
+
:default => nil,
|
278
|
+
:cli => [ '--prohibiting-process', '-x', GetoptLong::REQUIRED_ARGUMENT ],
|
279
|
+
:label => "Installation prohibited by processes matching",
|
280
|
+
:display_conversion => DISPLAY_DFT_NONE,
|
281
|
+
:get => :get_prohibiting_process,
|
282
|
+
:unsetable => true,
|
283
|
+
:validate => :validate_prohibiting_process
|
284
|
+
},
|
285
|
+
auto_groups: {
|
286
|
+
:default => nil,
|
287
|
+
:cli => [ '--auto-groups', '-g', GetoptLong::REQUIRED_ARGUMENT ],
|
288
|
+
:label => "Auto installed for groups",
|
289
|
+
:display_conversion => DISPLAY_COMMA_SEP_LIST,
|
290
|
+
:get => :get_auto_groups,
|
291
|
+
:validate => :validate_auto_groups,
|
292
|
+
:unsetable => true,
|
293
|
+
:compare => Proc.new{|o,n| o.to_a.sort == n.to_a.sort}
|
294
|
+
},
|
295
|
+
excluded_groups: {
|
296
|
+
:default => nil,
|
297
|
+
:cli => [ '--excluded-groups', '-G', GetoptLong::REQUIRED_ARGUMENT ],
|
298
|
+
:label => "Excluded for groups",
|
299
|
+
:display_conversion => DISPLAY_COMMA_SEP_LIST,
|
300
|
+
:get => :get_excluded_groups,
|
301
|
+
:validate => :validate_excluded_groups,
|
302
|
+
:unsetable => true,
|
303
|
+
:compare => Proc.new{|o,n| o.to_a.sort == n.to_a.sort}
|
304
|
+
},
|
305
|
+
pre_install: {
|
306
|
+
:default => nil,
|
307
|
+
:cli => [ '--pre-install', '-e', GetoptLong::REQUIRED_ARGUMENT ],
|
308
|
+
:label => "Pre-install script",
|
309
|
+
:display_conversion => DISPLAY_DFT_NONE,
|
310
|
+
:get => :get_pre_install_script,
|
311
|
+
:unsetable => true,
|
312
|
+
:validate => :validate_pre_install_script
|
313
|
+
},
|
314
|
+
post_install: {
|
315
|
+
:default => nil,
|
316
|
+
:cli => [ '--post-install', '-t', GetoptLong::REQUIRED_ARGUMENT ],
|
317
|
+
:label => "Post-install script",
|
318
|
+
:display_conversion => DISPLAY_DFT_NONE,
|
319
|
+
:get => :get_post_install_script,
|
320
|
+
:unsetable => true,
|
321
|
+
:validate => :validate_post_install_script
|
322
|
+
},
|
323
|
+
pre_remove: {
|
324
|
+
:default => nil,
|
325
|
+
:cli => [ '--pre-remove', '-E', GetoptLong::REQUIRED_ARGUMENT ],
|
326
|
+
:label => "Pre-uninstall script",
|
327
|
+
:display_conversion => DISPLAY_DFT_NONE,
|
328
|
+
:get => :get_pre_remove_script,
|
329
|
+
:unsetable => true,
|
330
|
+
:validate => :validate_pre_remove_script
|
331
|
+
},
|
332
|
+
post_remove: {
|
333
|
+
:default => nil,
|
334
|
+
:cli => [ '--post-remove', '-T', GetoptLong::REQUIRED_ARGUMENT ],
|
335
|
+
:label => "Post-uninstall script",
|
336
|
+
:display_conversion => DISPLAY_DFT_NONE,
|
337
|
+
:get => :get_post_remove_script,
|
338
|
+
:unsetable => true,
|
339
|
+
:validate => :validate_post_remove_script
|
340
|
+
},
|
341
|
+
expiration: {
|
342
|
+
:default => DFT_EXPIRATION,
|
343
|
+
:cli => [ '--expiration', '-X', GetoptLong::REQUIRED_ARGUMENT ],
|
344
|
+
:label => "Expiration",
|
345
|
+
:display_conversion => nil,
|
346
|
+
:get => :get_expiration,
|
347
|
+
:unsetable => true,
|
348
|
+
:validate => :validate_expiration
|
349
|
+
},
|
350
|
+
expiration_path: {
|
351
|
+
:default => nil,
|
352
|
+
:cli => [ '--expiration-path', '-P', GetoptLong::REQUIRED_ARGUMENT ],
|
353
|
+
:label=> "Expiration Path",
|
354
|
+
:display_conversion => DISPLAY_DFT_NONE,
|
355
|
+
:get => :get_expiration_path,
|
356
|
+
:unsetable => true,
|
357
|
+
:validate => :validate_expiration_path
|
358
|
+
},
|
359
|
+
description: {
|
360
|
+
:default => '',
|
361
|
+
:cli => [ '--description', '-d', GetoptLong::REQUIRED_ARGUMENT ],
|
362
|
+
:label => "Description",
|
363
|
+
:display_conversion => Proc.new{|v| "\n----\n#{v.to_s.gsub("\r", "\n")}\n----"},
|
364
|
+
:get => :get_description,
|
365
|
+
:unsetable => true,
|
366
|
+
:validate => nil
|
367
|
+
},
|
368
|
+
|
369
|
+
# Search and Report
|
370
|
+
status: {
|
371
|
+
:default => nil,
|
372
|
+
:cli => [ '--status', '-S', GetoptLong::REQUIRED_ARGUMENT ],
|
373
|
+
:label => "Status for search and report",
|
374
|
+
:display_conversion => DISPLAY_LIST_TYPE,
|
375
|
+
:get => :get_scoped_groups,
|
376
|
+
:validate => :validate_scoped_groups
|
377
|
+
},
|
378
|
+
|
379
|
+
frozen: {
|
380
|
+
:default => nil,
|
381
|
+
:cli => [ '--frozen', '-z', GetoptLong::NO_ARGUMENT ],
|
382
|
+
:label => "Report frozen receipts",
|
383
|
+
:display_conversion => DISPLAY_LIST_TYPE,
|
384
|
+
:get => :get_scoped_groups,
|
385
|
+
:validate => :validate_scoped_groups
|
386
|
+
},
|
387
|
+
|
388
|
+
queue: {
|
389
|
+
:default => nil,
|
390
|
+
:cli => [ '--queue', '-q', GetoptLong::NO_ARGUMENT ],
|
391
|
+
:label => "Report pending puppies rather than receipts",
|
392
|
+
:display_conversion => DISPLAY_LIST_TYPE,
|
393
|
+
:get => :get_scoped_groups,
|
394
|
+
:validate => :validate_scoped_groups
|
395
|
+
},
|
396
|
+
|
397
|
+
computers: {
|
398
|
+
:default => nil,
|
399
|
+
:cli => [ '--computers', GetoptLong::NO_ARGUMENT ],
|
400
|
+
:label => "Report targets are computers, not basenames",
|
401
|
+
:display_conversion => DISPLAY_LIST_TYPE,
|
402
|
+
:get => :get_scoped_groups,
|
403
|
+
:validate => :validate_scoped_groups
|
404
|
+
},
|
405
|
+
|
406
|
+
groups: {
|
407
|
+
:default => nil,
|
408
|
+
:cli => [ '--groups', GetoptLong::NO_ARGUMENT ],
|
409
|
+
:label => "Search targets are scoped groups, not basenames",
|
410
|
+
:display_conversion => DISPLAY_LIST_TYPE,
|
411
|
+
:get => :get_scoped_groups,
|
412
|
+
:validate => :validate_scoped_groups
|
413
|
+
},
|
414
|
+
|
415
|
+
|
416
|
+
# Delete
|
417
|
+
delete_scripts: {
|
418
|
+
:default => nil,
|
419
|
+
:cli => [ '--delete-scripts', GetoptLong::NO_ARGUMENT ],
|
420
|
+
:label => "Delete associated scripts",
|
421
|
+
:display_conversion => DISPLAY_TRUE_FALSE,
|
422
|
+
:get => :get_delete_scripts,
|
423
|
+
:validate => :validate_yes_no
|
424
|
+
},
|
425
|
+
keep_in_jss: {
|
426
|
+
:default => nil,
|
427
|
+
:cli => [ '--keep-in-jss', GetoptLong::NO_ARGUMENT ],
|
428
|
+
:label => "Keep the Casper package",
|
429
|
+
:display_conversion => DISPLAY_TRUE_FALSE,
|
430
|
+
:get => :get_keep_in_jss,
|
431
|
+
:validate => :validate_yes_no
|
432
|
+
},
|
433
|
+
|
434
|
+
# debug
|
435
|
+
debug: {
|
436
|
+
:default => false,
|
437
|
+
:cli => [ '--debug', '-D', GetoptLong::NO_ARGUMENT ],
|
438
|
+
:label => "Be more verbose",
|
439
|
+
:display_conversion => DISPLAY_TRUE_FALSE,
|
440
|
+
:get => nil,
|
441
|
+
:validate => :validate_yes_no
|
442
|
+
},
|
443
|
+
d3_version: {
|
444
|
+
:default => false,
|
445
|
+
:cli => [ '--d3-version', GetoptLong::NO_ARGUMENT ],
|
446
|
+
:label => "Display the version of d3admin and its libraries",
|
447
|
+
:display_conversion => DISPLAY_TRUE_FALSE,
|
448
|
+
:get => nil,
|
449
|
+
:validate => nil
|
450
|
+
}
|
451
|
+
}
|
452
|
+
|
453
|
+
end # module admin
|
454
|
+
end # module D3
|
@@ -0,0 +1,204 @@
|
|
1
|
+
### Copyright 2016 Pixar
|
2
|
+
###
|
3
|
+
### Licensed under the Apache License, Version 2.0 (the "Apache License")
|
4
|
+
### with the following modification; you may not use this file except in
|
5
|
+
### compliance with the Apache License and the following modification to it:
|
6
|
+
### Section 6. Trademarks. is deleted and replaced with:
|
7
|
+
###
|
8
|
+
### 6. Trademarks. This License does not grant permission to use the trade
|
9
|
+
### names, trademarks, service marks, or product names of the Licensor
|
10
|
+
### and its affiliates, except as required to comply with Section 4(c) of
|
11
|
+
### the License and to reproduce the content of the NOTICE file.
|
12
|
+
###
|
13
|
+
### You may obtain a copy of the Apache License at
|
14
|
+
###
|
15
|
+
### http://www.apache.org/licenses/LICENSE-2.0
|
16
|
+
###
|
17
|
+
### Unless required by applicable law or agreed to in writing, software
|
18
|
+
### distributed under the Apache License with the above modification is
|
19
|
+
### distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
20
|
+
### KIND, either express or implied. See the Apache License for the specific
|
21
|
+
### language governing permissions and limitations under the Apache License.
|
22
|
+
###
|
23
|
+
###
|
24
|
+
|
25
|
+
|
26
|
+
module D3
|
27
|
+
|
28
|
+
module Admin
|
29
|
+
module Prefs
|
30
|
+
|
31
|
+
################# Admin User Prefs #################
|
32
|
+
|
33
|
+
################# Module Constants #################
|
34
|
+
|
35
|
+
PREFS_DIR = Pathname.new(ENV['HOME'].to_s).expand_path + "Library/Preferences"
|
36
|
+
PREFS_FILE = PREFS_DIR + "com.pixar.d3.admin.yaml"
|
37
|
+
|
38
|
+
PREF_KEYS = {
|
39
|
+
:workspace => {
|
40
|
+
description: "Path to the directory where new pkg and dmg packages are built.\n If unset, defaults to your home folder"
|
41
|
+
},
|
42
|
+
|
43
|
+
:editor =>{
|
44
|
+
description: "Preferred shell command for editing package descriptions in --walkthru"
|
45
|
+
},
|
46
|
+
|
47
|
+
:apple_pkg_id_prefix => {
|
48
|
+
description: "The Apple package id prefix, e.g. 'com.mycompany'.\nWhen .pkgs are built, the identifier will be this, plus the basename.\n If unset, the default is '#{D3::Admin::DFT_PKG_ID_PREFIX}'"
|
49
|
+
},
|
50
|
+
|
51
|
+
:last_config => {
|
52
|
+
description: "Timestamp of the last configuration for setting servers, credentials and/or prefs"
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
@@prefs = PREFS_FILE.readable? ? YAML.load(PREFS_FILE.read) : {}
|
57
|
+
|
58
|
+
### Return a hash of prefs for this admin
|
59
|
+
###
|
60
|
+
### @return [Hash] the d3admin prefs for the current user
|
61
|
+
###
|
62
|
+
def self.prefs
|
63
|
+
@@prefs
|
64
|
+
end
|
65
|
+
|
66
|
+
### Set a pref and save the change
|
67
|
+
###
|
68
|
+
### @param pref[Symbol] the pref to set, one of the keys of PREF_KEYS
|
69
|
+
###
|
70
|
+
### @param value[Object] the value to save with the pref
|
71
|
+
###
|
72
|
+
### @return [Boolean] true of the pref was set and saved
|
73
|
+
def self.set_pref (pref, value)
|
74
|
+
raise JSS::InvalidDataError, "first argument must be a pref key from D3::Admin::Prefs::PREF_KEYS" unless PREF_KEYS.keys.include? pref
|
75
|
+
@@prefs[pref] = value
|
76
|
+
save_prefs
|
77
|
+
end
|
78
|
+
|
79
|
+
### Save the current prefs to disk for this user
|
80
|
+
###
|
81
|
+
### @return [void]
|
82
|
+
def self.save_prefs
|
83
|
+
@@prefs[:last_config] = Time.now
|
84
|
+
PREFS_FILE.jss_save YAML.dump(@@prefs)
|
85
|
+
end
|
86
|
+
|
87
|
+
|
88
|
+
### Run the Admin config, saving hostnames, usernames and pws
|
89
|
+
### as needed.
|
90
|
+
###
|
91
|
+
### @param targets[Array] the targets from the d3admin command-line
|
92
|
+
###
|
93
|
+
### @param options[OpenStruct] the parsed options from the
|
94
|
+
### d3admin command-line
|
95
|
+
###
|
96
|
+
### @return [void]
|
97
|
+
###
|
98
|
+
### @todo improve this a lot
|
99
|
+
###
|
100
|
+
def self.config (targets, options)
|
101
|
+
|
102
|
+
if options.walkthru
|
103
|
+
tgt = D3::Admin::Interactive.get_value :get_config_target, "all"
|
104
|
+
targets = [tgt]
|
105
|
+
end
|
106
|
+
|
107
|
+
if targets.empty? or targets.include?("all")
|
108
|
+
targets = D3::Admin::CONFIG_TARGETS - ["all"]
|
109
|
+
end
|
110
|
+
|
111
|
+
targets.each do |target|
|
112
|
+
case target
|
113
|
+
when"jss"
|
114
|
+
puts "******** JSS-API LOCATION AND READ-WRITE CREDENTIALS ********"
|
115
|
+
D3::Admin::Auth.ask_for_rw_credentials :jss
|
116
|
+
|
117
|
+
when "db"
|
118
|
+
puts "******** JSS MYSQL LOCATION AND READ-WRITE CREDENTIALS ********"
|
119
|
+
D3::Admin::Auth.ask_for_rw_credentials :db
|
120
|
+
|
121
|
+
when "dist"
|
122
|
+
puts "******** MASTER DIST-POINT READ-WRITE PASSWORD ********"
|
123
|
+
D3::Admin::Auth.ask_for_rw_credentials :dist
|
124
|
+
|
125
|
+
when "workspace"
|
126
|
+
puts "******** LOCAL PKG/DMG BUILD WORKSPACE ********"
|
127
|
+
pth = D3::Admin::Interactive.get_value :workspace, D3::Admin::Prefs.prefs[:workspace]
|
128
|
+
D3::Admin::Prefs.set_pref :workspace, pth
|
129
|
+
D3::Admin::Prefs.save_prefs
|
130
|
+
puts "Thank you, the path has been saved in your d3admin prefs"
|
131
|
+
puts
|
132
|
+
|
133
|
+
when "editor"
|
134
|
+
puts "******** TEXT EDITOR ********"
|
135
|
+
cmd = D3::Admin::Interactive.get_value :get_editor, D3::Admin::Prefs.prefs[:editor]
|
136
|
+
D3::Admin::Prefs.set_pref :editor, cmd
|
137
|
+
D3::Admin::Prefs.save_prefs
|
138
|
+
puts "Thank you, the command has been saved in your d3admin prefs"
|
139
|
+
puts
|
140
|
+
|
141
|
+
when "pkg-id-prefix"
|
142
|
+
puts "******** .PKG IDENTIFIER PREFIX ********"
|
143
|
+
pfx = D3::Admin::Interactive.get_value(:get_pkg_identifier_prefix, D3::Admin::Prefs.prefs[:apple_pkg_id_prefix], :validate_package_identifier_prefix)
|
144
|
+
D3::Admin::Prefs.set_pref :apple_pkg_id_prefix, pfx
|
145
|
+
D3::Admin::Prefs.save_prefs
|
146
|
+
puts "Thank you, the prefix has been saved in your d3admin prefs"
|
147
|
+
puts
|
148
|
+
else
|
149
|
+
puts "(skipping unknown config setting: #{target}"
|
150
|
+
end # case
|
151
|
+
end # targets.each
|
152
|
+
end # config
|
153
|
+
|
154
|
+
### Display the current Admin config settings
|
155
|
+
###
|
156
|
+
### @return [void]
|
157
|
+
###
|
158
|
+
def self.display_config
|
159
|
+
jss_creds = D3::Admin::Auth.rw_credentials :jss, :just_checking
|
160
|
+
jss_server = JSS::CONFIG.api_server_name # should be the one saved in the user-level .ruby-jss.conf, not top level in /etc
|
161
|
+
jss_port = JSS::CONFIG.api_server_port
|
162
|
+
|
163
|
+
db_creds = D3::Admin::Auth.rw_credentials :db, :just_checking
|
164
|
+
db_server = JSS::CONFIG.db_server_name
|
165
|
+
db_port = JSS::CONFIG.db_server_port
|
166
|
+
|
167
|
+
dist_creds = D3::Admin::Auth.rw_credentials :dist, :just_checking
|
168
|
+
|
169
|
+
wkspc = D3::Admin::Prefs.prefs[:workspace]
|
170
|
+
pkg_id_pfx = D3::Admin::Prefs.prefs[:apple_pkg_id_prefix]
|
171
|
+
editor = D3::Admin::Prefs.prefs[:editor]
|
172
|
+
|
173
|
+
puts <<-DISPLAY
|
174
|
+
******** Current d3admin config ********
|
175
|
+
JSS API
|
176
|
+
Hostname: #{jss_server}
|
177
|
+
Port: #{jss_port}
|
178
|
+
Read/Write user: #{jss_creds[:user] ? jss_creds[:user] : 'unset' }
|
179
|
+
Read/Write password: #{jss_creds[:password] ? 'stored in keychain' : 'unset' }
|
180
|
+
|
181
|
+
JSS MySQL
|
182
|
+
Hostname: #{db_server}
|
183
|
+
Port: #{db_port}
|
184
|
+
Read/Write user: #{db_creds[:user] ? db_creds[:user] : 'unset' }
|
185
|
+
Read/Write password: #{db_creds[:password] ? 'stored in keychain' : 'unset' }
|
186
|
+
|
187
|
+
Master Distribution Point
|
188
|
+
Hostname: (stored in JSS)
|
189
|
+
Port: (stored in JSS)
|
190
|
+
Read/Write user: (stored in JSS)
|
191
|
+
Read/Write password: #{dist_creds[:password] ? 'stored in keychain' : 'unset' }
|
192
|
+
|
193
|
+
Adding Packages
|
194
|
+
Description Editor: #{editor ? editor : D3::Admin::Interactive::DFT_EDITOR}
|
195
|
+
Build Workspace: #{wkspc ? wkspc : D3::Admin::DFT_WORKSPACE}
|
196
|
+
Identifier prefix: #{pkg_id_pfx ? pkg_id_pfx : D3::Admin::DFT_PKG_ID_PREFIX}
|
197
|
+
|
198
|
+
DISPLAY
|
199
|
+
end # display config
|
200
|
+
|
201
|
+
end # module prefs
|
202
|
+
end # module Admin
|
203
|
+
end # module D3
|
204
|
+
|