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.
- checksums.yaml +5 -5
- data/bin/chef_fixie +1 -1
- data/doc/BulkFixup.md +1 -1
- data/doc/CommonTasks.md +14 -3
- data/lib/chef_fixie.rb +7 -7
- data/lib/chef_fixie/authz_mapper.rb +26 -28
- data/lib/chef_fixie/authz_objects.rb +44 -41
- data/lib/chef_fixie/bulk_edit_permissions.rb +24 -20
- data/lib/chef_fixie/check_org_associations.rb +56 -58
- data/lib/chef_fixie/config.rb +58 -24
- data/lib/chef_fixie/console.rb +15 -10
- data/lib/chef_fixie/context.rb +2 -4
- data/lib/chef_fixie/sql.rb +12 -12
- data/lib/chef_fixie/sql_objects.rb +49 -38
- 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 +18 -84
- 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
data/bin/bundler
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
#
|
3
|
-
# This file was generated by Bundler.
|
4
|
-
#
|
5
|
-
# The application 'bundler' is installed as part of a gem, and
|
6
|
-
# this file is here to facilitate running it.
|
7
|
-
#
|
8
|
-
|
9
|
-
require 'pathname'
|
10
|
-
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
-
Pathname.new(__FILE__).realpath)
|
12
|
-
|
13
|
-
require 'rubygems'
|
14
|
-
require 'bundler/setup'
|
15
|
-
|
16
|
-
load Gem.bin_path('bundler', 'bundler')
|
data/bin/chef-apply
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
#
|
3
|
-
# This file was generated by Bundler.
|
4
|
-
#
|
5
|
-
# The application 'chef-apply' is installed as part of a gem, and
|
6
|
-
# this file is here to facilitate running it.
|
7
|
-
#
|
8
|
-
|
9
|
-
require 'pathname'
|
10
|
-
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
-
Pathname.new(__FILE__).realpath)
|
12
|
-
|
13
|
-
require 'rubygems'
|
14
|
-
require 'bundler/setup'
|
15
|
-
|
16
|
-
load Gem.bin_path('chef', 'chef-apply')
|
data/bin/chef-client
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
#
|
3
|
-
# This file was generated by Bundler.
|
4
|
-
#
|
5
|
-
# The application 'chef-client' is installed as part of a gem, and
|
6
|
-
# this file is here to facilitate running it.
|
7
|
-
#
|
8
|
-
|
9
|
-
require 'pathname'
|
10
|
-
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
-
Pathname.new(__FILE__).realpath)
|
12
|
-
|
13
|
-
require 'rubygems'
|
14
|
-
require 'bundler/setup'
|
15
|
-
|
16
|
-
load Gem.bin_path('chef', 'chef-client')
|
data/bin/chef-shell
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
#
|
3
|
-
# This file was generated by Bundler.
|
4
|
-
#
|
5
|
-
# The application 'chef-shell' is installed as part of a gem, and
|
6
|
-
# this file is here to facilitate running it.
|
7
|
-
#
|
8
|
-
|
9
|
-
require 'pathname'
|
10
|
-
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
-
Pathname.new(__FILE__).realpath)
|
12
|
-
|
13
|
-
require 'rubygems'
|
14
|
-
require 'bundler/setup'
|
15
|
-
|
16
|
-
load Gem.bin_path('chef', 'chef-shell')
|
data/bin/chef-solo
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
#
|
3
|
-
# This file was generated by Bundler.
|
4
|
-
#
|
5
|
-
# The application 'chef-solo' is installed as part of a gem, and
|
6
|
-
# this file is here to facilitate running it.
|
7
|
-
#
|
8
|
-
|
9
|
-
require 'pathname'
|
10
|
-
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
-
Pathname.new(__FILE__).realpath)
|
12
|
-
|
13
|
-
require 'rubygems'
|
14
|
-
require 'bundler/setup'
|
15
|
-
|
16
|
-
load Gem.bin_path('chef', 'chef-solo')
|
data/bin/chef-zero
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
#
|
3
|
-
# This file was generated by Bundler.
|
4
|
-
#
|
5
|
-
# The application 'chef-zero' is installed as part of a gem, and
|
6
|
-
# this file is here to facilitate running it.
|
7
|
-
#
|
8
|
-
|
9
|
-
require 'pathname'
|
10
|
-
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
-
Pathname.new(__FILE__).realpath)
|
12
|
-
|
13
|
-
require 'rubygems'
|
14
|
-
require 'bundler/setup'
|
15
|
-
|
16
|
-
load Gem.bin_path('chef-zero', 'chef-zero')
|
data/bin/coderay
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
#
|
3
|
-
# This file was generated by Bundler.
|
4
|
-
#
|
5
|
-
# The application 'coderay' is installed as part of a gem, and
|
6
|
-
# this file is here to facilitate running it.
|
7
|
-
#
|
8
|
-
|
9
|
-
require 'pathname'
|
10
|
-
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
-
Pathname.new(__FILE__).realpath)
|
12
|
-
|
13
|
-
require 'rubygems'
|
14
|
-
require 'bundler/setup'
|
15
|
-
|
16
|
-
load Gem.bin_path('coderay', 'coderay')
|
data/bin/edit_json.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
#
|
3
|
-
# This file was generated by Bundler.
|
4
|
-
#
|
5
|
-
# The application 'edit_json.rb' is installed as part of a gem, and
|
6
|
-
# this file is here to facilitate running it.
|
7
|
-
#
|
8
|
-
|
9
|
-
require 'pathname'
|
10
|
-
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
-
Pathname.new(__FILE__).realpath)
|
12
|
-
|
13
|
-
require 'rubygems'
|
14
|
-
require 'bundler/setup'
|
15
|
-
|
16
|
-
load Gem.bin_path('json', 'edit_json.rb')
|
data/bin/erubis
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
#
|
3
|
-
# This file was generated by Bundler.
|
4
|
-
#
|
5
|
-
# The application 'erubis' is installed as part of a gem, and
|
6
|
-
# this file is here to facilitate running it.
|
7
|
-
#
|
8
|
-
|
9
|
-
require 'pathname'
|
10
|
-
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
-
Pathname.new(__FILE__).realpath)
|
12
|
-
|
13
|
-
require 'rubygems'
|
14
|
-
require 'bundler/setup'
|
15
|
-
|
16
|
-
load Gem.bin_path('erubis', 'erubis')
|
data/bin/ffi-yajl-bench
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
#
|
3
|
-
# This file was generated by Bundler.
|
4
|
-
#
|
5
|
-
# The application 'ffi-yajl-bench' is installed as part of a gem, and
|
6
|
-
# this file is here to facilitate running it.
|
7
|
-
#
|
8
|
-
|
9
|
-
require 'pathname'
|
10
|
-
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
-
Pathname.new(__FILE__).realpath)
|
12
|
-
|
13
|
-
require 'rubygems'
|
14
|
-
require 'bundler/setup'
|
15
|
-
|
16
|
-
load Gem.bin_path('ffi-yajl', 'ffi-yajl-bench')
|
data/bin/fixie~
DELETED
@@ -1,231 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "rubygems"
|
4
|
-
require "bundler/setup"
|
5
|
-
|
6
|
-
$:.unshift(File.dirname(__FILE__) + '/../lib/')
|
7
|
-
|
8
|
-
require 'optparse'
|
9
|
-
require 'irb'
|
10
|
-
require 'irb/init'
|
11
|
-
require 'irb/completion'
|
12
|
-
require 'irb/ext/history'
|
13
|
-
require 'pp'
|
14
|
-
require 'pry'
|
15
|
-
|
16
|
-
require 'fixie/config'
|
17
|
-
|
18
|
-
require 'fixie'
|
19
|
-
|
20
|
-
# IRB tries to overwrite our custom settings when it loads, so we have to hax0r
|
21
|
-
# it to work.
|
22
|
-
module IRB
|
23
|
-
class << self
|
24
|
-
alias :run_original_config :run_config
|
25
|
-
|
26
|
-
def run_config
|
27
|
-
run_original_config
|
28
|
-
::Fixie::Console.configure_irb
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
|
34
|
-
module Fixie
|
35
|
-
|
36
|
-
module Context
|
37
|
-
|
38
|
-
def describe_orgs
|
39
|
-
OrgMetrics.org_stats(orgs)
|
40
|
-
end
|
41
|
-
|
42
|
-
def orgs
|
43
|
-
Fixie::Organizations.new
|
44
|
-
end
|
45
|
-
|
46
|
-
def jobs
|
47
|
-
Fixie::Jobs.new
|
48
|
-
end
|
49
|
-
|
50
|
-
def users
|
51
|
-
Fixie::Users.new
|
52
|
-
end
|
53
|
-
|
54
|
-
def global_groups
|
55
|
-
Fixie::GlobalGroups.new
|
56
|
-
end
|
57
|
-
|
58
|
-
def help
|
59
|
-
puts(<<-HALP)
|
60
|
-
** ORGS **
|
61
|
-
* access with ORGS or ORGS
|
62
|
-
* access a specific org: ORGS['orgname']
|
63
|
-
|
64
|
-
** USERS **
|
65
|
-
* users.find('clownco-org-admin')
|
66
|
-
* users.grep :clownco
|
67
|
-
* users.usernames
|
68
|
-
|
69
|
-
** RAW SQL ACCESS**
|
70
|
-
* sql[:users].select(:column, :column).where(:column => "condition").all
|
71
|
-
|
72
|
-
** irb Help **
|
73
|
-
irb_help
|
74
|
-
|
75
|
-
HALP
|
76
|
-
:COOL_STORY_BRO
|
77
|
-
end
|
78
|
-
|
79
|
-
def sql
|
80
|
-
Opscode::Mappers.default_connection
|
81
|
-
end
|
82
|
-
|
83
|
-
def associate_user(username, orgname)
|
84
|
-
unless user = users.find(username)
|
85
|
-
raise ArgumentError, "No users matched '#{username}'"
|
86
|
-
end
|
87
|
-
unless org = ORGS[orgname]
|
88
|
-
raise ArgumentError, "No orgs matched '#{orgname}'"
|
89
|
-
end
|
90
|
-
|
91
|
-
Fixie::Associator.associate_user(org, user)
|
92
|
-
end
|
93
|
-
|
94
|
-
def dissociate_user(username, orgname)
|
95
|
-
unless user = users.find(username)
|
96
|
-
raise ArgumentError, "No users matched '#{username}'"
|
97
|
-
end
|
98
|
-
unless org = ORGS[orgname]
|
99
|
-
raise ArgumentError, "No orgs matched '#{orgname}'"
|
100
|
-
end
|
101
|
-
|
102
|
-
Fixie::Dissociator.dissociate_user(org, user)
|
103
|
-
end
|
104
|
-
|
105
|
-
end
|
106
|
-
|
107
|
-
module Console
|
108
|
-
extend self
|
109
|
-
|
110
|
-
def irb_conf
|
111
|
-
IRB.conf
|
112
|
-
end
|
113
|
-
|
114
|
-
def start
|
115
|
-
# FUGLY HACK: irb gives us no other choice.
|
116
|
-
irb_help = [:help, :irb_help, IRB::ExtendCommandBundle::NO_OVERRIDE]
|
117
|
-
IRB::ExtendCommandBundle.instance_variable_get(:@ALIASES).delete(irb_help)
|
118
|
-
|
119
|
-
# This has to come before IRB.setup b/c IRB.setup eats ARGV.
|
120
|
-
configure
|
121
|
-
|
122
|
-
# HACK: this duplicates the functions of IRB.start, but we have to do it
|
123
|
-
# to get access to the main object before irb starts.
|
124
|
-
::IRB.setup(nil)
|
125
|
-
|
126
|
-
irb = IRB::Irb.new
|
127
|
-
|
128
|
-
setup(irb.context.main)
|
129
|
-
|
130
|
-
|
131
|
-
irb_conf[:IRB_RC].call(irb.context) if irb_conf[:IRB_RC]
|
132
|
-
irb_conf[:MAIN_CONTEXT] = irb.context
|
133
|
-
|
134
|
-
trap("SIGINT") do
|
135
|
-
irb.signal_handle
|
136
|
-
end
|
137
|
-
|
138
|
-
catch(:IRB_EXIT) do
|
139
|
-
irb.eval_input
|
140
|
-
end
|
141
|
-
end
|
142
|
-
|
143
|
-
def configure
|
144
|
-
|
145
|
-
if ARGV.first && ARGV[0].chars.first != "-" && config_file = ARGV.shift
|
146
|
-
config_file = File.expand_path(config_file)
|
147
|
-
|
148
|
-
load_config_file = true
|
149
|
-
end
|
150
|
-
|
151
|
-
options = {}
|
152
|
-
OptionParser.new do |opt|
|
153
|
-
opt.banner = "Usage: orgmapper [config] [options]"
|
154
|
-
opt.on('--couchdb-uri COUCH_URI', 'The URI of the couchdb server to connect to') { |v| options[:couchdb_uri] = v }
|
155
|
-
opt.on("--database ACCOUNT_DATABASE", 'The name of the opscode account database') { |v| options[:database] = v }
|
156
|
-
opt.on('--auth-uri AUTH_URI', "The URI of the opscode authz service") { |v| options[:auth_uri] =v }
|
157
|
-
opt.on_tail('-h', '--help', 'Show this message') do
|
158
|
-
puts opt
|
159
|
-
puts "\nExample configuration file:\n\n"
|
160
|
-
puts Fixie::Config.instance.example_config
|
161
|
-
puts "\n"
|
162
|
-
exit(1)
|
163
|
-
end
|
164
|
-
opt.parse!(ARGV)
|
165
|
-
end
|
166
|
-
pp :cli_opts => options if ENV["DEBUG"]
|
167
|
-
|
168
|
-
if load_config_file
|
169
|
-
puts "loading config: #{config_file}..."
|
170
|
-
Kernel.load(config_file)
|
171
|
-
end
|
172
|
-
|
173
|
-
Fixie::Config.instance.merge_opts(options)
|
174
|
-
puts Fixie::Config.instance.to_text
|
175
|
-
end
|
176
|
-
|
177
|
-
def setup(context)
|
178
|
-
Object.send(:include, Mixlib::Authorization::AuthHelper)
|
179
|
-
Object.const_set(:PLATFORM_BACKEND, Fixie::Backend.new(*Config.instance.to_ary))
|
180
|
-
Object.const_set(:ORGS, Fixie::Organizations.new)
|
181
|
-
Object.const_set(:JOBS, Fixie::Jobs.new)
|
182
|
-
Object.const_set(:USERS, Fixie::Users.new)
|
183
|
-
Object.const_set(:GLOBAL_GROUPS, Fixie::GlobalGroups.new)
|
184
|
-
|
185
|
-
context.extend(Context)
|
186
|
-
|
187
|
-
end
|
188
|
-
|
189
|
-
# Configure IRB how we like it. This needs to be hooked into IRB.run_config
|
190
|
-
Object.send(:include, Mixlib::Authorization::AuthHelper)
|
191
|
-
Object.const_set(:PLATFORM_BACKEND, Fixie::Backend.new(*Config.instance.to_ary))
|
192
|
-
Object.const_set(:ORGS, Fixie::Organizations.new)
|
193
|
-
Object.const_set(:JOBS, Fixie::Jobs.new)
|
194
|
-
Object.const_set(:USERS, Fixie::Users.new)
|
195
|
-
Object.const_set(:GLOBAL_GROUPS, Fixie::GlobalGroups.new)
|
196
|
-
|
197
|
-
context.extend(Context)
|
198
|
-
|
199
|
-
end
|
200
|
-
|
201
|
-
# Configure IRB how we like it. This needs to be hooked into IRB.run_config
|
202
|
-
# because much of IRB's code is anachronistic
|
203
|
-
def configure_irb
|
204
|
-
IRB.init_config(__FILE__)
|
205
|
-
|
206
|
-
IRB.conf[:HISTORY_FILE] = "~/.orgmapper_history"
|
207
|
-
IRB.conf[:SAVE_HISTORY]=1000
|
208
|
-
IRB.conf[:USE_READLINE]=true
|
209
|
-
IRB.conf[:PROMPT][:ORGMAPPER] = { # name of prompt mode
|
210
|
-
:PROMPT_I => "orgmapper:%i > ", # normal prompt
|
211
|
-
:PROMPT_S => "..%l ", # prompt for continuing strings
|
212
|
-
:PROMPT_C => "... ", # prompt for continuing statement
|
213
|
-
:RETURN => "%s\n" # format to return value
|
214
|
-
}
|
215
|
-
|
216
|
-
IRB.conf[:PROMPT_MODE] = :ORGMAPPER
|
217
|
-
|
218
|
-
begin
|
219
|
-
require 'wirble'
|
220
|
-
Wirble.init
|
221
|
-
Wirble.colorize
|
222
|
-
rescue LoadError
|
223
|
-
end
|
224
|
-
|
225
|
-
end
|
226
|
-
|
227
|
-
end
|
228
|
-
end
|
229
|
-
|
230
|
-
Fixie::Console.start
|
231
|
-
|
data/bin/htmldiff
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
#
|
3
|
-
# This file was generated by Bundler.
|
4
|
-
#
|
5
|
-
# The application 'htmldiff' is installed as part of a gem, and
|
6
|
-
# this file is here to facilitate running it.
|
7
|
-
#
|
8
|
-
|
9
|
-
require 'pathname'
|
10
|
-
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
-
Pathname.new(__FILE__).realpath)
|
12
|
-
|
13
|
-
require 'rubygems'
|
14
|
-
require 'bundler/setup'
|
15
|
-
|
16
|
-
load Gem.bin_path('diff-lcs', 'htmldiff')
|
data/bin/knife
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
#
|
3
|
-
# This file was generated by Bundler.
|
4
|
-
#
|
5
|
-
# The application 'knife' is installed as part of a gem, and
|
6
|
-
# this file is here to facilitate running it.
|
7
|
-
#
|
8
|
-
|
9
|
-
require 'pathname'
|
10
|
-
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
-
Pathname.new(__FILE__).realpath)
|
12
|
-
|
13
|
-
require 'rubygems'
|
14
|
-
require 'bundler/setup'
|
15
|
-
|
16
|
-
load Gem.bin_path('chef', 'knife')
|