Copied from the Foreman Users group as per a suggestion I got.
On a fresh VM install of Ubuntu 14.04 and a fresh install of foreman 1.8
(dev environment), when I run the commands from 'How to create a foreman
plugin' I get this error after the 'bundle install' and subsequent
'service apache2 restart'.
some permissions were not found (ArgumentError)
/usr/share/foreman/app/models/role.rb:131:in add_permissions' /usr/share/foreman/app/models/role.rb:146:in
add_permissions!'
/usr/share/foreman/app/services/foreman/plugin.rb:198:in `block in role'
/usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in
`transaction'
/usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.2.21/lib/active_record/transactions.rb:208:in
transaction' /usr/share/foreman/app/services/foreman/plugin.rb:196:in
role'
/home/emanners/git/my_plugin/lib/my_plugin/engine.rb:27:in block (2 levels) in <class:Engine>' /usr/share/foreman/app/services/foreman/plugin.rb:62:in
instance_eval'
/usr/share/foreman/app/services/foreman/plugin.rb:62:in register' /home/emanners/git/my_plugin/lib/my_plugin/engine.rb:18:in
block in
<class:Engine>'
/usr/share/foreman/vendor/ruby/1.9.1/gems/railties-3.2.21/lib/rails/initializable.rb:30:in
`instance_exec'
/usr/share/foreman/vendor/ruby/1.9.1/gems/railties-3.2.21/lib/rails/initializable.rb:30:in
`run'
/usr/share/foreman/vendor/ruby/1.9.1/gems/railties-3.2.21/lib/rails/initializable.rb:55:in
`block in run_initializers'
/usr/share/foreman/vendor/ruby/1.9.1/gems/railties-3.2.21/lib/rails/initializable.rb:54:in
`each'
/usr/share/foreman/vendor/ruby/1.9.1/gems/railties-3.2.21/lib/rails/initializable.rb:54:in
`run_initializers'
/usr/share/foreman/vendor/ruby/1.9.1/gems/railties-3.2.21/lib/rails/application.rb:136:in
`initialize!'
/usr/share/foreman/vendor/ruby/1.9.1/gems/railties-3.2.21/lib/rails/railtie/configurable.rb:30:in
method_missing' /usr/share/foreman/config/environment.rb:12:in
<top (required)>'
config.ru:3:in require' config.ru:3:in
block in <main>'
/usr/share/foreman/vendor/ruby/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:51:in
`instance_eval'
/usr/share/foreman/vendor/ruby/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:51:in
initialize' config.ru:1:in
new'
config.ru:1:in <main>' /usr/share/passenger/helper-scripts/rack-preloader.rb:112:in
eval'
/usr/share/passenger/helper-scripts/rack-preloader.rb:112:in preload_app' /usr/share/passenger/helper-scripts/rack-preloader.rb:158:in
<module:App>'
/usr/share/passenger/helper-scripts/rack-preloader.rb:29:in
<module:PhusionPassenger>' /usr/share/passenger/helper-scripts/rack-preloader.rb:28:in
<main>'
The reply that I got was:
You'll probably have to customzie the engine.rb. If it's just the
default after running rename.rb you probably have a line like this on
27:
role "ForemanMyPlugin", [:view_my_plugin]
The error is telling you that :view_my_plugin permission doesn't exist,
which should've been created just a few lines above. That might help
narrow down the problem, but we'd really have to see the code to help
more.
The engine file is attached. It looks like those permissions were created
but I'm new to Ruby so …
engine.rb (2.71 KB)