chef_fixie 0.1.0 → 0.5.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 +5 -5
- data/bin/chef_fixie +2 -2
- data/doc/AccessingSQL.md +33 -1
- data/doc/BulkFixup.md +33 -0
- data/doc/CommonTasks.md +14 -3
- data/lib/chef_fixie.rb +7 -6
- data/lib/chef_fixie/authz_mapper.rb +26 -28
- data/lib/chef_fixie/authz_objects.rb +51 -41
- data/lib/chef_fixie/bulk_edit_permissions.rb +161 -0
- data/lib/chef_fixie/check_org_associations.rb +56 -59
- data/lib/chef_fixie/config.rb +58 -23
- data/lib/chef_fixie/console.rb +17 -12
- data/lib/chef_fixie/context.rb +2 -4
- data/lib/chef_fixie/sql.rb +12 -12
- data/lib/chef_fixie/sql_objects.rb +107 -31
- data/lib/chef_fixie/utility_helpers.rb +13 -9
- data/lib/chef_fixie/version.rb +1 -1
- data/spec/chef_fixie/acl_spec.rb +23 -25
- data/spec/chef_fixie/assoc_invite_spec.rb +5 -8
- data/spec/chef_fixie/check_org_associations_spec.rb +14 -17
- data/spec/chef_fixie/groups_spec.rb +7 -11
- data/spec/chef_fixie/org_spec.rb +4 -5
- data/spec/chef_fixie/orgs_spec.rb +6 -9
- data/spec/spec_helper.rb +5 -6
- metadata +13 -49
- data/bin/bundler +0 -16
- data/bin/chef-apply +0 -16
- data/bin/chef-client +0 -16
- data/bin/chef-shell +0 -16
- data/bin/chef-solo +0 -16
- data/bin/chef-zero +0 -16
- data/bin/coderay +0 -16
- data/bin/edit_json.rb +0 -16
- data/bin/erubis +0 -16
- data/bin/ffi-yajl-bench +0 -16
- data/bin/fixie~ +0 -231
- data/bin/htmldiff +0 -16
- data/bin/knife +0 -16
- data/bin/ldiff +0 -16
- data/bin/net-dhcp +0 -16
- data/bin/ohai +0 -16
- data/bin/prettify_json.rb +0 -16
- data/bin/pry +0 -16
- data/bin/rackup +0 -16
- data/bin/rake +0 -16
- data/bin/rdoc +0 -16
- data/bin/restclient +0 -16
- data/bin/ri +0 -16
- data/bin/rspec +0 -16
- data/bin/s3sh +0 -16
- data/bin/sequel +0 -16
- data/bin/serverspec-init +0 -16
- data/doc/AccessingSQL.md~ +0 -32
- data/doc/BulkFixup.md~ +0 -28
- data/doc/CommonTasks.md~ +0 -0
- data/doc/GETTING_STARTED.md~ +0 -6
- data/spec/chef_fixie/assoc_invite_spec.rb~ +0 -26
- data/spec/chef_fixie/check_org_associations_spec.rb~ +0 -34
- data/spec/chef_fixie/org_spec.rb~ +0 -53
| @@ -18,42 +18,46 @@ | |
| 18 18 | 
             
            # Author: Mark Anderson <mark@chef.io>
         | 
| 19 19 | 
             
            #
         | 
| 20 20 |  | 
| 21 | 
            -
             | 
| 22 | 
            -
             | 
| 23 | 
            -
             | 
| 21 | 
            +
            require_relative "config"
         | 
| 22 | 
            +
            require_relative "authz_objects"
         | 
| 23 | 
            +
            require_relative "authz_mapper"
         | 
| 24 24 |  | 
| 25 25 | 
             
            module ChefFixie
         | 
| 26 26 | 
             
              module UtilityHelpers
         | 
| 27 27 | 
             
                def self.orgs
         | 
| 28 28 | 
             
                  @orgs ||= ChefFixie::Sql::Orgs.new
         | 
| 29 29 | 
             
                end
         | 
| 30 | 
            +
             | 
| 30 31 | 
             
                def self.users
         | 
| 31 32 | 
             
                  @users ||= ChefFixie::Sql::Users.new
         | 
