-
Notifications
You must be signed in to change notification settings - Fork 931
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added model mimosab11 * Update mimosab11.rb Fixed errors picked up on test * Update mimosab11.rb * additional change to CHANGELOG and Supported OS types for PR #2902
- Loading branch information
Showing
3 changed files
with
37 additions
and
1 deletion.
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
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 |