chef_fixie 0.3.0 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +5 -5
  2. data/bin/chef_fixie +1 -1
  3. data/doc/BulkFixup.md +1 -1
  4. data/doc/CommonTasks.md +14 -3
  5. data/lib/chef_fixie.rb +7 -7
  6. data/lib/chef_fixie/authz_mapper.rb +26 -28
  7. data/lib/chef_fixie/authz_objects.rb +44 -41
  8. data/lib/chef_fixie/bulk_edit_permissions.rb +24 -20
  9. data/lib/chef_fixie/check_org_associations.rb +56 -58
  10. data/lib/chef_fixie/config.rb +58 -24
  11. data/lib/chef_fixie/console.rb +15 -10
  12. data/lib/chef_fixie/context.rb +2 -4
  13. data/lib/chef_fixie/sql.rb +12 -12
  14. data/lib/chef_fixie/sql_objects.rb +49 -38
  15. data/lib/chef_fixie/utility_helpers.rb +13 -9
  16. data/lib/chef_fixie/version.rb +1 -1
  17. data/spec/chef_fixie/acl_spec.rb +23 -25
  18. data/spec/chef_fixie/assoc_invite_spec.rb +5 -8
  19. data/spec/chef_fixie/check_org_associations_spec.rb +14 -17
  20. data/spec/chef_fixie/groups_spec.rb +7 -11
  21. data/spec/chef_fixie/org_spec.rb +4 -5
  22. data/spec/chef_fixie/orgs_spec.rb +6 -9
  23. data/spec/spec_helper.rb +5 -6
  24. metadata +18 -84
  25. data/bin/bundler +0 -16
  26. data/bin/chef-apply +0 -16
  27. data/bin/chef-client +0 -16
  28. data/bin/chef-shell +0 -16
  29. data/bin/chef-solo +0 -16
  30. data/bin/chef-zero +0 -16
  31. data/bin/coderay +0 -16
  32. data/bin/edit_json.rb +0 -16
  33. data/bin/erubis +0 -16
  34. data/bin/ffi-yajl-bench +0 -16
  35. data/bin/fixie~ +0 -231
  36. data/bin/htmldiff +0 -16
  37. data/bin/knife +0 -16
  38. data/bin/ldiff +0 -16
  39. data/bin/net-dhcp +0 -16
  40. data/bin/ohai +0 -16
  41. data/bin/prettify_json.rb +0 -16
  42. data/bin/pry +0 -16
  43. data/bin/rackup +0 -16
  44. data/bin/rake +0 -16
  45. data/bin/rdoc +0 -16
  46. data/bin/restclient +0 -16
  47. data/bin/ri +0 -16
  48. data/bin/rspec +0 -16
  49. data/bin/s3sh +0 -16
  50. data/bin/sequel +0 -16
  51. data/bin/serverspec-init +0 -16
  52. data/doc/AccessingSQL.md~ +0 -32
  53. data/doc/BulkFixup.md~ +0 -28
  54. data/doc/CommonTasks.md~ +0 -0
  55. data/doc/GETTING_STARTED.md~ +0 -6
  56. data/spec/chef_fixie/assoc_invite_spec.rb~ +0 -26
  57. data/spec/chef_fixie/check_org_associations_spec.rb~ +0 -34
  58. data/spec/chef_fixie/org_spec.rb~ +0 -53
@@ -1,18 +1,17 @@
1
1
 
2
- require 'rspec'
2
+ require "rspec"
3
3
  require "spec_helper"
4
- require 'chef_fixie'
5
- require 'chef_fixie/config'
4
+ require "chef_fixie"
5
+ require "chef_fixie/config"
6
6
 
7
7
  RSpec.describe ChefFixie::Sql::Associations, "Associations tests" do
8
8
  let (:test_org_name) { "ponyville" }
9
9
  let (:orgs) { ChefFixie::Sql::Orgs.new }
10
- let (:test_org) { orgs[test_org_name]}
10
+ let (:test_org) { orgs[test_org_name] }
11
11
 
12
12
  let (:users) { ChefFixie::Sql::Users.new }
