chef_fixie 0.1.0
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/LICENSE +201 -0
- data/README.md +69 -0
- data/bin/bundler +16 -0
- data/bin/chef-apply +16 -0
- data/bin/chef-client +16 -0
- data/bin/chef-shell +16 -0
- data/bin/chef-solo +16 -0
- data/bin/chef-zero +16 -0
- data/bin/chef_fixie +5 -0
- data/bin/coderay +16 -0
- data/bin/edit_json.rb +16 -0
- data/bin/erubis +16 -0
- data/bin/ffi-yajl-bench +16 -0
- data/bin/fixie~ +231 -0
- data/bin/htmldiff +16 -0
- data/bin/knife +16 -0
- data/bin/ldiff +16 -0
- data/bin/net-dhcp +16 -0
- data/bin/ohai +16 -0
- data/bin/prettify_json.rb +16 -0
- data/bin/pry +16 -0
- data/bin/rackup +16 -0
- data/bin/rake +16 -0
- data/bin/rdoc +16 -0
- data/bin/restclient +16 -0
- data/bin/ri +16 -0
- data/bin/rspec +16 -0
- data/bin/s3sh +16 -0
- data/bin/sequel +16 -0
- data/bin/serverspec-init +16 -0
- data/doc/AccessingSQL.md +36 -0
- data/doc/AccessingSQL.md~ +32 -0
- data/doc/BulkFixup.md~ +28 -0
- data/doc/CommonTasks.md +20 -0
- data/doc/CommonTasks.md~ +0 -0
- data/doc/GETTING_STARTED.md +228 -0
- data/doc/GETTING_STARTED.md~ +6 -0
- data/fixie.conf.example +8 -0
- data/lib/chef_fixie.rb +27 -0
- data/lib/chef_fixie/authz_mapper.rb +143 -0
- data/lib/chef_fixie/authz_objects.rb +285 -0
- data/lib/chef_fixie/check_org_associations.rb +242 -0
- data/lib/chef_fixie/config.rb +139 -0
- data/lib/chef_fixie/console.rb +91 -0
- data/lib/chef_fixie/context.rb +72 -0
- data/lib/chef_fixie/sql.rb +74 -0
- data/lib/chef_fixie/sql_objects.rb +497 -0
- data/lib/chef_fixie/utility_helpers.rb +59 -0
- data/lib/chef_fixie/version.rb +3 -0
- data/spec/chef_fixie/acl_spec.rb +83 -0
- data/spec/chef_fixie/assoc_invite_spec.rb +47 -0
- data/spec/chef_fixie/assoc_invite_spec.rb~ +26 -0
- data/spec/chef_fixie/check_org_associations_spec.rb +140 -0
- data/spec/chef_fixie/check_org_associations_spec.rb~ +34 -0
- data/spec/chef_fixie/groups_spec.rb +34 -0
- data/spec/chef_fixie/org_spec.rb +26 -0
- data/spec/chef_fixie/org_spec.rb~ +53 -0
- data/spec/chef_fixie/orgs_spec.rb +53 -0
- data/spec/spec_helper.rb +41 -0
- metadata +252 -0
@@ -0,0 +1,53 @@
|
|
1
|
+
|
2
|
+
require 'rspec'
|
3
|
+
require "spec_helper"
|
4
|
+
require 'fixie'
|
5
|
+
require 'fixie/config'
|
6
|
+
|
7
|
+
RSpec.describe Fixie::Sql::Orgs, "Organizations access" do
|
8
|
+
let (:test_org) { "ponyville"}
|
9
|
+
|
10
|
+
context "Basic access to orgs" do
|
11
|
+
let (:orgs) { Fixie::Sql::Orgs.new }
|
12
|
+
it "We find more than one org" do
|
13
|
+
expect(orgs.inner.count).to be > 0
|
14
|
+
end
|
15
|
+
|
16
|
+
it "We can list orgs" do
|
17
|
+
# array matcher requires a splat. (I didn't know this )
|
18
|
+
expect(orgs.list).to include( * %w(acme ponyville wonderbolts) )
|
19
|
+
end
|
20
|
+
it "We can list orgs with a limit" do
|
21
|
+
# array matcher requires a splat. (I didn't know this )
|
22
|
+
expect(orgs.list(1)).to eq(:too_many_results)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "We can find an org" do
|
26
|
+
expect(orgs[test_org].name).to eq(test_org)
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
context "Search accessors work correctly" do
|
32
|
+
let (:orgs) { Fixie::Sql::Orgs.new }
|
33
|
+
let (:the_org) { orgs[test_org] }
|
34
|
+
|
35
|
+
it "We can find an org by name" do
|
36
|
+
expect(orgs.by_name(test_org).all.count).to eq(1)
|
37
|
+
expect(orgs.by_name(test_org).all.first.name).to eq(the_org.name)
|
38
|
+
end
|
39
|
+
|
40
|
+
# TODO: Automatically extract this from the filter by field
|
41
|
+
%w(name, id, full_name, authz_id).each do |accessor|
|
42
|
+
it "We can access an org by #{accessor}" do
|
43
|
+
expect(orgs.by_name(test_org).all.count).to eq(1)
|
44
|
+
expect(orgs.by_name(test_org).all.first.name).to eq(the_org.name)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
|
2
|
+
require 'rspec'
|
3
|
+
require "spec_helper"
|
4
|
+
require 'chef_fixie'
|
5
|
+
require 'chef_fixie/config'
|
6
|
+
|
7
|
+
RSpec.describe ChefFixie::Sql::Orgs, "Organizations access" do
|
8
|
+
let (:test_org) { "ponyville"}
|
9
|
+
|
10
|
+
context "Basic access to orgs" do
|
11
|
+
let (:orgs) { ChefFixie::Sql::Orgs.new }
|
12
|
+
it "We find more than one org" do
|
13
|
+
expect(orgs.inner.count).to be > 0
|
14
|
+
end
|
15
|
+
|
16
|
+
it "We can list orgs" do
|
17
|
+
# array matcher requires a splat. (I didn't know this )
|
18
|
+
expect(orgs.list).to include( * %w(acme ponyville wonderbolts) )
|
19
|
+
end
|
20
|
+
it "We can list orgs with a limit" do
|
21
|
+
# array matcher requires a splat. (I didn't know this )
|
22
|
+
expect(orgs.list(1)).to eq(:too_many_results)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "We can find an org" do
|
26
|
+
expect(orgs[test_org].name).to eq(test_org)
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
context "Search accessors work correctly" do
|
32
|
+
let (:orgs) { ChefFixie::Sql::Orgs.new }
|
33
|
+
let (:the_org) { orgs[test_org] }
|
34
|
+
|
35
|
+
it "We can find an org by name" do
|
36
|
+
expect(orgs.by_name(test_org).all.count).to eq(1)
|
37
|
+
expect(orgs.by_name(test_org).all.first.name).to eq(the_org.name)
|
38
|
+
end
|
39
|
+
|
40
|
+
# TODO: Automatically extract this from the filter by field
|
41
|
+
%w(name, id, full_name, authz_id).each do |accessor|
|
42
|
+
it "We can access an org by #{accessor}" do
|
43
|
+
expect(orgs.by_name(test_org).all.count).to eq(1)
|
44
|
+
expect(orgs.by_name(test_org).all.first.name).to eq(the_org.name)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# Require this file using `require "spec_helper"` to ensure that it is only
|
4
|
+
# loaded once.
|
5
|
+
#
|
6
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
7
|
+
require 'chef_fixie/config'
|
8
|
+
|
9
|
+
def load_from_config_example
|
10
|
+
# load from config file
|
11
|
+
config_file = "fixie.conf.example"
|
12
|
+
Kernel.load(config_file)
|
13
|
+
end
|
14
|
+
|
15
|
+
def load_from_opscode
|
16
|
+
ChefFixie::Config::instance.load_from_pc
|
17
|
+
end
|
18
|
+
|
19
|
+
RSpec.configure do |config|
|
20
|
+
config.run_all_when_everything_filtered = true
|
21
|
+
config.filter_run :focus
|
22
|
+
|
23
|
+
# Run specs in random order to surface order dependencies. If you find an
|
24
|
+
# order dependency and want to debug it, you can fix the order by providing
|
25
|
+
# the seed, which is printed after each run.
|
26
|
+
# --seed 1234
|
27
|
+
config.order = 'random'
|
28
|
+
|
29
|
+
# configure specs
|
30
|
+
|
31
|
+
load_from_opscode
|
32
|
+
ChefFixie::Config.instance.merge_opts({})
|
33
|
+
puts ChefFixie::Config.instance.to_text
|
34
|
+
|
35
|
+
# Horrible shameful hack TODO FIXME
|
36
|
+
# We can't include a lot of the SQL code until we configure things, because
|
37
|
+
# we inherit from Model e.g.
|
38
|
+
# class Users < Sequel::Model(:users)
|
39
|
+
require 'chef_fixie'
|
40
|
+
end
|
41
|
+
|
metadata
ADDED
@@ -0,0 +1,252 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: chef_fixie
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Mark Anderson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-08-27 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: chef
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 11.12.2
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 11.12.2
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: ffi-yajl
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.2.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.2.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: pg
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.17'
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: 0.17.1
|
51
|
+
type: :runtime
|
52
|
+
prerelease: false
|
53
|
+
version_requirements: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - "~>"
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '0.17'
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 0.17.1
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: pry
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: 0.10.1
|
68
|
+
type: :runtime
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - "~>"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: 0.10.1
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: sequel
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - "~>"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '4.11'
|
82
|
+
type: :runtime
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - "~>"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '4.11'
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: uuidtools
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - "~>"
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '2.1'
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: 2.1.3
|
99
|
+
type: :runtime
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - "~>"
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '2.1'
|
106
|
+
- - ">="
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: 2.1.3
|
109
|
+
- !ruby/object:Gem::Dependency
|
110
|
+
name: bundler
|
111
|
+
requirement: !ruby/object:Gem::Requirement
|
112
|
+
requirements:
|
113
|
+
- - "~>"
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '1.3'
|
116
|
+
type: :development
|
117
|
+
prerelease: false
|
118
|
+
version_requirements: !ruby/object:Gem::Requirement
|
119
|
+
requirements:
|
120
|
+
- - "~>"
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: '1.3'
|
123
|
+
- !ruby/object:Gem::Dependency
|
124
|
+
name: rake
|
125
|
+
requirement: !ruby/object:Gem::Requirement
|
126
|
+
requirements:
|
127
|
+
- - "~>"
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '0'
|
130
|
+
type: :development
|
131
|
+
prerelease: false
|
132
|
+
version_requirements: !ruby/object:Gem::Requirement
|
133
|
+
requirements:
|
134
|
+
- - "~>"
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: '0'
|
137
|
+
- !ruby/object:Gem::Dependency
|
138
|
+
name: rspec
|
139
|
+
requirement: !ruby/object:Gem::Requirement
|
140
|
+
requirements:
|
141
|
+
- - "~>"
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: '0'
|
144
|
+
type: :development
|
145
|
+
prerelease: false
|
146
|
+
version_requirements: !ruby/object:Gem::Requirement
|
147
|
+
requirements:
|
148
|
+
- - "~>"
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
version: '0'
|
151
|
+
description: Low level manipulation tool for Chef Server 12 and later
|
152
|
+
email:
|
153
|
+
- mark@chef.io
|
154
|
+
executables:
|
155
|
+
- chef_fixie
|
156
|
+
extensions: []
|
157
|
+
extra_rdoc_files: []
|
158
|
+
files:
|
159
|
+
- LICENSE
|
160
|
+
- README.md
|
161
|
+
- bin/bundler
|
162
|
+
- bin/chef-apply
|
163
|
+
- bin/chef-client
|
164
|
+
- bin/chef-shell
|
165
|
+
- bin/chef-solo
|
166
|
+
- bin/chef-zero
|
167
|
+
- bin/chef_fixie
|
168
|
+
- bin/coderay
|
169
|
+
- bin/edit_json.rb
|
170
|
+
- bin/erubis
|
171
|
+
- bin/ffi-yajl-bench
|
172
|
+
- bin/fixie~
|
173
|
+
- bin/htmldiff
|
174
|
+
- bin/knife
|
175
|
+
- bin/ldiff
|
176
|
+
- bin/net-dhcp
|
177
|
+
- bin/ohai
|
178
|
+
- bin/prettify_json.rb
|
179
|
+
- bin/pry
|
180
|
+
- bin/rackup
|
181
|
+
- bin/rake
|
182
|
+
- bin/rdoc
|
183
|
+
- bin/restclient
|
184
|
+
- bin/ri
|
185
|
+
- bin/rspec
|
186
|
+
- bin/s3sh
|
187
|
+
- bin/sequel
|
188
|
+
- bin/serverspec-init
|
189
|
+
- doc/AccessingSQL.md
|
190
|
+
- doc/AccessingSQL.md~
|
191
|
+
- doc/BulkFixup.md~
|
192
|
+
- doc/CommonTasks.md
|
193
|
+
- doc/CommonTasks.md~
|
194
|
+
- doc/GETTING_STARTED.md
|
195
|
+
- doc/GETTING_STARTED.md~
|
196
|
+
- fixie.conf.example
|
197
|
+
- lib/chef_fixie.rb
|
198
|
+
- lib/chef_fixie/authz_mapper.rb
|
199
|
+
- lib/chef_fixie/authz_objects.rb
|
200
|
+
- lib/chef_fixie/check_org_associations.rb
|
201
|
+
- lib/chef_fixie/config.rb
|
202
|
+
- lib/chef_fixie/console.rb
|
203
|
+
- lib/chef_fixie/context.rb
|
204
|
+
- lib/chef_fixie/sql.rb
|
205
|
+
- lib/chef_fixie/sql_objects.rb
|
206
|
+
- lib/chef_fixie/utility_helpers.rb
|
207
|
+
- lib/chef_fixie/version.rb
|
208
|
+
- spec/chef_fixie/acl_spec.rb
|
209
|
+
- spec/chef_fixie/assoc_invite_spec.rb
|
210
|
+
- spec/chef_fixie/assoc_invite_spec.rb~
|
211
|
+
- spec/chef_fixie/check_org_associations_spec.rb
|
212
|
+
- spec/chef_fixie/check_org_associations_spec.rb~
|
213
|
+
- spec/chef_fixie/groups_spec.rb
|
214
|
+
- spec/chef_fixie/org_spec.rb
|
215
|
+
- spec/chef_fixie/org_spec.rb~
|
216
|
+
- spec/chef_fixie/orgs_spec.rb
|
217
|
+
- spec/spec_helper.rb
|
218
|
+
homepage: https://github.com/chef/fixie
|
219
|
+
licenses:
|
220
|
+
- Apache2
|
221
|
+
metadata: {}
|
222
|
+
post_install_message:
|
223
|
+
rdoc_options: []
|
224
|
+
require_paths:
|
225
|
+
- lib
|
226
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
227
|
+
requirements:
|
228
|
+
- - ">="
|
229
|
+
- !ruby/object:Gem::Version
|
230
|
+
version: '0'
|
231
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
232
|
+
requirements:
|
233
|
+
- - ">="
|
234
|
+
- !ruby/object:Gem::Version
|
235
|
+
version: '0'
|
236
|
+
requirements: []
|
237
|
+
rubyforge_project:
|
238
|
+
rubygems_version: 2.2.2
|
239
|
+
signing_key:
|
240
|
+
specification_version: 4
|
241
|
+
summary: Low level manipulation tool for Chef Server 12 and later
|
242
|
+
test_files:
|
243
|
+
- spec/chef_fixie/acl_spec.rb
|
244
|
+
- spec/chef_fixie/assoc_invite_spec.rb
|
245
|
+
- spec/chef_fixie/assoc_invite_spec.rb~
|
246
|
+
- spec/chef_fixie/check_org_associations_spec.rb
|
247
|
+
- spec/chef_fixie/check_org_associations_spec.rb~
|
248
|
+
- spec/chef_fixie/groups_spec.rb
|
249
|
+
- spec/chef_fixie/org_spec.rb
|
250
|
+
- spec/chef_fixie/org_spec.rb~
|
251
|
+
- spec/chef_fixie/orgs_spec.rb
|
252
|
+
- spec/spec_helper.rb
|