foreman_column_view icon indicating copy to clipboard operation
foreman_column_view copied to clipboard

Failure: undefined method `drop' for :bmc_available?:Symbol

Open matt-cahill opened this issue 7 years ago • 4 comments

Trying to set up a button in the host view that only appears for Mac machines, however whatever condition statement I try I get the same error.

Failure: undefined method `drop' for :bmc_available?:Symbol

  :ssh_to:
    :title: Remote Control
    :after: 2
    :content: link_to(_("SSH"), "ssh://admin@#{host.facts_hash['ipaddress']}", { :class => "btn btn-info" } )
    :conditional: :bmc_available?
    :eval_content: true
    :view: :hosts_properties

Foreman 1.15.3

Also any help on what my conditional should look like would be greatly appreciated.

:conditional: :facts_hash['kernel'] = Darwin

Many thanks

Matt

matt-cahill avatar Sep 20 '17 22:09 matt-cahill

I assume it's this method call:

https://github.com/GregSutcliffe/foreman_column_view/blob/706a2e06b5b261ff1328acbfc92406b47ebed811/app/helpers/foreman_column_view/hosts_helper_extension.rb#L18

has drop been replaced by something else?

matt-cahill avatar Sep 25 '17 01:09 matt-cahill

Hey, sorry for the delay.

drop only operates on an array, which is what it's expecting (as you can see for the line above where it calls conditional[0]). I'm surprised the default doesn't work though - can you try it as an array? eg

:ssh_to:
  :conditional:
    - :bmc_available?

GregSutcliffe avatar Sep 26 '17 11:09 GregSutcliffe

I appear to be running into the same issue. Placing the conditional into an array didn't fix anything. Would you be able to provide documentation for how to specify the conditional?

danquack avatar Jul 16 '18 19:07 danquack

On my end, the array syntax worked (but I got the same error when not using the array syntax). Here's my full snippet:

  :console:
    :title: IPMI Console
    :after: 0
    :content: link_to(_("Console"), "https://#{host.interfaces.first.name}", { :class => "btn btn-info" } )
    :conditional:
      - :bmc_available?
    :eval_content: true
    :view: :hosts_properties

Hope that helps!

olifre avatar Feb 04 '20 20:02 olifre