dmulyalin / salt-nornir

SALTSTACK Nornir based proxy minion, execution, state and runner modules
MIT License
27 stars 3 forks source link

How to get failed status while running commands #6

Closed abhi1693 closed 2 years ago

abhi1693 commented 2 years ago

I have been trying to figure out if there is a way to know whether the result I received is a success or false, but it's not evident from the response. Am I missing anything with the configuration? I have only done the configuration exactly as per the getting started guide

{
  "return":[
    {
      "home":{
        "home-csr1":{
          "nornir_salt.plugins.tasks.netmiko_send_commands":"nornir_salt:RetryRunner home-csr1 - connection netmiko, retry attempt 3, error: 'TCP connection to device failed.\n\nCommon causes of this problem are:\n1. Incorrect hostname or IP address.\n2. Wrong TCP port.\n3. Intermediate firewall blocking access.\n\nDevice settings: cisco_xe 172.16.14.54:22\n\n'"
        }
      }
    }
  ]
}
dmulyalin commented 2 years ago

You can manipulate results structure using to_dict arguments https://salt-nornir.readthedocs.io/en/latest/Nornir%20Execution%20Module.html#to-dict, e.g. set add_details=True will give you the status of command execution

abhi1693 commented 2 years ago

This worked as expected, thanks.