Created
May 9, 2016 21:14
-
-
Save rterp/de4525a956c203ff0ea01a59bece3627 to your computer and use it in GitHub Desktop.
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
require 'net/http' | |
require 'json' | |
url = 'http://lweb.lynden.com/WildflyRegistry/registry/services' | |
webapps = [] | |
resp = Net::HTTP.get_response(URI.parse(url)) | |
resp_text = resp.body | |
data =JSON.parse(resp_text) | |
servers = data | |
# Loop through each Wildfly server that was found | |
servers.each do |server| | |
serverName = server["serverName"] | |
#Is this the server we want to clone? | |
if serverName == cloneServer then | |
wildFlyApps = server["wildflyApp"] | |
#Loop through app on the server | |
wildFlyApps.each do |app| | |
#Create a hash of app name to app version | |
if app["appRuntimeName"].end_with? ".war" then | |
appTokens = app["appName"].split("-") | |
myHash = Hash[ :name, appTokens[0], :version, appTokens[1]] | |
webapps.push(myHash) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment