Hi, I was hitting this issue recently in the rex plugin, I needed to change the way the param is whitelisted, from using an array, to pass it via a block like this:
https://github.com/theforeman/foreman_remote_execution/pull/276 Also, make sure you're testing it with the version of Foreman that has this patch https://github.com/theforeman/foreman/pull/4886, as it needs it to work properly. -- Ivan On Thu, Oct 12, 2017 at 7:24 PM, jbm <[email protected]> wrote: > Hi, > > I'm currently working on a Foreman plugin to use IBM PowerVM instances as > compute resources, and have run into the following problem when implementing > the network interface form: > > Following the guide at [1], I put my additional network parameters in > `foreman_powervm/app/views/compute_resources_vms/form/foreman_powervm/_network.html.erb', > like this: > > <%= number_f f, :my_param > :label => _("Foo") %> > > I now expected :my_param to be available in > ForemanPowerVM::PowerVM#create_vm (which is my subclass of ComputeResource), > in the form of args['interfaces_attributes'][i]['my_param'], but it is not > there (even though the foreman log shows that my_param was in fact recieved > as a POST parameter). > > So, as described in [2], I added > > parameter_filter Nic::Interface, compute_attributes: [:my_param] > > to the Plugin.register block in my Engine class, but to no avail. > > > After a bit of digging around in the foreman code I managed to "fix" this by > adding :my_param to the :compute_attributes entry in > Foreman::Controller::Parameters::NicBase#add_nic_base_params_filter (file > `foreman_app/controllers/concerns/foreman/controller/parameters/nic_base.rb:27'). > > > How do I keep my parameter from being filtered without altering foreman > code? What is the correct way to register parameters, as parameter_filter > doesnt seem to work? > > > Thanks for reading and hopefully your help! > > > [1]: > http://projects.theforeman.org/projects/foreman/wiki/How_to_Create_a_Plugin#Required-views > [2]: http://projects.theforeman.org/projects/foreman/wiki/Strong_parameters > > -- > jbm > > -- > You received this message because you are subscribed to the Google Groups > "foreman-dev" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "foreman-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
