summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Gemfile.lock2
-rw-r--r--README.md4
-rw-r--r--lib/oxidized/cli.rb2
-rw-r--r--lib/oxidized/source/http.rb3
4 files changed, 8 insertions, 3 deletions
diff --git a/Gemfile.lock b/Gemfile.lock
index b46ca2f..f60b12f 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
- oxidized (0.9.0)
+ oxidized (0.10.0)
asetus (~> 0.1)
net-ssh (~> 3.0, >= 3.0.2)
rugged (~> 0.21, >= 0.21.4)
diff --git a/README.md b/README.md
index 07d52eb..e4c02e8 100644
--- a/README.md
+++ b/README.md
@@ -296,6 +296,8 @@ source:
One object per device.
+HTTP Supports basic auth, configure the user and pass you want to use under the http: section.
+
```
source:
default: http
@@ -457,7 +459,7 @@ Following configuration keys need to be defined for all hooks:
### Events
* `node_success`: triggered when configuration is succesfully pulled from a node and right before storing the configuration.
* `node_fail`: triggered after `retries` amount of failed node pulls.
- * `post_store`: triggered after node configuration is stored.
+ * `post_store`: triggered after node configuration is stored (this is executed only when the configuration has changed).
## Hook type: exec
The `exec` hook type allows users to run an arbitrary shell command or a binary when triggered.
diff --git a/lib/oxidized/cli.rb b/lib/oxidized/cli.rb
index 15d20c5..d35eab3 100644
--- a/lib/oxidized/cli.rb
+++ b/lib/oxidized/cli.rb
@@ -24,7 +24,7 @@ module Oxidized
Config.load(@opts)
Oxidized.setup_logger
- @pidfile = File.expand_path("pid")
+ @pidfile = File.join(Oxidized::Config::Root, 'pid')
end
def crash error
diff --git a/lib/oxidized/source/http.rb b/lib/oxidized/source/http.rb
index 6e765cf..93361a2 100644
--- a/lib/oxidized/source/http.rb
+++ b/lib/oxidized/source/http.rb
@@ -28,6 +28,9 @@ class HTTP < Source
end
request = Net::HTTP::Get.new(uri.request_uri, headers)
+ if (@cfg.user && @cfg.pass)
+ request.basic_auth(@cfg.user,@cfg.pass)
+ end
response = http.request(request)
data = JSON.parse(response.body)