Skip to content
Browse files

update pallet version.

  • Loading branch information...
1 parent ed218fc commit 9db1dcfb026a9889d6dc9ceb55fd74834c7860d2 @sundbp sundbp committed Mar 21, 2013
Showing with 23 additions and 22 deletions.
  1. +6 −10 project.clj
  2. +17 −12 src/iptables_crate/iptables.clj
View
16 project.clj
@@ -5,18 +5,14 @@
:url "http://boardintelligence.mit-license.org"}
:dependencies [[org.clojure/clojure "1.4.0"]
- [org.cloudhoist/pallet "0.8.0-alpha.8"]
+ [com.palletops/pallet "0.8.0-beta.5"]
[ch.qos.logback/logback-classic "1.0.7"]]
- :dev-dependencies [[org.cloudhoist/pallet "0.8.0-alpha.8" :type "test-jar"]
- [org.cloudhoist/pallet-lein "0.5.2"]]
+ :dev-dependencies [[com.palletops/pallet "0.8.0-beta.5" :type "test-jar"]
+ [com.palletops/pallet-lein "0.6.0-beta.7"]]
:profiles {:dev
- {:dependencies [[org.cloudhoist/pallet "0.8.0-alpha.8" :classifier "tests"]]
- :plugins [[org.cloudhoist/pallet-lein "0.5.2"]]}}
+ {:dependencies [[com.palletops/pallet "0.8.0-beta.5" :classifier "tests"]]
+ :plugins [[com.palletops/pallet-lein "0.6.0-beta.7"]]}}
- :local-repo-classpath true
-
- :repositories
- {"sonatype-snapshots" "https://oss.sonatype.org/content/repositories/snapshots"
- "sonatype" "https://oss.sonatype.org/content/repositories/releases/"})
+ :local-repo-classpath true)
View
29 src/iptables_crate/iptables.clj
@@ -1,5 +1,10 @@
(ns iptables-crate.iptables
- "Crate with functions for setting up and configuring iptables firewalls")
+ "Crate with functions for setting up and configuring iptables firewalls"
+ (:require [pallet.actions :as actions]
+ [pallet.crate :as crate]
+ [pallet.environment :as env]
+ [pallet.utils :as utils]
+ [pallet.crate :refer [defplan]]))
(def empty-ruleset
{:mangle {:prerouting []
@@ -150,13 +155,13 @@
:mode "0644")
(actions/exec-checked-script
"Update symlink to rules and restart firewall"
- (rm -f "/etc/init.d/iptables-crate")
- (ln -s "/etc/init.d/iptables-crate-firewall-rules" "/etc/init.d/iptables-crate")
- (if-not (= @(pipe (status iptables-crate)
- (grep running)) "")
- (stop iptables-crate))
- (start iptables-crate)
- (service rsyslog restart))))
+ ("rm -f /etc/init.d/iptables-crate")
+ ("ln -s /etc/init.d/iptables-crate-firewall-rules" "/etc/init.d/iptables-crate")
+ (if-not (= @(pipe ("status iptables-crate")
+ ("grep running")) "")
+ ("stop iptables-crate"))
+ ("start iptables-crate")
+ ("service rsyslog restart"))))
(defplan flush-iptables-rules
"Turn off all iptables rules (temporarily or persistently)."
@@ -173,7 +178,7 @@
(if persist
(actions/exec-checked-script
"Remove symlink to rules to disable them"
- (rm -f "/etc/init.d/iptables-crate")))))
+ ("rm -f /etc/init.d/iptables-crate")))))
(defn- set-sysctl-values
[variables value]
@@ -183,9 +188,9 @@
(actions/sed "/etc/sysctl.conf" {(format "%s\\s*=.*" variable) set-expression})
(actions/exec-checked-script
"Add to sysctl if setting not present, enact in current session"
- (if (= @(grep ~start-of-line "/etc/sysctl.conf") "")
- (echo ~set-expression " >> /etc/sysctl.conf"))
- (sysctl -w ~set-expression)))))
+ (if (= @("grep" ~start-of-line "/etc/sysctl.conf") "")
+ ("echo" ~set-expression " >> /etc/sysctl.conf"))
+ ("sysctl" -w ~set-expression)))))
(defplan install-sysctl-config
"Make sure sysctl knobs are tuned as we wish."

0 comments on commit 9db1dcf

Please sign in to comment.
Something went wrong with that request. Please try again.