filterfish / smith2

A complete rewrite of Smith
12 stars 7 forks source link

Namespaced agents cause the wrong `lib` directory to be added to `$LOAD_PATH` #39

Closed mpalmer closed 9 years ago

mpalmer commented 9 years ago

When using namespaced agents, with the recommended directory tree structure, the directory to be added to the Ruby load path appears to be based on "the parent directory of where the agent file was found", not "the parent directory of the agent_path config parameter". This console session should show the problem:

$ grep agent_path ~/.smithrc
agent_path        /home/thoth/app/current/agents
$ find /home/thoth/app/current/agents -type f
/home/thoth/app/current/agents/thoth/agent/bundler.rb
/home/thoth/app/current/agents/thoth/agent/compactor.rb
/home/thoth/app/current/agents/thoth/agent/index_creator.rb
/home/thoth/app/current/agents/thoth/agent/index_writer.rb
$ smithctl start Thoth::Agent::Bundler
8665d149-c6b3-4908-9145-a4c256d7dcb2
$ smithctl list -la
$ allah log thoth-production-agency |grep 'to load path' | tail -n 1
2015-04-15 07:28:07.919630500 [10196]   DEBUG -              Smith::AgentBootstrap:135 - Adding /home/thoth/app/current/agents/thoth/lib to load path

That directory that's being added to the load path is the wrong one, being buried up under the agents directory, rather than being /home/thoth/app/current/lib like it should be.