13
13
  let (:assocs) { ChefFixie::Sql::Associations.new }
14
14
 
15
-
16
15
  context "Basic functionality of association spec" do
17
16
  let ("test_user_name") { "fluttershy" }
18
17
  let ("test_user") { users[test_user_name] }
@@ -37,11 +36,9 @@ RSpec.describe ChefFixie::Sql::Associations, "Associations tests" do
37
36
  expect(assoc_item.org_id).to eq(test_org.id)
38
37
 
39
38
  # test user not in org
40
- expect(assocs.by_org_id_user_id(test_org.id, users['mary'].id)).to be_nil
39
+ expect(assocs.by_org_id_user_id(test_org.id, users["mary"].id)).to be_nil
41
40
  end
42
41
 
43
-
44
42
  end
45
43
 
46
-
47
44
  end
@@ -1,17 +1,17 @@
1
1
  # -*- indent-tabs-mode: nil; fill-column: 110 -*-
2
- require 'rspec'
2
+ require "rspec"
3
3
  require "spec_helper"
4
- require 'chef_fixie'
5
- require 'chef_fixie/config'
4
+ require "chef_fixie"
5
+ require "chef_fixie/config"
6
6
 
7
7
  RSpec.describe ChefFixie::CheckOrgAssociations, "Association checker" do
8
- let (:test_org_name) { "ponyville"}
8
+ let (:test_org_name) { "ponyville" }
9
9
  let (:orgs) { ChefFixie::Sql::Orgs.new }
10
10
  let (:test_org) { orgs[test_org_name] }
11
11
 
12
12
  let (:users) { ChefFixie::Sql::Users.new }
13
- let (:adminuser) { users['rainbowdash'] }
14
- let (:notorguser) { users['mary'] }
13
+ let (:adminuser) { users["rainbowdash"] }
14
+ let (:notorguser) { users["mary"] }
15
15
 
16
16
  # TODO this should use a freshly created object and purge it afterwords.
17
17
  # But we need to write the create object feature still
@@ -29,10 +29,10 @@ RSpec.describe ChefFixie::CheckOrgAssociations, "Association checker" do
29
29
  end
30
30
 
31
31
  after :each do
32
- usag = test_org.groups[adminuser.id]
32
+ usag = test_org.groups[adminuser.id]
33
33
 
34
34
  usag.group_add(adminuser)
35
- test_org.groups['users'].group_add(usag)
35
+ test_org.groups["users"].group_add(usag)
36
36
 
37
37
  adminuser.ace_add(:read, test_org.global_admins)
38
38
 
@@ -47,7 +47,7 @@ RSpec.describe ChefFixie::CheckOrgAssociations, "Association checker" do
47
47
 
48
48
  it "Detects user missing from usag" do
49
49
  # break it
50
- usag = test_org.groups[adminuser.id]
50
+ usag = test_org.groups[adminuser.id]
51
51
  usag.group_delete(adminuser)
52
52
 
53
53
  expect(ChefFixie::CheckOrgAssociations.check_association(test_org, adminuser)).to be :user_not_in_usag
@@ -55,8 +55,8 @@ RSpec.describe ChefFixie::CheckOrgAssociations, "Association checker" do
55
55
 
56
56
  it "Detects usag missing from users group" do
57
57
  # break it
58
- usag = test_org.groups[adminuser.id]
59
- test_org.groups['users'].group_delete(usag)
58
+ usag = test_org.groups[adminuser.id]
59
+ test_org.groups["users"].group_delete(usag)
60
60
 
61
61
  expect(ChefFixie::CheckOrgAssociations.check_association(test_org, adminuser)).to be :usag_not_in_users
62
62
  end
@@ -78,10 +78,10 @@ RSpec.describe ChefFixie::CheckOrgAssociations, "Association checker" do
78
78
  end
79
79
 
80
80
  after :each do
81
- usag = test_org.groups[adminuser.id]
81
+ usag = test_org.groups[adminuser.id]
82
82
 
83
83
  usag.group_add(adminuser)
84
- test_org.groups['users'].group_add(usag)
84
+ test_org.groups["users"].group_add(usag)
85
85
 
