Add netutils charm layer
Signed-off-by: Adam Israel <adam.israel@canonical.com>
diff --git a/layers/netutils/actions/nmap b/layers/netutils/actions/nmap
new file mode 100755
index 0000000..ede4f5b
--- /dev/null
+++ b/layers/netutils/actions/nmap
@@ -0,0 +1,18 @@
+#!/usr/bin/env python3
+import sys
+sys.path.append('lib')
+
+from charms.reactive import main
+from charms.reactive import set_state
+from charmhelpers.core.hookenv import action_fail
+
+"""
+`set_state` only works here because it's flushed to disk inside the `main()`
+loop. remove_state will need to be called inside the action method.
+"""
+set_state('actions.nmap')
+
+try:
+ main()
+except Exception as e:
+ action_fail(repr(e))
diff --git a/layers/netutils/actions/ping b/layers/netutils/actions/ping
new file mode 100755
index 0000000..9850fe7
--- /dev/null
+++ b/layers/netutils/actions/ping
@@ -0,0 +1,18 @@
+#!/usr/bin/env python3
+import sys
+sys.path.append('lib')
+
+from charms.reactive import main
+from charms.reactive import set_state
+from charmhelpers.core.hookenv import action_fail
+
+"""
+`set_state` only works here because it's flushed to disk inside the `main()`
+loop. remove_state will need to be called inside the action method.
+"""
+set_state('actions.ping')
+
+try:
+ main()
+except Exception as e:
+ action_fail(repr(e))
diff --git a/layers/netutils/actions/traceroute b/layers/netutils/actions/traceroute
new file mode 100755
index 0000000..229ed32
--- /dev/null
+++ b/layers/netutils/actions/traceroute
@@ -0,0 +1,18 @@
+#!/usr/bin/env python3
+import sys
+sys.path.append('lib')
+
+from charms.reactive import main
+from charms.reactive import set_state
+from charmhelpers.core.hookenv import action_fail
+
+"""
+`set_state` only works here because it's flushed to disk inside the `main()`
+loop. remove_state will need to be called inside the action method.
+"""
+set_state('actions.traceroute')
+
+try:
+ main()
+except Exception as e:
+ action_fail(repr(e))