knife-hadoop 0.0.4 → 0.0.5
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.
- data/README.md +5 -2
- data/knife-hadoop.gemspec +2 -1
- data/lib/chef/knife/hadoop_base.rb +21 -5
- data/lib/knife-hadoop/version.rb +1 -1
- metadata +3 -3
data/README.md
CHANGED
@@ -3,7 +3,7 @@ Knife Hadoop
|
|
3
3
|
|
4
4
|
This is a Chef Knife plugin for Hadoop. This plugin gives knife the ability to provision, list, and manage Hadoop for Operators.
|
5
5
|
|
6
|
-
Version 0.0.
|
6
|
+
Version 0.0.5
|
7
7
|
|
8
8
|
Features:
|
9
9
|
|
@@ -11,7 +11,7 @@ HDFS APIs (currently supported) using the ruby webhdfs gem: https://github.com/k
|
|
11
11
|
https://github.com/murraju/webhdfs
|
12
12
|
|
13
13
|
a. List Directories and Files
|
14
|
-
b. Snapshot metadata information to a database (
|
14
|
+
b. Snapshot metadata information to a database (SQLlite default, PostgreSQL). Useful for reporting and audits
|
15
15
|
c. Create Directories and Files
|
16
16
|
d. Update Files
|
17
17
|
e. Read Files
|
@@ -29,6 +29,7 @@ Issues:
|
|
29
29
|
|
30
30
|
|
31
31
|
|
32
|
+
|
32
33
|
# Installation #
|
33
34
|
|
34
35
|
Be sure you are running the latest version Chef. Versions earlier than 0.10.0 don't support plugins:
|
@@ -50,6 +51,7 @@ In order to communicate with Hadoop and other APIs, you will have to set paramet
|
|
50
51
|
knife[:namenode_username] = "namenode_username"
|
51
52
|
knife[:mapred_mgmt_host] = "mapred_mgmt_host"
|
52
53
|
knife[:mapred_mgmt_port] = "mapred_mgmt_port"
|
54
|
+
knife[:db_type] = "db_type"
|
53
55
|
knife[:db_username] = "dbusername"
|
54
56
|
knife[:db_password] = "dbpassword"
|
55
57
|
knife[:db_host] = "dbhost"
|
@@ -62,6 +64,7 @@ If your knife.rb file will be checked into a SCM system (ie readable by others)
|
|
62
64
|
knife[:namenode_username] = "#{ENV['NAMENODE_USERNAME']}"
|
63
65
|
knife[:mapred_mgmt_host] = "#{ENV['MAPRED_MGMT_HOST']}"
|
64
66
|
knife[:mapred_mgmt_port] = "#{ENV['MAPRED_MGMT_PORT']}"
|
67
|
+
knife[:db_type] = "#{ENV['DB_TYPE']}"
|
65
68
|
knife[:db_username] = "#{ENV['DB_USERNAME']}"
|
66
69
|
knife[:db_password] = "#{ENV['DB_PASSWORD']}"
|
67
70
|
knife[:db_host] = "#{ENV['DB_HOST']}"
|
data/knife-hadoop.gemspec
CHANGED
@@ -20,7 +20,8 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.require_paths = ["lib"]
|
21
21
|
|
22
22
|
s.add_dependency "webhdfs"
|
23
|
-
s.add_dependency "pg"
|
23
|
+
#s.add_dependency "pg"
|
24
|
+
s.add_dependency "sqlite3"
|
24
25
|
s.add_dependency "sequel"
|
25
26
|
s.add_dependency "debugger"
|
26
27
|
s.add_dependency "rest-client"
|
@@ -58,6 +58,12 @@ class Chef
|
|
58
58
|
:description => "NameNode port",
|
59
59
|
:proc => Proc.new { |key| Chef::Config[:knife][:namenode_port] = key }
|
60
60
|
|
61
|
+
option :db_type,
|
62
|
+
:short => "-T DATABASETYPE",
|
63
|
+
:long => "--database-type DATABASETYPE",
|
64
|
+
:description => "PostgreSQL or Sqlite Database to use for Hadoop Management Data",
|
65
|
+
:proc => Proc.new { |key| Chef::Config[:knife][:db] = key }
|
66
|
+
|
61
67
|
option :db,
|
62
68
|
:short => "-D DATABASE",
|
63
69
|
:long => "--database DATABASE",
|
@@ -98,15 +104,25 @@ class Chef
|
|
98
104
|
end
|
99
105
|
|
100
106
|
def db_connection
|
107
|
+
Chef::Log.debug("db_type: #{Chef::Config[:knife][:db_type]}")
|
101
108
|
Chef::Log.debug("db: #{Chef::Config[:knife][:db]}")
|
102
109
|
Chef::Log.debug("db_username: #{Chef::Config[:knife][:db_username]}")
|
103
110
|
Chef::Log.debug("db_password: #{Chef::Config[:knife][:db_password]}")
|
104
111
|
Chef::Log.debug("db_host: #{Chef::Config[:knife][:db_host]}")
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
112
|
+
db_type = "#{Chef::Config[:knife][:db_type]}".downcase
|
113
|
+
case db_type
|
114
|
+
when 'postgres'
|
115
|
+
@db_connection ||= begin
|
116
|
+
db_connection = Sequel.connect("postgres://#{Chef::Config[:knife][:db_username]}"+':'+
|
117
|
+
"#{Chef::Config[:knife][:db_password]}"+'@'+
|
118
|
+
"#{Chef::Config[:knife][:db_host]}"+'/'+
|
119
|
+
"#{Chef::Config[:knife][:db]}")
|
120
|
+
end
|
121
|
+
when 'sqlite'
|
122
|
+
@db_connection ||= begin
|
123
|
+
db_dir = Dir.mkdir(File.expand_path "~/.db/")
|
124
|
+
db_connection = Sequel.sqlite("#{db_dir}/" + "#{Chef::Config[:knife][:db]}")
|
125
|
+
end
|
110
126
|
end
|
111
127
|
end
|
112
128
|
|
data/lib/knife-hadoop/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knife-hadoop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-02-
|
12
|
+
date: 2013-02-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: webhdfs
|
@@ -28,7 +28,7 @@ dependencies:
|
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '0'
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
|
-
name:
|
31
|
+
name: sqlite3
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
33
33
|
none: false
|
34
34
|
requirements:
|