Skip to content
This repository has been archived by the owner on Mar 5, 2024. It is now read-only.

Commit

Permalink
Add DB2 support
Browse files Browse the repository at this point in the history
add create DB2 database/user and get DB2 sql_connection logic

Change-Id: I17bc8add8c2558429b1675458e53e2e16b1950ac
Implements: blueprint db2-support
  • Loading branch information
chenzhiwei committed Dec 21, 2013
1 parent 4ddbe49 commit 5052e72
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
14 changes: 14 additions & 0 deletions libraries/database.rb
Expand Up @@ -59,6 +59,20 @@ def db_create_with_user service, user, pass
else
super_password = node['mysql']['server_root_password']
end
when "db2"
db2_database "create database" do
db_name db_name
action :create
end

db2_user "create database user" do
db_user user
db_pass pass
db_name db_name
action :create
end

return info
else
::Chef::Log.error("Unsupported database type #{type}")
end
Expand Down
2 changes: 2 additions & 0 deletions libraries/endpoints.rb
Expand Up @@ -76,6 +76,8 @@ def db_uri service, user, pass
# example: info['path'] = '/path/to/foo.db' -- will return sqlite:////foo.db
path = info['path']
result = "sqlite:///#{path}"
when "db2"
result = "ibm_db_sa://#{user}:#{pass}@#{host}:#{port}/#{name}"
end
end
end
Expand Down

0 comments on commit 5052e72

Please sign in to comment.