8
こんにちは私はwcsユーザー(webadmin)を使用してcreate instanceコマンドを実行しなければならないWCSインスタンスを作成しています。必要なenv変数を取得できません。シェフが特定のユーザーと実行してその環境の値をロードする方法
ので私は私が
WebAdminのユーザーを取得していますwhoamiをするために以下のコード
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
を使用しています
をチェックするためにいくつかのサンプルコードを置きます
しかし、env私はgeですユーザー "root"のenvを照合し、env変数のための.bash_profileを提供しません。任意のアイデア
が動作しようとしましたが、設定するにはかなりの環境変数があるので、bashリソースでコマンドを実行している間に設定するのは非常に面倒です。 – Saurav
私は何か間違っているようですが、Pauloが提案した解決策は正しいです、私はソースを.bash_profile(今回は正しく)していて、うまくいきました。ありがとうございました – Saurav
@ Sauravあなたはあなたが.bash_profileを適切に供給したと言いました。どうやって教えてくれますか?でも私はbash_profileを調達することに問題があります。 –