86
86
  adminuser.ace_add(:read, test_org.global_admins)
87
87
 
@@ -106,7 +106,7 @@ RSpec.describe ChefFixie::CheckOrgAssociations, "Association checker" do
106
106
  it "Fixes usag missing from users group" do
107
107
  # break it
108
108
  usag = test_org.groups[adminuser.id]
109
- test_org.groups['users'].group_delete(usag)
109
+ test_org.groups["users"].group_delete(usag)
110
110
 
111
111
  expect(ChefFixie::CheckOrgAssociations.fix_association(test_org, adminuser)).to be true
112
112
  expect(ChefFixie::CheckOrgAssociations.check_association(test_org, adminuser)).to be true
@@ -124,7 +124,6 @@ RSpec.describe ChefFixie::CheckOrgAssociations, "Association checker" do
124
124
 
125
125
  end
126
126
 
127
-
128
127
  # TODO Break the org and check it!
129
128
  context "Global org check" do
130
129
 
@@ -135,6 +134,4 @@ RSpec.describe ChefFixie::CheckOrgAssociations, "Association checker" do
135
134
 
136
135
  end
137
136
 
138
-
139
-
140
137
  end
@@ -1,11 +1,11 @@
1
1
  # -*- indent-tabs-mode: nil; fill-column: 110 -*-
2
- require 'rspec'
2
+ require "rspec"
3
3
  require "spec_helper"
4
- require 'chef_fixie'
5
- require 'chef_fixie/config'
4
+ require "chef_fixie"
5
+ require "chef_fixie/config"
6
6
 
7
7
  RSpec.describe ChefFixie::Sql::Groups, "Group access" do
8
- let (:test_org_name) { "ponyville"}
8
+ let (:test_org_name) { "ponyville" }
9
9
  let (:orgs) { ChefFixie::Sql::Orgs.new }
10
10
  let (:users) { ChefFixie::Sql::Users.new }
11
11
  let (:test_org) { orgs[test_org_name] }
@@ -14,9 +14,9 @@ RSpec.describe ChefFixie::Sql::Groups, "Group access" do
14
14
  # But we need to write the create object feature still
15
15
 
16
16
  context "Groups" do
17
- let (:testgroup) { test_org.groups['admins'] }
18
- let (:adminuser) { users['rainbowdash'] }
19
- let (:notadminuser) { users['mary'] }
17
+ let (:testgroup) { test_org.groups["admins"] }
18
+ let (:adminuser) { users["rainbowdash"] }
19
+ let (:notadminuser) { users["mary"] }
20
20
 
21
21
  it "Members are part of the group" do
22
22
  expect(testgroup.member?(adminuser)).to be true
@@ -25,10 +25,6 @@ RSpec.describe ChefFixie::Sql::Groups, "Group access" do
25
25
  expect(testgroup.member?(notadminuser)).to be false
26
26
  end
27
27
 
28
-
29
28
  end
30
29
 
31
-
32
-
33
-
34
30
  end
@@ -1,13 +1,13 @@
1
1
 
2
- require 'rspec'
2
+ require "rspec"
3
3
  require "spec_helper"
4
- require 'chef_fixie'
5
- require 'chef_fixie/config'
4
+ require "chef_fixie"
5
+ require "chef_fixie/config"
6
6
 
7
7
  RSpec.describe ChefFixie::Sql::Orgs, "Organizations access" do
8
8
  let (:test_org_name) { "ponyville" }
9
9
  let (:orgs) { ChefFixie::Sql::Orgs.new }
10
- let (:test_org) { orgs[test_org_name]}
10
+ let (:test_org) { orgs[test_org_name] }
11
11
 
12
12
  context "Basic functionality of org accessor" do
13
13
 
@@ -22,5 +22,4 @@ RSpec.describe ChefFixie::Sql::Orgs, "Organizations access" do
22
22
 
23
23
  end
24
24
 
25
-
26
25
  end
@@ -1,11 +1,11 @@
1
1
 
2
- require 'rspec'
2
+ require "rspec"
3
3
  require "spec_helper"