| 32 33 | 
             
                end
         | 
| 34 | 
            +
             | 
| 33 35 | 
             
                def self.assocs
         | 
| 34 36 | 
             
                  @assocs ||= ChefFixie::Sql::Associations.new
         | 
| 35 37 | 
             
                end
         | 
| 38 | 
            +
             | 
| 36 39 | 
             
                def self.invites
         | 
| 37 40 | 
             
                  invites ||= ChefFixie::Sql::Invites.new
         | 
| 38 41 | 
             
                end
         | 
| 39 42 |  | 
| 40 43 | 
             
                def self.make_user(user)
         | 
| 41 44 | 
             
                  if user.is_a?(String)
         | 
| 42 | 
            -
                     | 
| 45 | 
            +
                    users[user]
         | 
| 43 46 | 
             
                  elsif user.is_a?(ChefFixie::Sql::User)
         | 
| 44 | 
            -
                     | 
| 47 | 
            +
                    user
         | 
| 45 48 | 
             
                  else
         | 
| 46 49 | 
             
                    raise Exception "Expected a user, got a #{user.class}"
         | 
| 47 50 | 
             
                  end
         | 
| 48 | 
            -
                end | 
| 51 | 
            +
                end
         | 
| 52 | 
            +
             | 
| 49 53 | 
             
                def self.make_org(org)
         | 
| 50 54 | 
             
                  if org.is_a?(String)
         | 
| 51 | 
            -
                     | 
| 55 | 
            +
                    orgs[org]
         | 
| 52 56 | 
             
                  elsif org.is_a?(ChefFixie::Sql::Org)
         | 
| 53 | 
            -
                     | 
| 57 | 
            +
                    org
         | 
| 54 58 | 
             
                  else
         | 
| 55 59 | 
             
                    raise Exception "Expected an org, got a #{org.class}"
         | 
| 56 60 | 
             
                  end
         | 
| 57 | 
            -
                end | 
| 61 | 
            +
                end
         | 
| 58 62 | 
             
              end
         | 
| 59 63 | 
             
            end
         | 
    
        data/lib/chef_fixie/version.rb
    CHANGED
    
    
    
        data/spec/chef_fixie/acl_spec.rb
    CHANGED
    
    | @@ -1,46 +1,45 @@ | |
| 1 1 |  | 
| 2 | 
            -
            require  | 
| 2 | 
            +
            require "rspec"
         | 
| 3 3 | 
             
            require "spec_helper"
         | 
| 4 | 
            -
            require  | 
| 5 | 
            -
            require  | 
| 4 | 
            +
            require "chef_fixie"
         | 
| 5 | 
            +
            require "chef_fixie/config"
         | 
| 6 6 |  | 
| 7 7 | 
             
            RSpec.describe ChefFixie::Sql::Orgs, "ACL 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] }
         | 
| 12 12 |  | 
| 13 13 | 
             
              # TODO this should use a freshly created object and purge it afterwords.
         | 
| 14 14 | 
             
              # But we need to write the create object feature still
         | 
| 15 | 
            -
             | 
| 15 | 
            +
             | 
| 16 16 | 
             
              context "Fetch acl for actor (client)" do
         | 
| 17 17 | 
             
                let (:testclient) { test_org.clients.all.first }
         | 
