您好我正在创建一个 WCS 实例,为此我必须使用 wcs 用户(webadmin)执行创建实例命令,它无法连接到数据库,因为它无法获取所需的环境变量。
所以我放了一些示例代码来检查
我正在使用下面的代码
bash "wcs-create-instance" do
user "webadmin"
group "webspher"
code <<-EOH
###{node[:websphere][:wcs][:wcs_installLocation]}/bin/config_ant.sh -DinstanceName=#{node[:websphere][:wcs][:wcs_instance]} CreateInstance
whoami > /tmp/whoami
env > /tmp/env
EOH
notifies :run, "bash[fix-permission]", :immediately
#This not_if is just temporary, a proper mechanism has to be implemented here to loop through all the WCS APars,
#For the POC keeping it neat and simple such that this does not rerun on execution
not_if {File.directory?("#{node[:websphere][:wcs][:wcs_installLocation]}/instances/#{node[:websphere][:wcs][:wcs_instance]}/starterstores")}
#action :nothing
end
对于whoami,我正在获取用户
网络管理员
但是对于环境,我得到了用户“root”的环境,它没有为环境变量采购 .bash_profile。有任何想法吗