-
Notifications
You must be signed in to change notification settings - Fork 912
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'ytti:master' into master
- Loading branch information
Showing
10 changed files
with
86 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
begin | ||
# Mechanize has to be intialized here as the login needs a POST request | ||
require "mechanize" | ||
rescue LoadError | ||
# Oxidized requires mechanize | ||
raise Oxidized::OxidizedError, "mechanize not found: sudo gem install mechanize" | ||
end | ||
|
||
class Mimosab11 < Oxidized::Model | ||
using Refinements | ||
# Callback cfg_cb function to login(POST) then get(GET) the configuration | ||
cfg_cb = lambda do | ||
@e = Mechanize.new | ||
# Set login query endpoint(lqe) and login POST data(lqp) | ||
lqe = "https://#{@node.ip}/?q=index.login&mimosa_ajax=1" | ||
lgp = { "username" => "configure", "password" => @password } | ||
# Set get request endpoint(gc) for config | ||
gc = "https://#{@node.ip}/?q=preferences.configure&mimosa_action=download" | ||
# Not to verify self signed | ||
@e.verify_mode = 0 | ||
@e.post(lqe, lgp) | ||
cfg = @e.get(gc) | ||
cfg.body | ||
end | ||
|
||
cmd cfg_cb do |cfg| | ||
cfg | ||
end | ||
|
||
cfg :http do | ||
@username = @node.auth[:username] | ||
@password = @node.auth[:password] | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters