depot3 0.0.0a1 → 3.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +55 -1
  3. data/bin/d3 +323 -0
  4. data/bin/d3admin +1011 -0
  5. data/bin/d3helper +354 -0
  6. data/bin/puppytime +334 -0
  7. data/data/d3/com.pixar.d3.RepoMan.plist +23 -0
  8. data/data/d3/d3.conf.example +507 -0
  9. data/data/d3/d3RepoMan.app/Contents/Frameworks/libswiftAppKit.dylib +0 -0
  10. data/data/d3/d3RepoMan.app/Contents/Frameworks/libswiftCore.dylib +0 -0
  11. data/data/d3/d3RepoMan.app/Contents/Frameworks/libswiftCoreData.dylib +0 -0
  12. data/data/d3/d3RepoMan.app/Contents/Frameworks/libswiftCoreGraphics.dylib +0 -0
  13. data/data/d3/d3RepoMan.app/Contents/Frameworks/libswiftCoreImage.dylib +0 -0
  14. data/data/d3/d3RepoMan.app/Contents/Frameworks/libswiftDarwin.dylib +0 -0
  15. data/data/d3/d3RepoMan.app/Contents/Frameworks/libswiftDispatch.dylib +0 -0
  16. data/data/d3/d3RepoMan.app/Contents/Frameworks/libswiftFoundation.dylib +0 -0
  17. data/data/d3/d3RepoMan.app/Contents/Frameworks/libswiftObjectiveC.dylib +0 -0
  18. data/data/d3/d3RepoMan.app/Contents/Info.plist +56 -0
  19. data/data/d3/d3RepoMan.app/Contents/MacOS/d3RepoMan +0 -0
  20. data/data/d3/d3RepoMan.app/Contents/PkgInfo +1 -0
  21. data/data/d3/d3RepoMan.app/Contents/Resources/Base.lproj/MainMenu.nib +0 -0
  22. data/data/d3/d3RepoMan.app/Contents/Resources/last-foreground-times-template.plist +5 -0
  23. data/data/d3/d3RepoMan.app/Contents/_CodeSignature/CodeResources +214 -0
  24. data/data/d3/puppytime/ImageLicenses.txt +165 -0
  25. data/data/d3/puppytime/notification_image +1 -0
  26. data/data/d3/puppytime/opt_out_image +1 -0
  27. data/data/d3/puppytime/slideshow/2008-07-11_White_German_Shepherd_pup_chilling_at_the_Coker_Arboretum.jpg +0 -0
  28. data/data/d3/puppytime/slideshow/2009-04-21_APBT_pup_on_deck.jpg +0 -0
  29. data/data/d3/puppytime/slideshow/A_puppy_Yorkie.jpg +0 -0
  30. data/data/d3/puppytime/slideshow/Alert_Pug_Puppy.jpg +0 -0
  31. data/data/d3/puppytime/slideshow/Australian_Cattle_Dog_puppies_04.JPG +0 -0
  32. data/data/d3/puppytime/slideshow/Beagle_puppy_Cadet.jpg +0 -0
  33. data/data/d3/puppytime/slideshow/Bernese_Mountain_Dog.jpg +0 -0
  34. data/data/d3/puppytime/slideshow/Bloodhound_Puppy.jpg +0 -0
  35. data/data/d3/puppytime/slideshow/Boston_terrier_with_toy.jpg +0 -0
  36. data/data/d3/puppytime/slideshow/Boxer_puppy_fawn_portrai.jpg +0 -0
  37. data/data/d3/puppytime/slideshow/Caracal_kitten.jpg +0 -0
  38. data/data/d3/puppytime/slideshow/Chihuahua_&_Doberman_Pup.jpg +0 -0
  39. data/data/d3/puppytime/slideshow/Cuccioli_di_Margot_a_35_gg_Basenjis.jpg +0 -0
  40. data/data/d3/puppytime/slideshow/Dalmatian_puppy_03.jpg +0 -0
  41. data/data/d3/puppytime/slideshow/GoldenRetrieverPuppyDaisyParker.JPG +0 -0
  42. data/data/d3/puppytime/slideshow/Green_eyed_beige_Chihuahua.jpg +0 -0
  43. data/data/d3/puppytime/slideshow/Let_Sleeping_Dogs_Lie.jpg +0 -0
  44. data/data/d3/puppytime/slideshow/Meatball_-_French_Bulldog_Puppy.jpg +0 -0
  45. data/data/d3/puppytime/slideshow/Oola_-_9_weeks.jpg +0 -0
  46. data/data/d3/puppytime/slideshow/Pancho0008.JPG +0 -0
  47. data/data/d3/puppytime/slideshow/Pomeranian_orange-sable_Coco.jpg +0 -0
  48. data/data/d3/puppytime/slideshow/Pug_puppy_001.jpg +0 -0
  49. data/data/d3/puppytime/slideshow/Puggle_puppy_6_weeks.JPG +0 -0
  50. data/data/d3/puppytime/slideshow/Puli_kan.jpg +0 -0
  51. data/data/d3/puppytime/slideshow/Puppy_French_Bulldog.jpg +0 -0
  52. data/data/d3/puppytime/slideshow/Rocco_the_Bulldog.jpg +0 -0
  53. data/data/d3/puppytime/slideshow/Rottweiler_Face.jpg +0 -0
  54. data/data/d3/puppytime/slideshow/Saint_Bernard_puppy.jpg +0 -0
  55. data/data/d3/puppytime/slideshow/Scottish_froment.jpg +0 -0
  56. data/data/d3/puppytime/slideshow/Shar_pei_puppy_(age_2_months).jpg +0 -0
  57. data/data/d3/puppytime/slideshow/Shiba-Inu_beim_Spielen_im_Schnee.JPG +0 -0
  58. data/data/d3/puppytime/slideshow/Smooth-coat_Border_Collie_puppy..jpg +0 -0
  59. data/data/d3/puppytime/slideshow/Smooth_Dachshund_puppies.jpg +0 -0
  60. data/data/d3/puppytime/slideshow/Snow_dog.jpg +0 -0
  61. data/data/d3/puppytime/slideshow/Taylor_the_Pembroke_Welsh_Corgi.png +0 -0
  62. data/data/d3/puppytime/slideshow/Weim_Pups_001.jpg +0 -0
  63. data/data/d3/puppytime/slideshow/Westie_pups.jpg +0 -0
  64. data/data/d3/puppytime/slideshow/Yellow_Labrador_puppies_(4165737325).jpg +0 -0
  65. data/lib/d3/admin/add.rb +451 -0
  66. data/lib/d3/admin/auth.rb +470 -0
  67. data/lib/d3/admin/edit.rb +297 -0
  68. data/lib/d3/admin/help.rb +396 -0
  69. data/lib/d3/admin/interactive.rb +972 -0
  70. data/lib/d3/admin/options.rb +454 -0
  71. data/lib/d3/admin/prefs.rb +204 -0
  72. data/lib/d3/admin/report.rb +727 -0
  73. data/lib/d3/admin/state.rb +42 -0
  74. data/lib/d3/admin/validate.rb +413 -0
  75. data/lib/d3/admin.rb +42 -0
  76. data/lib/d3/basename.rb +217 -0
  77. data/lib/d3/client/auth.rb +108 -0
  78. data/lib/d3/client/class_methods.rb +766 -0
  79. data/lib/d3/client/class_variables.rb +47 -0
  80. data/lib/d3/client/cli.rb +187 -0
  81. data/lib/d3/client/environment.rb +134 -0
  82. data/lib/d3/client/help.rb +110 -0
  83. data/lib/d3/client/lists.rb +314 -0
  84. data/lib/d3/client/receipt.rb +1173 -0
  85. data/lib/d3/client.rb +45 -0
  86. data/lib/d3/configuration.rb +319 -0
  87. data/lib/d3/constants.rb +60 -0
  88. data/lib/d3/database.rb +488 -0
  89. data/lib/d3/exceptions.rb +44 -0
  90. data/lib/d3/log.rb +271 -0
  91. data/lib/d3/package/aliases.rb +80 -0
  92. data/lib/d3/package/attributes.rb +97 -0
  93. data/lib/d3/package/class_methods.rb +817 -0
  94. data/lib/d3/package/class_variables.rb +46 -0
  95. data/lib/d3/package/client_actions.rb +293 -0
  96. data/lib/d3/package/constants.rb +58 -0
  97. data/lib/d3/package/constructor.rb +191 -0
  98. data/lib/d3/package/getters.rb +164 -0
  99. data/lib/d3/package/mixins.rb +39 -0
  100. data/lib/d3/package/private_methods.rb +227 -0
  101. data/lib/d3/package/questions.rb +95 -0
  102. data/lib/d3/package/server_actions.rb +683 -0
  103. data/lib/d3/package/setters.rb +326 -0
  104. data/lib/d3/package/validate.rb +448 -0
  105. data/lib/d3/package.rb +51 -0
  106. data/lib/d3/puppytime/pending_puppy.rb +108 -0
  107. data/lib/d3/puppytime/puppy_queue.rb +274 -0
  108. data/lib/d3/puppytime.rb +68 -0
  109. data/lib/d3/state.rb +105 -0
  110. data/lib/d3/utility.rb +325 -0
  111. data/lib/d3/version.rb +1 -1
  112. metadata +162 -9
