grocery_delivery 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/README.md +3 -4
- data/bin/grocery-delivery +20 -15
- data/lib/grocery_delivery/config.rb +2 -1
- data/lib/grocery_delivery/hooks.rb +9 -11
- metadata +80 -100
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b3051aeb9cd63a75f10ecb857a43377e4499c023
|
4
|
+
data.tar.gz: d7e72bbf0374b09b147a8359571edd224df5ec96
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1f4dd7577e4db07e06f63f8c0f6f52c6b1445d0ecf5c1acc5ea826584ce93e2f23828e26684290db0787fd45b57052b6d4993c7a903b92de238125e38c2cee05
|
7
|
+
data.tar.gz: 1f8dfac08aa55dec215bfea8e5cee97f8dee0307b5ffa8efe39b8a353e1df1220980fc4b1557982e220e086eb336dd4ef8c53392bd9e964e4cb2b1c24fab1451
|
data/README.md
CHANGED
@@ -51,7 +51,6 @@ standard Ruby.
|
|
51
51
|
All command-line options are available in the config file:
|
52
52
|
* dry_run (bool, default: false)
|
53
53
|
* debug (bool, default: false)
|
54
|
-
* timestamp (bool, default: false)
|
55
54
|
* config_file (string, default: `/etc/gd-config.rb`)
|
56
55
|
* lockfile (string, default: `/var/lock/subsys/grocery_delivery`)
|
57
56
|
* pidfile (string, default: `/var/run/grocery_delivery.pid`)
|
@@ -65,9 +64,9 @@ In addition the following are also available:
|
|
65
64
|
* cookbook_paths - An array of directories that contain cookbooks relative to
|
66
65
|
`reponame`. Default: `['chef/cookbooks']`
|
67
66
|
* role_path - A directory to find roles in relative to `reponame`. Default:
|
68
|
-
`
|
67
|
+
`'chef/roles'`
|
69
68
|
* databag_path - A directory to find databags in relative to `reponame`.
|
70
|
-
Default: `
|
69
|
+
Default: `'chef/databags'`
|
71
70
|
* rev_checkpoint - Name of the file to store the last-uploaded revision,
|
72
71
|
relative to `reponame`. Default: `gd_revision`
|
73
72
|
* knife_config - Knife config to use for uploads. Default:
|
@@ -80,7 +79,7 @@ In addition the following are also available:
|
|
80
79
|
* vcs_path - Path to git or svn binary. If not given, just uses 'git' or 'svn'.
|
81
80
|
Default: `nil`
|
82
81
|
* plugin_path - Path to plugin file. Default: `/etc/gd-plugin.rb`
|
83
|
-
* berks - Boolean to determine if we should use berkshelf to resolve
|
82
|
+
* berks - Boolean to determine if we should use berkshelf to resolve
|
84
83
|
dependencies and upload cookbooks. Default: `false`
|
85
84
|
* berks_bin - Path to berkshelf. Default: `/opt/chefdk/bin/berks`
|
86
85
|
|
data/bin/grocery-delivery
CHANGED
@@ -42,7 +42,7 @@ end
|
|
42
42
|
def get_lock
|
43
43
|
GroceryDelivery::Log.warn('Attempting to acquire lock')
|
44
44
|
$lockfileh = File.open(GroceryDelivery::Config.lockfile,
|
45
|
-
File::RDWR | File::CREAT,
|
45
|
+
File::RDWR | File::CREAT, 0o600)
|
46
46
|
$lockfileh.flock(File::LOCK_EX)
|
47
47
|
GroceryDelivery::Log.warn('Lock acquired')
|
48
48
|
end
|
@@ -69,7 +69,7 @@ def full_upload(knife)
|
|
69
69
|
if GroceryDelivery::Config.berks
|
70
70
|
GroceryDelivery::Log.warn('Uploading all cookbooks with berkshelf')
|
71
71
|
GroceryDelivery::Log.debug(
|
72
|
-
"Using cookbook paths: #{GroceryDelivery::Config.cookbook_paths}"
|
72
|
+
"Using cookbook paths: #{GroceryDelivery::Config.cookbook_paths}",
|
73
73
|
)
|
74
74
|
knife.berks_cookbook_upload_all
|
75
75
|
else
|
@@ -84,7 +84,7 @@ end
|
|
84
84
|
|
85
85
|
def partial_upload(knife, repo, checkpoint, local_head)
|
86
86
|
GroceryDelivery::Log.warn(
|
87
|
-
"Determing changes... from #{checkpoint} to #{local_head}"
|
87
|
+
"Determing changes... from #{checkpoint} to #{local_head}",
|
88
88
|
)
|
89
89
|
|
90
90
|
begin
|
@@ -101,6 +101,7 @@ def partial_upload(knife, repo, checkpoint, local_head)
|
|
101
101
|
:databag_dir =>
|
102
102
|
GroceryDelivery::Config.databag_path,
|
103
103
|
},
|
104
|
+
GroceryDelivery::Config.track_symlinks,
|
104
105
|
)
|
105
106
|
rescue BetweenMeals::Changeset::ReferenceError
|
106
107
|
GroceryDelivery::Log.error('Repo error, invalid revision, exiting')
|
@@ -128,11 +129,13 @@ def partial_upload(knife, repo, checkpoint, local_head)
|
|
128
129
|
end
|
129
130
|
|
130
131
|
knife.cookbook_delete(deleted_cookbooks) if deleted_cookbooks
|
131
|
-
if
|
132
|
-
GroceryDelivery::
|
133
|
-
|
134
|
-
|
135
|
-
|
132
|
+
if added_cookbooks
|
133
|
+
if GroceryDelivery::Config.berks
|
134
|
+
GroceryDelivery::Log.warn('Using Berkshelf to upload cookbooks')
|
135
|
+
knife.berks_cookbook_upload(added_cookbooks)
|
136
|
+
else
|
137
|
+
knife.cookbook_upload(added_cookbooks)
|
138
|
+
end
|
136
139
|
end
|
137
140
|
knife.role_delete(deleted_roles) if deleted_roles
|
138
141
|
knife.role_upload(added_roles) if added_roles
|
@@ -153,11 +156,15 @@ def upload_changed(repo, checkpoint)
|
|
153
156
|
:berks_bin => GroceryDelivery::Config.berks_bin,
|
154
157
|
:berks_config => GroceryDelivery::Config.berks_config,
|
155
158
|
:role_dir => File.join(base_dir, GroceryDelivery::Config.role_path),
|
159
|
+
:role_type => GroceryDelivery::Config.role_type,
|
156
160
|
:cookbook_dirs => GroceryDelivery::Config.cookbook_paths.map do |x|
|
157
161
|
File.join(base_dir, x)
|
158
162
|
end,
|
159
163
|
:databag_dir => File.join(base_dir, GroceryDelivery::Config.databag_path),
|
160
|
-
}
|
164
|
+
},
|
165
|
+
)
|
166
|
+
GroceryDelivery::Hooks.pre_upload(
|
167
|
+
GroceryDelivery::Config.dry_run, knife, local_head
|
161
168
|
)
|
162
169
|
|
163
170
|
if checkpoint
|
@@ -183,9 +190,6 @@ def setup_config
|
|
183
190
|
options[:verbosity] = ::Logger::INFO
|
184
191
|
end
|
185
192
|
end
|
186
|
-
opts.on('-T', '--timestamp', 'Timestamp output') do |s|
|
187
|
-
options[:timestamp] = s
|
188
|
-
end
|
189
193
|
opts.on('-c', '--config-file FILE', 'config file') do |s|
|
190
194
|
unless File.exists?(File.expand_path(s))
|
191
195
|
GroceryDelivery::Log.error("Config file #{s} not found.")
|
@@ -246,7 +250,7 @@ if repo.exists?
|
|
246
250
|
else
|
247
251
|
unless GroceryDelivery::Config.repo_url
|
248
252
|
GroceryDelivery::Log.error(
|
249
|
-
'No repo URL was specified, and no repo is checked out'
|
253
|
+
'No repo URL was specified, and no repo is checked out',
|
250
254
|
)
|
251
255
|
exit(1)
|
252
256
|
end
|
@@ -260,7 +264,7 @@ GroceryDelivery::Hooks.post_repo_up(GroceryDelivery::Config.dry_run)
|
|
260
264
|
|
261
265
|
if GroceryDelivery::Config.dry_run && !repo.exists?
|
262
266
|
GroceryDelivery::Log.warn(
|
263
|
-
'In dryrun mode, with no repo, there\'s not much I can dryrun'
|
267
|
+
'In dryrun mode, with no repo, there\'s not much I can dryrun',
|
264
268
|
)
|
265
269
|
GroceryDelivery::Hooks.postrun(GroceryDelivery::Config.dry_run, true,
|
266
270
|
'dryrun mode')
|
@@ -278,7 +282,7 @@ else
|
|
278
282
|
write_checkpoint(ver)
|
279
283
|
$success = true
|
280
284
|
$status_msg = "Success at #{ver}"
|
281
|
-
rescue => e
|
285
|
+
rescue StandardError => e
|
282
286
|
$status_msg = e.message
|
283
287
|
e.backtrace.each do |line|
|
284
288
|
GroceryDelivery::Log.error(line)
|
@@ -289,4 +293,5 @@ end
|
|
289
293
|
GroceryDelivery::Log.warn($status_msg)
|
290
294
|
GroceryDelivery::Hooks.postrun(GroceryDelivery::Config.dry_run, $success,
|
291
295
|
$status_msg)
|
296
|
+
exit($success)
|
292
297
|
# rubocop:enable GlobalVars
|
@@ -26,7 +26,6 @@ module GroceryDelivery
|
|
26
26
|
stdout false
|
27
27
|
dry_run false
|
28
28
|
verbosity Logger::WARN
|
29
|
-
timestamp false
|
30
29
|
config_file '/etc/gd-config.rb'
|
31
30
|
pidfile '/var/run/grocery_delivery.pid'
|
32
31
|
lockfile '/var/lock/subsys/grocery_delivery'
|
@@ -35,6 +34,7 @@ module GroceryDelivery
|
|
35
34
|
reponame 'ops'
|
36
35
|
cookbook_paths ['chef/cookbooks']
|
37
36
|
role_path 'chef/roles'
|
37
|
+
role_type 'rb'
|
38
38
|
databag_path 'chef/databags'
|
39
39
|
rev_checkpoint 'gd_revision'
|
40
40
|
knife_config '/root/.chef/knife.rb'
|
@@ -45,5 +45,6 @@ module GroceryDelivery
|
|
45
45
|
berks false
|
46
46
|
berks_bin '/opt/chefdk/bin/berks'
|
47
47
|
berks_config nil
|
48
|
+
track_symlinks false
|
48
49
|
end
|
49
50
|
end
|
@@ -19,30 +19,28 @@ module GroceryDelivery
|
|
19
19
|
class Hooks
|
20
20
|
# This code will run once we've read our config and loaded our plugins
|
21
21
|
# but before *anything* else. We don't even have a lock yet.
|
22
|
-
def self.preflight_checks(_dryrun)
|
23
|
-
end
|
22
|
+
def self.preflight_checks(_dryrun); end
|
24
23
|
|
25
24
|
# This is run after we've gotten a lock, written a pidfile and initialized
|
26
25
|
# our repo object (but not touched the repo yet)
|
27
|
-
def self.prerun(_dryrun)
|
28
|
-
end
|
26
|
+
def self.prerun(_dryrun); end
|
29
27
|
|
30
28
|
# This is code to run after we've updated the repo, but before we've done
|
31
29
|
# any work to parse it.
|
32
|
-
def self.post_repo_up(_dryrun)
|
33
|
-
|
30
|
+
def self.post_repo_up(_dryrun); end
|
31
|
+
|
32
|
+
# This is code to run after right before we start uploads
|
33
|
+
def self.pre_upload(_dryrun, _knife, _local_head); end
|
34
34
|
|
35
35
|
# After we parse the updates to the repo and uploaded/deleted the relevent
|
36
36
|
# items from the local server.
|
37
|
-
def self.postrun(_dryrun, _success, _msg)
|
38
|
-
end
|
37
|
+
def self.postrun(_dryrun, _success, _msg); end
|
39
38
|
|
40
39
|
# exit hooks.
|
41
|
-
def self.atexit(_dryrun, _success, _msg)
|
42
|
-
end
|
40
|
+
def self.atexit(_dryrun, _success, _msg); end
|
43
41
|
|
44
42
|
def self.get(file)
|
45
|
-
class_eval(File.read(file),
|
43
|
+
class_eval(File.read(file), file, 1) if File.exists?(file)
|
46
44
|
end
|
47
45
|
end
|
48
46
|
end
|
metadata
CHANGED
@@ -1,143 +1,123 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: grocery_delivery
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 7
|
10
|
-
version: 0.0.7
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.8
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- Phil Dibowitz
|
14
8
|
- Marcin Sawicki
|
15
9
|
autorequire:
|
16
10
|
bindir: bin
|
17
11
|
cert_chain: []
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
|
-
requirements:
|
12
|
+
date: 2017-12-18 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: between_meals
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
27
18
|
- - ">="
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
segments:
|
31
|
-
- 0
|
32
|
-
version: "0"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: 0.0.6
|
33
21
|
type: :runtime
|
34
|
-
version_requirements: *id001
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
|
-
name: between_meals
|
37
22
|
prerelease: false
|
38
|
-
|
39
|
-
|
40
|
-
requirements:
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
41
25
|
- - ">="
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
hash: 19
|
44
|
-
segments:
|
45
|
-
- 0
|
46
|
-
- 0
|
47
|
-
- 6
|
26
|
+
- !ruby/object:Gem::Version
|
48
27
|
version: 0.0.6
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: mixlib-config
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
49
35
|
type: :runtime
|
50
|
-
version_requirements: *id002
|
51
|
-
- !ruby/object:Gem::Dependency
|
52
|
-
name: rubocop
|
53
36
|
prerelease: false
|
54
|
-
|
55
|
-
|
56
|
-
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: chef-zero
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
57
46
|
- - ">="
|
58
|
-
- !ruby/object:Gem::Version
|
59
|
-
|
60
|
-
segments:
|
61
|
-
- 0
|
62
|
-
version: "0"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
63
49
|
type: :development
|
64
|
-
version_requirements: *id003
|
65
|
-
- !ruby/object:Gem::Dependency
|
66
|
-
name: knife-solo
|
67
50
|
prerelease: false
|
68
|
-
|
69
|
-
|
70
|
-
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: knife-solo
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
71
60
|
- - ">="
|
72
|
-
- !ruby/object:Gem::Version
|
73
|
-
|
74
|
-
segments:
|
75
|
-
- 0
|
76
|
-
version: "0"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
77
63
|
type: :development
|
78
|
-
version_requirements: *id004
|
79
|
-
- !ruby/object:Gem::Dependency
|
80
|
-
name: chef-zero
|
81
64
|
prerelease: false
|
82
|
-
|
83
|
-
|
84
|
-
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: rubocop
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
85
74
|
- - ">="
|
86
|
-
- !ruby/object:Gem::Version
|
87
|
-
|
88
|
-
segments:
|
89
|
-
- 0
|
90
|
-
version: "0"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
91
77
|
type: :development
|
92
|
-
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
93
84
|
description: Utility for keeping Chef servers in sync with a repo
|
94
85
|
email:
|
95
|
-
executables:
|
86
|
+
executables:
|
96
87
|
- grocery-delivery
|
97
88
|
extensions: []
|
98
|
-
|
99
|
-
extra_rdoc_files:
|
89
|
+
extra_rdoc_files:
|
100
90
|
- README.md
|
101
91
|
- LICENSE
|
102
|
-
files:
|
103
|
-
- README.md
|
92
|
+
files:
|
104
93
|
- LICENSE
|
94
|
+
- README.md
|
95
|
+
- bin/grocery-delivery
|
96
|
+
- lib/grocery_delivery/config.rb
|
105
97
|
- lib/grocery_delivery/hooks.rb
|
106
98
|
- lib/grocery_delivery/logging.rb
|
107
|
-
- lib/grocery_delivery/config.rb
|
108
|
-
- bin/grocery-delivery
|
109
99
|
homepage:
|
110
|
-
licenses:
|
100
|
+
licenses:
|
111
101
|
- Apache
|
102
|
+
metadata: {}
|
112
103
|
post_install_message:
|
113
104
|
rdoc_options: []
|
114
|
-
|
115
|
-
require_paths:
|
105
|
+
require_paths:
|
116
106
|
- lib
|
117
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
118
|
-
|
119
|
-
requirements:
|
107
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
120
109
|
- - ">="
|
121
|
-
- !ruby/object:Gem::Version
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
version: "0"
|
126
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
127
|
-
none: false
|
128
|
-
requirements:
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
129
114
|
- - ">="
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
|
132
|
-
segments:
|
133
|
-
- 0
|
134
|
-
version: "0"
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
135
117
|
requirements: []
|
136
|
-
|
137
118
|
rubyforge_project:
|
138
|
-
rubygems_version:
|
119
|
+
rubygems_version: 2.6.11
|
139
120
|
signing_key:
|
140
|
-
specification_version:
|
121
|
+
specification_version: 4
|
141
122
|
summary: Grocery Delivery
|
142
123
|
test_files: []
|
143
|
-
|