Skip to content

Commit

Permalink
add setup command
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinAzoff committed Apr 17, 2009
1 parent 9e3566d commit 91f1906
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
5 changes: 3 additions & 2 deletions README.rst
Expand Up @@ -8,8 +8,9 @@ troubleshooting difficult. If you find yourself asking yourself "Is the host
I'm trying to troubleshoot offline, or is it not normally pingable in the first
place?" then pinginventory can help ::

$ pinginventory take_inventory site.ini
$ pinginventory show_ip site.ini 1.2.3.4
$ pinginventory site.ini setup
$ pinginventory site.ini take_inventory
$ pinginventory site.ini show_ip 1.2.3.4
04/16/09 15:44:24 False
04/16/09 16:10:30 False
04/16/09 16:16:11 False
Expand Down
3 changes: 3 additions & 0 deletions pinginventory/__init__.py
Expand Up @@ -13,6 +13,9 @@ def __init__(self, inifile):
model.init_model(model.sa.create_engine(uri))
self.networks = c.get("scan", "networks").split(";")

def create_tables(self):
model.metadata.create_all()

def list(self):
return model.Inventory.list()

Expand Down
4 changes: 4 additions & 0 deletions pinginventory/commands.py
@@ -1,5 +1,9 @@
from pinginventory import PingInventory
import sys

def setup(p):
p.create_tables()

def take_inventory(p):
i = p.take_inventory()
print "Inventory ran for %s found %d hosts" % (i.endtime - i.starttime, i.numup)
Expand Down

0 comments on commit 91f1906

Please sign in to comment.