4
- require 'chef_fixie'
5
- require 'chef_fixie/config'
4
+ require "chef_fixie"
5
+ require "chef_fixie/config"
6
6
 
7
7
  RSpec.describe ChefFixie::Sql::Orgs, "Organizations access" do
8
- let (:test_org) { "ponyville"}
8
+ let (:test_org) { "ponyville" }
9
9
 
10
10
  context "Basic access to orgs" do
11
11
  let (:orgs) { ChefFixie::Sql::Orgs.new }
@@ -15,7 +15,7 @@ RSpec.describe ChefFixie::Sql::Orgs, "Organizations access" do
15
15
 
16
16
  it "We can list orgs" do
17
17
  # array matcher requires a splat. (I didn't know this )
18
- expect(orgs.list).to include( * %w(acme ponyville wonderbolts) )
18
+ expect(orgs.list).to include( * %w{acme ponyville wonderbolts} )
19
19
  end
20
20
  it "We can list orgs with a limit" do
21
21
  # array matcher requires a splat. (I didn't know this )
@@ -38,7 +38,7 @@ RSpec.describe ChefFixie::Sql::Orgs, "Organizations access" do
38
38
  end
39
39
 
40
40
  # TODO: Automatically extract this from the filter by field
41
- %w(name, id, full_name, authz_id).each do |accessor|
41
+ %w{name, id, full_name, authz_id}.each do |accessor|
42
42
  it "We can access an org by #{accessor}" do
43
43
  expect(orgs.by_name(test_org).all.count).to eq(1)
44
44
  expect(orgs.by_name(test_org).all.first.name).to eq(the_org.name)
@@ -47,7 +47,4 @@ RSpec.describe ChefFixie::Sql::Orgs, "Organizations access" do
47
47
 
48
48
  end
49
49
 
50
-
51
-
52
-
53
50
  end
data/spec/spec_helper.rb CHANGED
@@ -4,7 +4,7 @@
4
4
  # loaded once.
5
5
  #
6
6
  # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
7
- require 'chef_fixie/config'
7
+ require "chef_fixie/config"
8
8
 
9
9
  def load_from_config_example
10
10
  # load from config file
@@ -13,7 +13,7 @@ def load_from_config_example
13
13
  end
14
14
 
15
15
  def load_from_opscode
16
- ChefFixie::Config::instance.load_from_pc
16
+ ChefFixie::Config.instance.load_from_pc
17
17
  end
18
18
 
19
19
  RSpec.configure do |config|
@@ -24,7 +24,7 @@ RSpec.configure do |config|
24
24
  # order dependency and want to debug it, you can fix the order by providing
25
25
  # the seed, which is printed after each run.
26
26
  # --seed 1234
27
- config.order = 'random'
27
+ config.order = "random"
28
28
 
29
29
  # configure specs
30
30
 
@@ -35,7 +35,6 @@ RSpec.configure do |config|
35
35
  # Horrible shameful hack TODO FIXME
36
36
  # We can't include a lot of the SQL code until we configure things, because
37
37
  # we inherit from Model e.g.
38
- # class Users < Sequel::Model(:users)
39
- require 'chef_fixie'
38
+ # class Users < Sequel::Model(:users)
39
+ require "chef_fixie"
40
40
  end
41
-
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef_fixie
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Anderson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-24 00:00:00.000000000 Z
11
+ date: 2021-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 11.12.2
19
+ version: '16'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 11.12.2
26
+ version: '16'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: ffi-yajl
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -44,34 +44,34 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0.17'
47
+ version: '1.2'
48
48
  - - ">="
49
49
  - !ruby/object:Gem::Version
50
- version: 0.17.1
50
+ version: 1.2.3
51
51
  type: :runtime
52
52
  prerelease: false
53
53
  version_requirements: !ruby/object:Gem::Requirement
54
54
  requirements:
55
55
  - - "~>"
56
56
  - !ruby/object:Gem::Version
57
- version: '0.17'
57
+ version: '1.2'
58
58
  - - ">="
59
59
  - !ruby/object:Gem::Version
60
- version: 0.17.1
60
+ version: 1.2.3
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: pry
63
63
  requirement: !ruby/object:Gem::Requirement
64
64
  requirements:
65
65
  - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: 0.10.1
67
+ version: '0.13'
68
68
  type: :runtime
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
72
  - - "~>"
73
73
  - !ruby/object:Gem::Version
74
- version: 0.10.1
74
+ version: '0.13'
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: sequel
77
77
  requirement: !ruby/object:Gem::Requirement
@@ -107,48 +107,20 @@ dependencies:
107
107
  - !ruby/object:Gem::Version
108
108
  version: 2.1.3
109
109
  - !ruby/object:Gem::Dependency
110
- name: bundler
110
+ name: veil
111
111
  requirement: !ruby/object:Gem::Requirement
112
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
- - - "~>"
113
+ - - ">="
142
114
  - !ruby/object:Gem::Version
143
115
  version: '0'
144
- type: :development
116
+ type: :runtime
145
117
  prerelease: false
146
118
  version_requirements: !ruby/object:Gem::Requirement
147
119
  requirements:
148
- - - "~>"
120
+ - - ">="
149
121
  - !ruby/object:Gem::Version
150
122
  version: '0'
151
- description: Low level manipulation tool for Chef Server 12 and later
123
+ description: Low level manipulation tool for Chef Infra Server
152
124
  email:
153
125
  - mark@chef.io
154
126
  executables:
@@ -158,42 +130,11 @@ extra_rdoc_files: []
158
130
  files:
159
131
  - LICENSE
160
132
  - 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
133
  - 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
134
  - doc/AccessingSQL.md
190
- - doc/AccessingSQL.md~
191
135
  - doc/BulkFixup.md
192
- - doc/BulkFixup.md~
193
136
  - doc/CommonTasks.md
194
- - doc/CommonTasks.md~
195
137
  - doc/GETTING_STARTED.md
196
- - doc/GETTING_STARTED.md~
197
138
  - fixie.conf.example
198
139
  - lib/chef_fixie.rb
199
140
  - lib/chef_fixie/authz_mapper.rb
@@ -209,17 +150,14 @@ files:
209
150
  - lib/chef_fixie/version.rb
210
151
  - spec/chef_fixie/acl_spec.rb
211
152
  - spec/chef_fixie/assoc_invite_spec.rb
212
- - spec/chef_fixie/assoc_invite_spec.rb~
213
153
  - spec/chef_fixie/check_org_associations_spec.rb
214
- - spec/chef_fixie/check_org_associations_spec.rb~
215
154
  - spec/chef_fixie/groups_spec.rb
216
155
  - spec/chef_fixie/org_spec.rb
217
- - spec/chef_fixie/org_spec.rb~
218
156
  - spec/chef_fixie/orgs_spec.rb
219
157
  - spec/spec_helper.rb
220
158
  homepage: https://github.com/chef/fixie
221
159
  licenses:
222
- - Apache2
160
+ - Apache-2.0
223
161
  metadata: {}
224
162
  post_install_message:
225
163
  rdoc_options: []
@@ -236,19 +174,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
236
174
  - !ruby/object:Gem::Version
237
175
  version: '0'
238
176
  requirements: []
239
- rubyforge_project:
240
- rubygems_version: 2.2.2
177
+ rubygems_version: 3.1.4
241
178
  signing_key:
242
179
  specification_version: 4
243
- summary: Low level manipulation tool for Chef Server 12 and later
180
+ summary: Low level manipulation tool for Chef Infra Server
244
181
  test_files:
245
182
  - spec/chef_fixie/acl_spec.rb
246
183
  - spec/chef_fixie/assoc_invite_spec.rb
247
- - spec/chef_fixie/assoc_invite_spec.rb~
248
184
  - spec/chef_fixie/check_org_associations_spec.rb
249
- - spec/chef_fixie/check_org_associations_spec.rb~
250
185
  - spec/chef_fixie/groups_spec.rb
251
186
  - spec/chef_fixie/org_spec.rb
252
- - spec/chef_fixie/org_spec.rb~
253
187
  - spec/chef_fixie/orgs_spec.rb
254
188
  - spec/spec_helper.rb