| 18 | 
            -
                let (:testuser) { users[ | 
| 19 | 
            -
                let (:pivotal) { users[ | 
| 18 | 
            +
                let (:testuser) { users["spitfire"] }
         | 
| 19 | 
            +
                let (:pivotal) { users["pivotal"] }
         | 
| 20 20 | 
             
                let (:client_container) { test_org.containers["clients"] }
         | 
| 21 | 
            -
             | 
| 21 | 
            +
             | 
| 22 22 | 
             
                it "We can fetch the acl" do
         | 
| 23 23 | 
             
                  acl = testclient.acl
         | 
| 24 | 
            -
                  expect(acl.keys).to include(* %w | 
| 24 | 
            +
                  expect(acl.keys).to include(* %w{create read update delete grant})
         | 
| 25 25 | 
             
                end
         | 
| 26 26 |  | 
| 27 27 | 
             
                it "we can add a user to an ace" do
         | 
| 28 | 
            -
            # This requires either a temp object or good cleanup | 
| 28 | 
            +
            # This requires either a temp object or good cleanup
         | 
| 29 29 | 
             
            #      acl = testclient.acl
         | 
| 30 30 | 
             
            #      expect(acl["read"]["actors"].not_to include("wonderbolts")
         | 
| 31 | 
            -
             | 
| 31 | 
            +
             | 
| 32 32 | 
             
                  testclient.ace_add(:read, testuser)
         | 
| 33 33 |  | 
| 34 34 | 
             
                  acl = testclient.acl
         | 
| 35 35 | 
             
                  expect(acl["read"]["actors"]).to include([:global, testuser.name])
         | 
| 36 36 | 
             
                end
         | 
| 37 | 
            -
             | 
| 37 | 
            +
             | 
| 38 38 | 
             
                it "we can add then delete a user from an ace" do
         | 
| 39 39 | 
             
                  testclient.ace_add(:read, testuser)
         | 
| 40 40 | 
             
                  acl = testclient.acl
         | 
| 41 41 | 
             
                  expect(acl["read"]["actors"]).to include([:global, testuser.name])
         | 
| 42 42 |  | 
| 43 | 
            -
                  
         | 
| 44 43 | 
             
                  testclient.ace_delete(:read, testuser)
         | 
| 45 44 |  | 
| 46 45 | 
             
                  acl = testclient.acl
         | 
| @@ -49,26 +48,26 @@ RSpec.describe ChefFixie::Sql::Orgs, "ACL access" do | |
| 49 48 |  | 
| 50 49 | 
             
                it "we can copy users from another acl" do
         | 
| 51 50 | 
             
                  testclient.ace_delete(:all, pivotal)
         | 
| 52 | 
            -
             | 
| 51 | 
            +
             | 
| 53 52 | 
             
                  testclient.acl_add_from_object(client_container)
         | 
| 54 53 |  | 
| 55 54 | 
             
                  acl = testclient.acl
         | 
| 56 | 
            -
                  %w | 
| 55 | 
            +
                  %w{create read update delete grant}.each do |action|
         | 
| 57 56 | 
             
                    expect(acl[action]["actors"]).to include([:global, pivotal.name])
         | 
| 58 57 | 
             
                  end
         | 
| 59 58 | 
             
                end
         | 
| 60 | 
            -
             | 
| 59 | 
            +
             | 
| 61 60 | 
             
              end
         | 
| 62 61 |  | 
| 63 62 | 
             
              context "ACE Membership" do
         | 
| 64 | 
            -
             | 
| 65 | 
            -
                let (:admingroup) { test_org.groups[ | 
| 66 | 
            -
                let (:testobject) { test_org.groups[ | 
| 67 | 
            -
                let (:notadmingroup) { test_org.groups[ | 
| 68 | 
            -
                let (:adminuser) { users[ | 
| 69 | 
            -
                let (:notadminuser) { users[ | 
| 70 | 
            -
                let (:pivotal) { users[ | 
| 71 | 
            -
             | 
| 63 | 
            +
             | 
| 64 | 
            +
                let (:admingroup) { test_org.groups["admins"] }
         | 
| 65 | 
            +
                let (:testobject) { test_org.groups["admins"] }
         | 
| 66 | 
            +
                let (:notadmingroup) { test_org.groups["clients"] }
         | 
| 67 | 
            +
                let (:adminuser) { users["rainbowdash"] }
         | 
| 68 | 
            +
                let (:notadminuser) { users["mary"] }
         | 
| 69 | 
            +
                let (:pivotal) { users["pivotal"] }
         | 
| 70 | 
            +
             | 
| 72 71 | 
             
                it "Privileged users and groups are part of the read ACE" do
         | 
| 73 72 | 
             
                  expect(testobject.ace_member?(:read, admingroup)).to be true
         | 
| 74 73 | 
             
                  expect(testobject.ace_member?(:read, pivotal)).to be true
         | 
| @@ -79,5 +78,4 @@ RSpec.describe ChefFixie::Sql::Orgs, "ACL access" do | |
| 79 78 | 
             
                end
         | 
| 80 79 | 
             
              end
         | 
| 81 80 |  | 
| 82 | 
            -
             | 
| 83 81 | 
             
            end
         | 
| @@ -1,18 +1,17 @@ | |
| 1 1 |  | 
| 2 | 
            -
            require  | 
| 2 | 
            +
            require "rspec"
         | 
| 3 3 | 
             
            require "spec_helper"
         | 
| 4 | 
            -
            require  | 
| 5 | 
            -
            require  | 
| 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[ | 
| 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  | 
| 2 | 
            +
            require "rspec"
         | 
| 3 3 | 
             
            require "spec_helper"
         | 
| 4 | 
            -
            require  | 
| 5 | 
            -
            require  | 
| 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[ | 
| 14 | 
            -
              let (:notorguser) { users[ | 
| 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 = | 
| 32 | 
            +
                  usag = test_org.groups[adminuser.id]
         | 
| 33 33 |  | 
| 34 34 | 
             
                  usag.group_add(adminuser)
         | 
| 35 | 
            -
                  test_org.groups[ | 
| 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 = | 
| 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 = | 
| 59 | 
            -
                  test_org.groups[ | 
| 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 = | 
| 81 | 
            +
                  usag = test_org.groups[adminuser.id]
         | 
| 82 82 |  | 
| 83 83 | 
             
                  usag.group_add(adminuser)
         | 
| 84 | 
            -
                  test_org.groups[ | 
| 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[ | 
| 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  | 
| 2 | 
            +
            require "rspec"
         | 
| 3 3 | 
             
            require "spec_helper"
         | 
| 4 | 
            -
            require  | 
| 5 | 
            -
            require  | 
| 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[ | 
| 18 | 
            -
                let (:adminuser) { users[ | 
| 19 | 
            -
                let (:notadminuser) { users[ | 
| 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
         | 
    
        data/spec/chef_fixie/org_spec.rb
    CHANGED
    
    | @@ -1,13 +1,13 @@ | |
| 1 1 |  | 
| 2 | 
            -
            require  | 
| 2 | 
            +
            require "rspec"
         | 
| 3 3 | 
             
            require "spec_helper"
         | 
| 4 | 
            -
            require  | 
| 5 | 
            -
            require  | 
| 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  | 
| 2 | 
            +
            require "rspec"
         | 
| 3 3 | 
             
            require "spec_helper"
         | 
| 4 | 
            -
            require  | 
| 5 | 
            -
            require  | 
| 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 | 
| 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 | 
| 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  | 
| 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 | 
| 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 =  | 
| 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  | 
| 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. | 
| 4 | 
            +
              version: 0.5.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Mark Anderson
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2021-04-22 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:  | 
| 19 | 
            +
                    version: '15.2'
         | 
| 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:  | 
| 26 | 
            +
                    version: '15.2'
         | 
| 27 27 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 28 28 | 
             
              name: ffi-yajl
         | 
| 29 29 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -107,19 +107,19 @@ dependencies: | |
| 107 107 | 
             
                  - !ruby/object:Gem::Version
         | 
| 108 108 | 
             
                    version: 2.1.3
         | 
| 109 109 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 110 | 
            -
              name:  | 
| 110 | 
            +
              name: veil
         | 
| 111 111 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 112 112 | 
             
                requirements:
         | 
| 113 | 
            -
                - - " | 
| 113 | 
            +
                - - ">="
         | 
| 114 114 | 
             
                  - !ruby/object:Gem::Version
         | 
| 115 | 
            -
                    version: ' | 
| 116 | 
            -
              type: : | 
| 115 | 
            +
                    version: '0'
         | 
| 116 | 
            +
              type: :runtime
         | 
| 117 117 | 
             
              prerelease: false
         | 
| 118 118 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 119 119 | 
             
                requirements:
         | 
| 120 | 
            -
                - - " | 
| 120 | 
            +
                - - ">="
         | 
| 121 121 | 
             
                  - !ruby/object:Gem::Version
         | 
| 122 | 
            -
                    version: ' | 
| 122 | 
            +
                    version: '0'
         | 
| 123 123 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 124 124 | 
             
              name: rake
         | 
| 125 125 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -158,45 +158,16 @@ extra_rdoc_files: [] | |
| 158 158 | 
             
            files:
         | 
| 159 159 | 
             
            - LICENSE
         | 
| 160 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 161 | 
             
            - 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 162 | 
             
            - doc/AccessingSQL.md
         | 
| 190 | 
            -
            - doc/ | 
| 191 | 
            -
            - doc/BulkFixup.md~
         | 
| 163 | 
            +
            - doc/BulkFixup.md
         | 
| 192 164 | 
             
            - doc/CommonTasks.md
         | 
| 193 | 
            -
            - doc/CommonTasks.md~
         | 
| 194 165 | 
             
            - doc/GETTING_STARTED.md
         | 
| 195 | 
            -
            - doc/GETTING_STARTED.md~
         | 
| 196 166 | 
             
            - fixie.conf.example
         | 
| 197 167 | 
             
            - lib/chef_fixie.rb
         | 
| 198 168 | 
             
            - lib/chef_fixie/authz_mapper.rb
         | 
| 199 169 | 
             
            - lib/chef_fixie/authz_objects.rb
         | 
| 170 | 
            +
            - lib/chef_fixie/bulk_edit_permissions.rb
         | 
| 200 171 | 
             
            - lib/chef_fixie/check_org_associations.rb
         | 
| 201 172 | 
             
            - lib/chef_fixie/config.rb
         | 
| 202 173 | 
             
            - lib/chef_fixie/console.rb
         | 
| @@ -207,12 +178,9 @@ files: | |
| 207 178 | 
             
            - lib/chef_fixie/version.rb
         | 
| 208 179 | 
             
            - spec/chef_fixie/acl_spec.rb
         | 
| 209 180 | 
             
            - spec/chef_fixie/assoc_invite_spec.rb
         | 
| 210 | 
            -
            - spec/chef_fixie/assoc_invite_spec.rb~
         | 
| 211 181 | 
             
            - spec/chef_fixie/check_org_associations_spec.rb
         | 
| 212 | 
            -
            - spec/chef_fixie/check_org_associations_spec.rb~
         | 
| 213 182 | 
             
            - spec/chef_fixie/groups_spec.rb
         | 
| 214 183 | 
             
            - spec/chef_fixie/org_spec.rb
         | 
| 215 | 
            -
            - spec/chef_fixie/org_spec.rb~
         | 
| 216 184 | 
             
            - spec/chef_fixie/orgs_spec.rb
         | 
| 217 185 | 
             
            - spec/spec_helper.rb
         | 
| 218 186 | 
             
            homepage: https://github.com/chef/fixie
         | 
| @@ -234,19 +202,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 234 202 | 
             
                - !ruby/object:Gem::Version
         | 
| 235 203 | 
             
                  version: '0'
         | 
| 236 204 | 
             
            requirements: []
         | 
| 237 | 
            -
             | 
| 238 | 
            -
            rubygems_version: 2.2.2
         | 
| 205 | 
            +
            rubygems_version: 3.1.4
         | 
| 239 206 | 
             
            signing_key: 
         | 
| 240 207 | 
             
            specification_version: 4
         | 
| 241 208 | 
             
            summary: Low level manipulation tool for Chef Server 12 and later
         | 
| 242 209 | 
             
            test_files:
         | 
| 243 210 | 
             
            - spec/chef_fixie/acl_spec.rb
         | 
| 244 211 | 
             
            - spec/chef_fixie/assoc_invite_spec.rb
         | 
| 245 | 
            -
            - spec/chef_fixie/assoc_invite_spec.rb~
         | 
| 246 212 | 
             
            - spec/chef_fixie/check_org_associations_spec.rb
         | 
| 247 | 
            -
            - spec/chef_fixie/check_org_associations_spec.rb~
         | 
| 248 213 | 
             
            - spec/chef_fixie/groups_spec.rb
         | 
| 249 214 | 
             
            - spec/chef_fixie/org_spec.rb
         | 
| 250 | 
            -
            - spec/chef_fixie/org_spec.rb~
         | 
| 251 215 | 
             
            - spec/chef_fixie/orgs_spec.rb
         | 
| 252 216 | 
             
            - spec/spec_helper.rb
         |