==> default: Error: Working directory '/home/vagrant/Sample_app_on_VM' does not exist
==> default: Error: /Stage[main]/Main/Exec[install gem]/returns: change from notrun to 0 failed: Working directory '/home/vagrant/Sample_app_on_VM' does not exist
- puppetは上から順番に実行していく訳ではなく、依存関係をつくってあげることで順番が決まる。その順番(依存関係)を上手く設定してあげるために
require
が必要なのであった。(有向グラフ) - 「require」パラメータは、そのリソースを作成するのに必要なリソースを指定するもの
(テストはGemfileに、入れたいgemの文字列があるかどうかのテストとなっています)
[vagrant@localhost Sample_app_on_VM]$ bundle exec rails s
bundler: command not found: rails
Install missing gem executables with `bundle install`
# 必要な Gem を bundle install する
exec { 'install gem':
user => "vagrant",
cwd => "/home/vagrant/Sample_app_on_VM",
environment => ['HOME=/home/vagrant'],
command => "bash -c 'source /home/vagrant/.bash_profile ; bundle install --without production --path vendor/bundle'",
creates => "/home/vagrant/Sample_app_on_VM/vendor/bundle",
}
- bundle install をする際に インストールする場所について、pathを指定していなかったことが原因
- puppet のatributes であるpath とは全然意味が違うので注意!
==> default: Error: Could not parse for environment production: Syntax error at 'require'; expected '}' at /tmp/vagrant-puppet-3/manifests/init.pp:109 on node localhost
==> default: Error: Could not parse for environment production: Syntax error at 'require'; expected '}' at /tmp/vagrant-puppet-3/manifests/init.pp:109 on node localhost
大体末尾に,
がついていないことが原因
vagrant up 時のyum install 時に必ず表示されるこの Warning はなんなんだろう?
==> default: Warning: RPMDB altered outside of yum.
RPMDBというDBがあって、そこにはrpmの依存関係や、yumの依存関係の情報がキャッシュされている。 そこで、rpmとyumの依存関係の整合性がとれなくなってしまい、Warning がでている。
shell script の先頭にyum history sync
を追加することで rpm/yum DB の再同期が行なわれるので解決できそう。
むむ!!まだWarningがでる!! yum clean all をしてみてもまだでる! vagrant で環境構築をする分には直接被害を被らないないので、この warning は今回は保留にすることに。
一応一通りPRが完成したのでWIPを外しました。 どうかお手すきの際にレビューをよろしくお願いします!
- 今はrequire で依存関係をつくるときにgitしか指定していないけど、rubyをインストールするときやbundle install するときに、他のパッケージも必要だったと思う。そのへんのパッケージは指定しなくていいのかな。
- .bash_profile はuserとか指定する必要あるのかな。