alces-software / metalware

Tools and conventions for improving bare metal machine management
Other
2 stars 0 forks source link

Couple of issues with using `instance_eval` in `metal view` #431

Closed bobwhitelock closed 6 years ago

bobwhitelock commented 6 years ago

Following the merging of https://github.com/alces-software/metalware/pull/430 there have been a few issues.

From Slack:

  1. Both of these used to show the full namespace for a node:

    [root@controller [asset-example] ~]# metal view node.node780
    error: Error, a Node is not in scope. Use --trace to view backtrace
    [root@controller [asset-example] ~]# metal view nodes.node780
    "#<Metalware::Namespaces::Node:0x0000000156a760, name: node780>"

    You can still get the same effect as the old behaviour with metal view nodes.node780.to_h.

    (from https://alces.slack.com/archives/C5FL99R89/p1529505996000158)

  2. Can no longer use metal view like this:

    [root@controller [asset-example] metalware]# metal view assets.servers.rack1-r630-chassis-780-server1
    error: undefined method `rack1' for #<Metalware::Namespaces::AssetArray:0x00000001631ce8>. Use --trace to view backtrace                                                                                                                      

    because this server name is not tokenized as a full method by Ruby. I can work around this like this atm, since the method with that name's still defined:

    [root@controller [asset-example] metalware]# metal view "assets.servers.public_send('rack1-r630-chassis-780-server1')"                                                                                                                        
    {
      "manufacturer": "Dell",
      "model": "r630-server-board",
    [ ... ]

    (from https://alces.slack.com/archives/C5FL99R89/p1529575880000307)

More discussion happened in Slack.