diego-treitos / ansible-inventory

Script to manage your Ansible Inventory and also can be used by ansible as a dynamic inventory source

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error adding host to groups

davidcodesido opened this issue · comments

When trying to add a host to a group it throws an exception and crashes:

Welcome to the Ansible Inventory console. Type 'help' for help.

¬¬ show hosts
-   info Here is your hosts list

 ╭╴esp-test [ ansible_host=X.X.X.X ]
 ╰──╴groups╶( all )


¬¬ show groups
-   info Here is your groups list

 ╭╴all [ ]
 ├──╴hosts╶( esp-test )
 ╰──╴child╶{ }

 ╭╴msp [ ]
 ├──╴hosts╶( )
 ╰──╴child╶{ }


¬¬ add host name=esp.* to_groups=msp.*
Traceback (most recent call last):
  File "./ansible-inventory", line 305, in wrapper
    r = f(s, *args, **kwargs)
  File "./ansible-inventory", line 469, in add_host_to_group
    raise InventoryInfoException('Host %s already in group %s', ( h_name, g_name ))
__main__.InventoryInfoException: Host %s already in group %s

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./ansible-inventory", line 682, in wrapper
    return f(s, args)
  File "./ansible-inventory", line 1142, in do_add
    self.inventory.add_host_to_group( h, group )
  File "./ansible-inventory", line 312, in wrapper
    raise InventoryException( e.__str__() )
__main__.InventoryException: Host %s already in group %s

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./ansible-inventory", line 1480, in <module>
    console.cmdloop()
  File "/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/cmd.py", line 138, in cmdloop
    stop = self.onecmd(line)
  File "/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/cmd.py", line 217, in onecmd
    return func(arg)
  File "./ansible-inventory", line 685, in wrapper
    s.__error( e.__str__() % targets )
TypeError: not enough arguments for format string

Thank you for reporting this!

It should be fixed now.