I am on 1.11.0 I ended up taking the client side method, as that was the easiest for me to accomplish.
Thanks On Sunday, July 10, 2016 at 1:44:43 AM UTC-7, [email protected] wrote: > > > Hi, > First I want to make sure what version of foreman do you have and are you > using Katello plugin? Especially do you have the "inherit" button on the > environment field. > If you do - you have two choices: one would be to set the environment > field in the server side ( create a filter method and add it to > HostsController class) you can see an example here > <https://github.com/theforeman/foreman/blob/develop/app/controllers/hosts_controller.rb#L24> > . > Second choice would be to do it on client side - you can mimic the way the > property is marked when it's set by the server: You can add "data-explicit" > attribute to the field. > > You can find the JS that manipulates this field here > <https://github.com/theforeman/foreman/blob/develop/app/assets/javascripts/application.js#L573> > . > > > On Saturday, July 9, 2016 at 11:56:13 PM UTC+3, Matthew Ceroni wrote: >> >> Is there a way to prevent the host from inheriting a host group value if >> it is not set? >> >> I have written a small plugin that sets the environment based on the >> hostname. However, if I then select the hostgroup it resets that >> environment to blank because the hostgroup doesn't have a value. >> >> I have tried everything via javascript to get around this. I set an >> onsubmit function to set the environment (again based on hostname) but this >> onsbumit function gets over-ridden (I think) when the hostgroup is >> selected. >> >> >> -- 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.