@@ -0,0 +1,217 @@
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
+ ###
29
+ ### This mixin module provides attributes and methods for
30
+ ### dealing with d3 basenames, i.e. package families.
31
+ ### It's used by the {D3::Package}, {D3::Client::Receipt}, and {D3::Client::PendingPuppy} classes.
32
+ ###
33
+ module Basename
34
+ include Comparable
35
+
36
+ ### The status of D3::Package & D3::Client::Receipt objects, and the integers stored
37
+ ### in the DB for each D3::Package
38
+ ###
39
+ ### - :unsaved
40
+ ### D3::Package: a Ruby object that hasn't yet been created on the server
41
+ ### D3::Client::Receipt: a Ruby object that hasn't yet been saved to the local
42
+ ### receipt datastore
43
+ ###
44
+ ### - :pilot
45
+ ### D3::Package: on the server, but not yet been made live,1
46
+ ### D3::Client::Receipt: installed when the pkg was in that state.
47
+ ###
48
+ ### - :live
49
+ ### D3::Package: the currently active pkg for a given basename,
50
+ ### D3::Client::Receipt: the matching pkg is current live on the server
51
+ ###
52
+ ### - :deprecated
53
+ ### D3::Package: was once live, now superseded by a new version, but
54
+ ### still on the server
55
+ ### D3::Client::Receipt: the rcpt is older than the currently live pkg &
56
+ ### will be upgraded at sync unless it was installed as a pilot
57
+ ###
58
+ ### - :skipped
59
+ ### D3::Package: never made live, but older than the current live
60
+ ### installer, still on the server, probably should be deleted
61
+ ###
62
+ ### - :missing
63
+ ### D3::Package: the data is in the D3 Packages table, but the pkg is
64
+ ### not in the JSS
65
+ ### D3::Client::Receipt: No matching :pilot, :live, or :deprecated pkg on
66
+ ### the server
67
+ ###
68
+ ### - :deleted
69
+ ### D3::Package: the matching d3 data has been deleted from the server
70
+ ### D3::Client::Receipt: the matching receipt has been deleted from the client
71
+ ###
72
+ STATUSES = [
73
+ :unsaved,
74
+ :pilot,
75
+ :live,
76
+ :deprecated,
77
+ :skipped,
78
+ :missing,
79
+ :deleted
80
+ ]
81
+
82
+ ### When filtering lists of pkgs/rcpts, unsaved and deleted are meaningless, so use this list
83
+ STATUSES_FOR_FILTERS = [
84
+ :pilot,
85
+ :live,
86
+ :deprecated,
87
+ :skipped,
88
+ :missing
89
+ ]
90
+
91
+ ################# Attributes #################
92
+
93
+ ### @return [String] the basname of the thing installed
94
+ attr_reader :basename
95
+
96
+ ### @return [String] the version of the thing installed
97
+ attr_reader :version
98
+
99
+ ### @return [Integer] the d3 release number of the thing installed
100
+ attr_reader :revision
101
+
102
+ ### @return [String] who's uploading, releasing, installing, or archiving this thing?
103
+ attr_reader :admin
104
+
105
+ ### @return [Integer] the JSS id of this package
106
+ attr_reader :id
107
+
108
+ ### @return [Symbol] whats the d3 status of this package? One of the values of D3::Basename::STATUSES
109
+ attr_reader :status
110
+
111
+ # @return [Symbol] Is this package a .dmg or .pkg?
112
+ attr_reader :package_type
113
+
114
+ ### @return [String] a string for matching to the output lines
115
+ ### of '/bin/ps -A -c -o comm'. If there's a match, this pkg won't be
116
+ ### installed or uninstalled
117
+ attr_reader :prohibiting_process
118
+
119
+ # @return [Integer] the days of disuse before an expirable edition expires. 0=never
120
+ attr_reader :expiration
121
+
122
+ # @return [String] the path to the executable that needs come to the foreground to prevent expiration
123
+ attr_reader :expiration_path
124
+
125
+
126
+ ################# Public Instance Methods #################
127
+
128
+ ### While several packages can have the same basename,
129
+ ### the combination of basename, version, and revision
130
+ ### (called the 'edition') must be unique
131
+ ### among the d3 packages.
132
+ ###
133
+ ### @return [String] the basename, version ,and revision of this package, joined with hyphens
134
+ ###
135
+ def edition
136
+ "#{@basename}-#{@version}-#{@revision}"
137
+ end
138
+
139
+ ### Use comparable to give sortability
140
+ ### and equality.
141
+ ###
142
+ ###
143
+ def <=> (other)
144
+ self.edition <=> other.edition
145
+ end # <=>
146
+
147
+ ### Is the status :saved?
148
+ ###
149
+ ### @return [Boolean]
150
+ ###
151
+ def saved?
152
+ @status != :unsaved
153
+ end
154
+
155
+ ### Is the status :pilot?
156
+ ###
157
+ ### @return [Boolean]
158
+ ###
159
+ def pilot?
160
+ @status == :pilot
161
+ end
162
+
163
+ ### Is the status :live?
164
+ ###
165
+ ### @return [Boolean]
166
+ ###
167
+ def live?
168
+ @status == :live
169
+ end
170
+
171
+ ### @return [Boolean] Is this pkg skipped?
172
+ ### See {D3::Database::PACKAGE_STATUSES} for details
173
+ ###
174
+ def skipped?
175
+ @status == :skipped
176
+ end
177
+
178
+ ### Is the status :deprecated?
179
+ ###
180
+ ### @return [Boolean]
181
+ ###
182
+ def deprecated?
183
+ @status == :deprecated
184
+ end
185
+
186
+
187
+ ### Is the status :missing?
188
+ ###
189
+ ### @return [Boolean]
190
+ ###
191
+ def missing?
192
+ @status == :missing
193
+ end
194
+
195
+ ### Is the status :deleted?
196
+ ###
197
+ ### @return [Boolean]
198
+ ###
199
+ def deleted?
200
+ @status == :deleted
201
+ end
202
+
203
+ private
204
+
205
+ ### set the status
206
+ ###
207
+ ### @param new_status[Symnol] one of the valid STATUSES
208
+ ###
209
+ ### @return [Symbol] the new status
210
+ ###
211
+ def status= (new_status)
212
+ raise JSS::InvalidDataError, "status must be one of :#{STATUSES.join(', :')}" unless STATUSES.include? new_status
213
+ @status = new_status
214
+ end
215
+
216
+ end # module Basename
217
+ end # module PixD3
@@ -0,0 +1,108 @@
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
+ class Client < JSS::Client
29
+
30
+
31
+ ################# Class Methods #################
32
+
33
+ ### Connect to the JSS and the DB with read-only connections
34
+ ### The connection details must be stored in the D3 and JSS
35
+ ### CONFIG data.
36
+ ###
37
+ def self.connect
38
+ jss_ro_user = D3::CONFIG.client_jss_ro_user
39
+ jss_ro_user ||= JSS::CONFIG.api_username
40
+
41
+ db_ro_user = D3::CONFIG.client_db_ro_user
42
+ db_ro_user ||= JSS::CONFIG.db_username
43
+
44
+ JSS::DB_CNX.connect :server => JSS::CONFIG.db_server_name, :user => db_ro_user, :pw => D3::Client.get_ro_pass(:db), :connect_timeout => 10
45
+ JSS::API.connect :server => JSS::CONFIG.api_server_name, :user => jss_ro_user, :pw => D3::Client.get_ro_pass(:jss), :open_timeout => 10
46
+
47
+ D3::Database.check_schema_version
48
+ end # connect
49
+
50
+ ### Disconnect from the JSS and DB
51
+ def self.disconnect
52
+ JSS::API.disconnect if JSS::API.connected?
53
+ JSS::DB_CNX.disconnect if JSS::DB_CNX.connected?
54
+ end # disconnect
55
+
56
+
57
+ ### Get a stored read-only password from a file or
58
+ ### an executable.
59
+ ###
60
+ ### Raises a JSS::UnsupportedError if the file isn't
61
+ ### owned by root with 0600 permissions.
62
+ ###
63
+ ### NOTE: for slightly better security, don't store the
64
+ ### result in a variable, use this method as needed to retrieve
65
+ ### the passwd every time you need it.
66
+ ###
67
+ ### See also D3::Configuration
68
+ ###
69
+ ### @param pw[Symbol] which pw to get, one of :jss, :db, :dist, :http
70
+ ###
71
+ ### @return [String, nil] the password, or nil if the file
72
+ ### isn't defiend, or doesn't exist.
73
+ ###
74
+ def self.get_ro_pass (pw)
75
+ raise JSS::InvalidDataError, "Arg must be one of :jss, :db, :dist, :http" unless [:jss, :db, :dist, :http].include? pw
76
+
77
+ path = case pw
78
+ when :jss then D3::CONFIG.client_jss_ropw_path
79
+ when :db then D3::CONFIG.client_db_ropw_path
80
+ when :dist then D3::CONFIG.client_distpoint_ropw_path
81
+ when :http then D3::CONFIG.client_http_ropw_path
82
+ end # path = case
83
+
84
+ return nil unless path
85
+
86
+ # if the path ends with a pipe, its a command that will
87
+ # return the desired password, so remove the pipe,
88
+ # execute it, and return stdout from it.
89
+ if path.end_with? "|"
90
+ return `#{path.chomp "|"}`.chomp
91
+ end
92
+
93
+ file = Pathname.new path
94
+ return nil unless file.file?
95
+ stat = file.stat
96
+ unless ("%o" % stat.mode).end_with? "0600" and stat.uid == 0
97
+ raise JSS::UnsupportedError, "Password file for '#{pw}' has insecure permissions, must be 0600."
98
+ end
99
+
100
+ # chomping an empty string removes all trailing \n's and \r\n's
101
+ file.read.chomp('')
102
+ end
103
+
104
+ ### Actions requiring an admin name
105
+
106
+ end # class Client
107
+ end # module D3
108
+