cloudhealth-setup 0.0.13 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/cloudhealth-setup.gemspec +7 -6
- data/lib/cht/aws.rb +34 -6
- data/lib/cht/error_handling.rb +30 -1
- data/lib/cht/mechanize.rb +9 -3
- data/lib/cht/output.rb +17 -1
- data/lib/cloudhealth-setup.rb +75 -15
- metadata +39 -24
- data/lib/cloudhealth-accounts.csv +0 -4
    
        data/cloudhealth-setup.gemspec
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            Gem::Specification.new do |s|
         | 
| 2 2 | 
             
              s.name        = 'cloudhealth-setup'
         | 
| 3 | 
            -
              s.version     = '0.0. | 
| 4 | 
            -
              s.date        = '2013- | 
| 3 | 
            +
              s.version     = '0.0.14'
         | 
| 4 | 
            +
              s.date        = '2013-11-25'
         | 
| 5 5 | 
             
              s.platform    = Gem::Platform::RUBY
         | 
| 6 6 | 
             
              s.authors     = ['CloudHealth Technologies']
         | 
| 7 7 | 
             
              s.email       = ['support@cloudhealthtech.com']
         | 
| @@ -11,13 +11,14 @@ Gem::Specification.new do |s| | |
| 11 11 | 
             
              s.license     = 'MIT'
         | 
| 12 12 | 
             
              s.has_rdoc    = false
         | 
| 13 13 |  | 
| 14 | 
            -
              s.add_dependency(" | 
| 15 | 
            -
              s.add_dependency(" | 
| 16 | 
            -
              s.add_dependency(" | 
| 17 | 
            -
              s.add_dependency("excon", "= 0.23.0")
         | 
| 14 | 
            +
              s.add_dependency("fog", "= 1.15.0")
         | 
| 15 | 
            +
              s.add_dependency("multi_json", "= 1.7.7")
         | 
| 16 | 
            +
              s.add_dependency("excon", "= 0.25.3")
         | 
| 18 17 | 
             
              s.add_dependency("mixlib-cli", "= 1.3.0")
         | 
| 19 18 | 
             
              s.add_dependency("mechanize", "= 2.5.1")
         | 
| 20 19 | 
             
              s.add_dependency("highline", "= 1.6.19")
         | 
| 20 | 
            +
              s.add_dependency("nokogiri", "= 1.5.8")
         | 
| 21 | 
            +
              s.add_dependency("json_pure", "= 1.8.1")
         | 
| 21 22 |  | 
| 22 23 | 
             
              s.bindir        = "bin"
         | 
| 23 24 | 
             
              s.files         = Dir.glob('{bin,lib}/**/*') + %w[cloudhealth-setup.gemspec]
         | 
    
        data/lib/cht/aws.rb
    CHANGED
    
    | @@ -1,6 +1,3 @@ | |
| 1 | 
            -
            require "highline/system_extensions"
         | 
| 2 | 
            -
            include HighLine::SystemExtensions
         | 
| 3 | 
            -
             | 
| 4 1 | 
             
            class Setup
         | 
| 5 2 | 
             
              def iam
         | 
| 6 3 | 
             
                begin
         | 
| @@ -26,7 +23,7 @@ class Setup | |
| 26 23 | 
             
                  if @input_file.nil? || @input_file.empty?
         | 
| 27 24 | 
             
                    # Single account mode
         | 
| 28 25 | 
             
                    puts "Could not login to your account with the provided Amazon Web Services credentials. Please check your AWS Access Key and Secret Access Key and try again. If issue persists contact support@cloudhealthtech.com."
         | 
| 29 | 
            -
                     | 
| 26 | 
            +
                    windows_exit
         | 
| 30 27 | 
             
                  else
         | 
| 31 28 | 
             
                    # Multi account mode
         | 
| 32 29 | 
             
                    raise SetupFailed, "Could not login to your account with the provided Amazon Web Services credentials. Please check your AWS Access Key and Secret Access Key and try again. If issue persists contact support@cloudhealthtech.com."
         | 
| @@ -116,10 +113,11 @@ class Setup | |
| 116 113 | 
             
                        puts "    User #{@aws_ro_name} exists... continuing due to --user-exists"
         | 
| 117 114 | 
             
                        puts "    Note: CSV Output file will NOT be complete. Since we did not create the aws read only user"
         | 
| 118 115 | 
             
                        puts "          You must fill in the blanks of the CSV if you plan on importing the CSV on the website."
         | 
| 116 | 
            +
                        puts "          Consider running update instead."
         | 
| 119 117 | 
             
                      else
         | 
| 120 118 | 
             
                        #TODO This should not exit() in multi-account import mode, it should be raised up and caught. e.g. SetupFailed
         | 
| 121 | 
            -
                        puts "User #{@aws_ro_name} exists already, If this was your intention please re-run with --user-exists and ensure you update the CSV manually or choose another username via -r <name | 
| 122 | 
            -
                         | 
| 119 | 
            +
                        puts "User #{@aws_ro_name} exists already, If this was your intention please re-run with --user-exists and ensure you update the CSV manually or choose another username via -r <name>. If your intention was to just update, please run the update process on this script instead."
         | 
| 120 | 
            +
                        windows_exit
         | 
| 123 121 | 
             
                      end
         | 
| 124 122 | 
             
                    else
         | 
| 125 123 | 
             
                      puts "    Creating user... "
         | 
| @@ -270,4 +268,34 @@ class Setup | |
| 270 268 | 
             
                end
         | 
| 271 269 | 
             
                pw
         | 
| 272 270 | 
             
              end
         | 
| 271 | 
            +
             | 
| 272 | 
            +
              def update_ro_user
         | 
| 273 | 
            +
                ro_username = if user_exists
         | 
| 274 | 
            +
                                @aws_ro_name
         | 
| 275 | 
            +
                              else
         | 
| 276 | 
            +
                                ask("What is your cloudhealth read only username?")
         | 
| 277 | 
            +
                              end
         | 
| 278 | 
            +
                iam_user = @iam.get_user(ro_username)
         | 
| 279 | 
            +
                if iam_user.nil?
         | 
| 280 | 
            +
                  puts "Could not find your cloudhealth ro user, exiting..."
         | 
| 281 | 
            +
                  windows_exit
         | 
| 282 | 
            +
                end
         | 
| 283 | 
            +
                @aws_ro_name = ro_username unless @aws_ro_name.nil?
         | 
| 284 | 
            +
                if user_has_policy
         | 
| 285 | 
            +
                  @iam.delete_user_policy(@aws_ro_name,"CHTRoPolicy")
         | 
| 286 | 
            +
                end
         | 
| 287 | 
            +
                @iam.put_user_policy(@aws_ro_name, "CHTRoPolicy", aws_ro_policy)
         | 
| 288 | 
            +
                puts "Cloudhealth RO user #{@aws_ro_name} policy updated"
         | 
| 289 | 
            +
              end
         | 
| 290 | 
            +
             | 
| 291 | 
            +
              def update_s3_bucket
         | 
| 292 | 
            +
                unless @s3.directories.collect{|d| d.key}.include?(@setup_bucket)
         | 
| 293 | 
            +
                  puts "Could not find S3 bucket #{@setup_bucket}, Please retry after verifying bucket exists"
         | 
| 294 | 
            +
                end
         | 
| 295 | 
            +
                if bucket_has_policy
         | 
| 296 | 
            +
                  @s3.delete_bucket_policy(@setup_bucket)
         | 
| 297 | 
            +
                end
         | 
| 298 | 
            +
                @s3.put_bucket_policy(@setup_bucket, bucket_policy)
         | 
| 299 | 
            +
                puts "Cloudhealth billing bucket #{@setup_bucket} policy updated"
         | 
| 300 | 
            +
              end
         | 
| 273 301 | 
             
            end
         | 
    
        data/lib/cht/error_handling.rb
    CHANGED
    
    | @@ -1,14 +1,43 @@ | |
| 1 1 | 
             
            class SetupFailed < StandardError
         | 
| 2 2 | 
             
            end
         | 
| 3 3 |  | 
| 4 | 
            +
            class ReSetup < StandardError
         | 
| 5 | 
            +
            end
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            class RealExit < StandardError
         | 
| 8 | 
            +
            end
         | 
| 9 | 
            +
             | 
| 4 10 | 
             
            class Setup
         | 
| 11 | 
            +
              def self.immediate_exit
         | 
| 12 | 
            +
                # We should actually detect windows here then wait much longer
         | 
| 13 | 
            +
                puts "Cloudhealth setup finished"
         | 
| 14 | 
            +
                if ENV["OCRA_EXECUTABLE"]
         | 
| 15 | 
            +
                  sleep 2
         | 
| 16 | 
            +
                  raise RealExit
         | 
| 17 | 
            +
                end
         | 
| 18 | 
            +
                exit
         | 
| 19 | 
            +
              end
         | 
| 20 | 
            +
             | 
| 21 | 
            +
              def windows_exit
         | 
| 22 | 
            +
                # We should actually detect windows here then wait much longer
         | 
| 23 | 
            +
                puts "Cloudhealth setup finished"
         | 
| 24 | 
            +
                if ENV["OCRA_EXECUTABLE"]
         | 
| 25 | 
            +
                  sleep
         | 
| 26 | 
            +
                end
         | 
| 27 | 
            +
                exit
         | 
| 28 | 
            +
              end
         | 
| 29 | 
            +
             | 
| 30 | 
            +
              def self.rerun
         | 
| 31 | 
            +
                raise ReSetup
         | 
| 32 | 
            +
              end
         | 
| 33 | 
            +
             | 
| 5 34 | 
             
              def critical_failure(message)
         | 
| 6 35 | 
             
                puts message
         | 
| 7 36 | 
             
                #raise SetupFailed, message
         | 
| 8 37 | 
             
              end
         | 
| 9 38 |  | 
| 10 39 | 
             
              def warning(e)
         | 
| 11 | 
            -
                if @verbose
         | 
| 40 | 
            +
                if @verbose || ENV["OCRA_EXECUTABLE"]
         | 
| 12 41 | 
             
                  puts e
         | 
| 13 42 | 
             
                  puts e.backtrace
         | 
| 14 43 | 
             
                end
         | 
    
        data/lib/cht/mechanize.rb
    CHANGED
    
    | @@ -74,7 +74,7 @@ class Setup | |
| 74 74 | 
             
                  #TODO: Fix when multi input account works
         | 
| 75 75 | 
             
                  #raise SetupFailed, e
         | 
| 76 76 | 
             
                  puts e
         | 
| 77 | 
            -
                   | 
| 77 | 
            +
                  windows_exit
         | 
| 78 78 | 
             
                end
         | 
| 79 79 | 
             
              end
         | 
| 80 80 |  | 
| @@ -85,7 +85,7 @@ class Setup | |
| 85 85 | 
             
                  if @input_file.nil? || @input_file.empty?
         | 
| 86 86 | 
             
                    # Single account mode
         | 
| 87 87 | 
             
                    puts "Could not login to your account with the provided Amazon Web Services credentials. Please check your provided email address and password and try again. If issue persists contact support@cloudhealthtech.com."
         | 
| 88 | 
            -
                     | 
| 88 | 
            +
                    windows_exit
         | 
| 89 89 | 
             
                  else
         | 
| 90 90 | 
             
                    # Multi account mode
         | 
| 91 91 | 
             
                    raise SetupFailed, "Could not login to your account with the provided Amazon Web Services credentials. Please check your provided email address and password and try again. If issue persists contact support@cloudhealthtech.com."
         | 
| @@ -194,7 +194,13 @@ class Setup | |
| 194 194 | 
             
                    prog_access_form['s3BucketName'] = @setup_bucket
         | 
| 195 195 | 
             
                    prog_access_form.submit
         | 
| 196 196 | 
             
                  else
         | 
| 197 | 
            -
                     | 
| 197 | 
            +
                    if paf_enabled.value == @setup_bucket
         | 
| 198 | 
            +
                      puts "    Access already enabled on bucket #{@setup_bucket}..."
         | 
| 199 | 
            +
                    else
         | 
| 200 | 
            +
                      puts "    S3 Bucket is currently set to #{paf_enabled.value}, You requested it be set to #{@setup_bucket} -- Changing it."
         | 
| 201 | 
            +
                      prog_access_form['s3BucketName'] = @setup_bucket
         | 
| 202 | 
            +
                      prog_access_form.submit
         | 
| 203 | 
            +
                    end
         | 
| 198 204 | 
             
                  end
         | 
| 199 205 | 
             
                  puts "    Setup of programmatic access to billing finished"
         | 
| 200 206 | 
             
                rescue => e
         | 
    
        data/lib/cht/output.rb
    CHANGED
    
    | @@ -1,5 +1,21 @@ | |
| 1 1 | 
             
            class Setup
         | 
| 2 2 | 
             
              def self.write_csv(accounts, filename)
         | 
| 3 | 
            +
                if filename.nil?
         | 
| 4 | 
            +
                  if ENV["OCRA_EXECUTABLE"]
         | 
| 5 | 
            +
                    # We are on windows, in OCRA
         | 
| 6 | 
            +
                    win_desktop = ENV['HOME'] + '/Desktop'
         | 
| 7 | 
            +
                    win_filename = win_desktop + "/cloudhealth-accounts.csv"
         | 
| 8 | 
            +
                    filename = ask("Please give me full path to save output csv to (Hit enter for default: #{win_filename} ): ")
         | 
| 9 | 
            +
                    if filename.empty?
         | 
| 10 | 
            +
                      filename = win_filename
         | 
| 11 | 
            +
                    end
         | 
| 12 | 
            +
                  else
         | 
| 13 | 
            +
                    filename = ask("Please give me the full path to the save output csv to: (Hit enter for default: ./cloudhealth-setup.csv): ")
         | 
| 14 | 
            +
                    if filename.empty?
         | 
| 15 | 
            +
                      filename = "./cloudhealth-setup.csv"
         | 
| 16 | 
            +
                    end
         | 
| 17 | 
            +
                  end
         | 
| 18 | 
            +
                end
         | 
| 3 19 | 
             
                file_exists = File.exists?(filename)
         | 
| 4 20 | 
             
                mode = if file_exists
         | 
| 5 21 | 
             
                         if @overwrite_file
         | 
| @@ -14,7 +30,7 @@ class Setup | |
| 14 30 | 
             
                       end
         | 
| 15 31 |  | 
| 16 32 | 
             
                count = 0
         | 
| 17 | 
            -
                CSV.open(filename, mode) do |csv|
         | 
| 33 | 
            +
                CSV.open(File.expand_path(filename), mode) do |csv|
         | 
| 18 34 | 
             
                  unless mode == "ab"
         | 
| 19 35 | 
             
                    csv << ["Account ID", "Console URL", "IAM Username", "IAM Password", "AWS Access Key", "AWS Access Secret", "S3 Bucket", "Is Consolidated?"]
         | 
| 20 36 | 
             
                  end
         | 
    
        data/lib/cloudhealth-setup.rb
    CHANGED
    
    | @@ -1,19 +1,24 @@ | |
| 1 | 
            -
            gem "fog", "1. | 
| 2 | 
            -
            gem " | 
| 3 | 
            -
            gem "excon", "0. | 
| 1 | 
            +
            gem "fog", "1.15.0"
         | 
| 2 | 
            +
            gem "multi_json", "1.7.7"
         | 
| 3 | 
            +
            gem "excon", "0.25.3"
         | 
| 4 4 | 
             
            gem "mixlib-cli", "1.3.0"
         | 
| 5 5 | 
             
            gem "mechanize", "2.5.1"
         | 
| 6 6 | 
             
            gem "highline", "1.6.19"
         | 
| 7 7 | 
             
            gem "nokogiri", "1.5.8"
         | 
| 8 | 
            +
            gem "json_pure", "1.8.1"
         | 
| 8 9 |  | 
| 9 10 | 
             
            require "fog"
         | 
| 10 11 | 
             
            require "mixlib/cli"
         | 
| 11 | 
            -
            require " | 
| 12 | 
            +
            require "multi_json"
         | 
| 13 | 
            +
            require "json/pure"
         | 
| 12 14 | 
             
            require "mechanize"
         | 
| 13 15 | 
             
            require "excon"
         | 
| 14 16 | 
             
            require "highline/import"
         | 
| 15 17 | 
             
            require "securerandom"
         | 
| 16 18 | 
             
            require "csv"
         | 
| 19 | 
            +
            require "highline/system_extensions"
         | 
| 20 | 
            +
             | 
| 21 | 
            +
            include HighLine::SystemExtensions
         | 
| 17 22 |  | 
| 18 23 | 
             
            # Ruby 1.8.7 hack for compatability
         | 
| 19 24 | 
             
            unless Kernel.respond_to?(:require_relative)
         | 
| @@ -30,14 +35,12 @@ require_relative "cht/policy" | |
| 30 35 | 
             
            require_relative "cht/error_handling"
         | 
| 31 36 | 
             
            require_relative "cht/output"
         | 
| 32 37 |  | 
| 33 | 
            -
             | 
| 34 38 | 
             
            class MyCLI
         | 
| 35 39 | 
             
              include Mixlib::CLI
         | 
| 36 40 |  | 
| 37 41 | 
             
              option :output_file,
         | 
| 38 42 | 
             
                :short => "-o OUTFILE",
         | 
| 39 43 | 
             
                :long => "--output-file OUTFILE",
         | 
| 40 | 
            -
                :default => "./cloudhealth-accounts.csv",
         | 
| 41 44 | 
             
                :description => "Output CSV"
         | 
| 42 45 |  | 
| 43 46 | 
             
              option :overwrite_file,
         | 
| @@ -126,7 +129,7 @@ class Setup | |
| 126 129 | 
             
              attr_accessor :aws_key, :aws_secret, :aws_user, :aws_pass, :output_file, :input_file, :aws_url, :setup_bucket, :aws_ro_name, :aws_acct_alias, :account_name, :aws_account_id
         | 
| 127 130 |  | 
| 128 131 | 
             
              def initialize(options)
         | 
| 129 | 
            -
                manual_input = ensure_options(options)
         | 
| 132 | 
            +
                manual_input = ensure_options(options) unless defined?(Ocra)
         | 
| 130 133 | 
             
                options.merge!(manual_input)
         | 
| 131 134 | 
             
                @aws_key = options[:aws_key]
         | 
| 132 135 | 
             
                @aws_secret = options[:aws_secret]
         | 
| @@ -144,6 +147,7 @@ class Setup | |
| 144 147 | 
             
                @mfa = options[:multi_factor_code] || nil
         | 
| 145 148 | 
             
                @created_account = {}
         | 
| 146 149 | 
             
                @iam = iam
         | 
| 150 | 
            +
                @simple = options[:simple] || false
         | 
| 147 151 | 
             
                @s3 = s3
         | 
| 148 152 | 
             
                @browser = mech_browser
         | 
| 149 153 | 
             
                @mode = ARGV[0]
         | 
| @@ -189,19 +193,55 @@ class Setup | |
| 189 193 | 
             
                  output_opts[:setup_bucket] = ask("Input S3 Bucket name for billing: ")
         | 
| 190 194 | 
             
                end
         | 
| 191 195 |  | 
| 196 | 
            +
                if input[:aws_acct_alias].nil?
         | 
| 197 | 
            +
                  if input[:setup_mode] == "install"
         | 
| 198 | 
            +
                    output_opts[:aws_acct_alias] = ask("Alias you would like to setup for your AWS Account (Optional, only for initial install, hit enter otherwise): ")
         | 
| 199 | 
            +
                    output_opts.delete(:aws_acct_alias) if output_opts[:aws_acct_alias].empty? #Catch enter/no input
         | 
| 200 | 
            +
                  end
         | 
| 201 | 
            +
                end
         | 
| 202 | 
            +
             | 
| 192 203 | 
             
                output_opts
         | 
| 193 204 |  | 
| 194 205 | 
             
              end
         | 
| 195 206 |  | 
| 196 207 | 
             
              def self.run
         | 
| 197 208 | 
             
                cli = MyCLI.new
         | 
| 198 | 
            -
                 | 
| 209 | 
            +
                setup_modes = ["test", "install", "uninstall", "update", "help"]
         | 
| 210 | 
            +
                cli.banner = "Usage: cloudhealth-setup #{setup_modes.join('|')} (options)"
         | 
| 199 211 | 
             
                cli.parse_options
         | 
| 200 212 | 
             
                accounts_to_setup = []
         | 
| 201 213 | 
             
                accounts_processed = []
         | 
| 202 | 
            -
                if ARGV[0] | 
| 203 | 
            -
             | 
| 204 | 
            -
             | 
| 214 | 
            +
                setup_mode = if setup_modes.include?(ARGV[0])
         | 
| 215 | 
            +
                              ARGV[0]
         | 
| 216 | 
            +
                             else
         | 
| 217 | 
            +
                               # ARGV[0] is a cli option, not a mode
         | 
| 218 | 
            +
                               nil
         | 
| 219 | 
            +
                             end
         | 
| 220 | 
            +
             | 
| 221 | 
            +
                setup_mode = "install" if defined?(Ocra)
         | 
| 222 | 
            +
             | 
| 223 | 
            +
                if setup_mode.nil?
         | 
| 224 | 
            +
                  puts ""
         | 
| 225 | 
            +
                  puts "CloudHealth Setup"
         | 
| 226 | 
            +
                  puts ""
         | 
| 227 | 
            +
                  choose do |menu|
         | 
| 228 | 
            +
                    menu.prompt = "Please choose what you want to do:"
         | 
| 229 | 
            +
                    menu.choice(:install) { setup_mode = "install" }
         | 
| 230 | 
            +
                    menu.choice(:uninstall) { setup_mode = "uninstall" }
         | 
| 231 | 
            +
                    menu.choice(:test) { setup_mode = "test" }
         | 
| 232 | 
            +
                    menu.choice(:update) { setup_mode = "update"}
         | 
| 233 | 
            +
                    menu.choice(:help) {
         | 
| 234 | 
            +
                      puts cli.opt_parser
         | 
| 235 | 
            +
                      Setup.run
         | 
| 236 | 
            +
                    }
         | 
| 237 | 
            +
                    menu.choice(:quit) {
         | 
| 238 | 
            +
                      setup_mode = "quit"
         | 
| 239 | 
            +
                      Setup.immediate_exit
         | 
| 240 | 
            +
                    }
         | 
| 241 | 
            +
                  end
         | 
| 242 | 
            +
                  cli.config[:simple] = true
         | 
| 243 | 
            +
                  cli.config[:setup_mode] = setup_mode
         | 
| 244 | 
            +
                  puts "Continuing with #{setup_mode}..."
         | 
| 205 245 | 
             
                end
         | 
| 206 246 |  | 
| 207 247 | 
             
                if cli.config[:input_file]
         | 
| @@ -215,10 +255,10 @@ class Setup | |
| 215 255 | 
             
                accounts_to_setup.each do |account_options|
         | 
| 216 256 | 
             
                  new_account = Setup.new(account_options)
         | 
| 217 257 |  | 
| 218 | 
            -
                   | 
| 258 | 
            +
                  new_account.check_iam_credentials
         | 
| 259 | 
            +
                  new_account.check_web_credentials
         | 
| 260 | 
            +
                  case setup_mode
         | 
| 219 261 | 
             
                  when "install"
         | 
| 220 | 
            -
                    new_account.check_iam_credentials
         | 
| 221 | 
            -
                    new_account.check_web_credentials
         | 
| 222 262 | 
             
                    new_account.setup_monthly_report
         | 
| 223 263 | 
             
                    new_account.setup_s3_bucket
         | 
| 224 264 | 
             
                    new_account.setup_prog_access
         | 
| @@ -241,11 +281,31 @@ class Setup | |
| 241 281 | 
             
                    new_account.test_consolidated
         | 
| 242 282 | 
             
                  when "uninstall"
         | 
| 243 283 | 
             
                    new_account.uninstall_ro_user
         | 
| 284 | 
            +
                  when "update"
         | 
| 285 | 
            +
                    new_account.update_s3_bucket
         | 
| 286 | 
            +
                    new_account.update_ro_user
         | 
| 244 287 | 
             
                  else
         | 
| 245 288 | 
             
                    puts cli.opt_parser
         | 
| 246 289 | 
             
                  end
         | 
| 247 290 | 
             
                end
         | 
| 248 | 
            -
                Setup.write_csv(accounts_processed, cli.config[:output_file]) if  | 
| 291 | 
            +
                Setup.write_csv(accounts_processed, cli.config[:output_file]) if setup_mode == "install"
         | 
| 292 | 
            +
                if ENV['OCRA_EXECUTABLE']
         | 
| 293 | 
            +
                  Setup.run
         | 
| 294 | 
            +
                end
         | 
| 249 295 | 
             
              end
         | 
| 250 296 | 
             
            end
         | 
| 297 | 
            +
             | 
| 298 | 
            +
            begin
         | 
| 251 299 | 
             
            Setup.run
         | 
| 300 | 
            +
            rescue RealExit
         | 
| 301 | 
            +
              exit
         | 
| 302 | 
            +
            rescue SystemExit
         | 
| 303 | 
            +
              unless ENV['OCRA_EXECUTABLE']
         | 
| 304 | 
            +
                exit
         | 
| 305 | 
            +
              end
         | 
| 306 | 
            +
            rescue Exception => e
         | 
| 307 | 
            +
              puts "Ran into a problem, Please contact Cloudhealth Support with this error: #{e}"
         | 
| 308 | 
            +
              if ENV['OCRA_EXECUTABLE']
         | 
| 309 | 
            +
                Setup.run
         | 
| 310 | 
            +
              end
         | 
| 311 | 
            +
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: cloudhealth-setup
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.0. | 
| 4 | 
            +
              version: 0.0.14
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 7 | 
             
            authors:
         | 
| @@ -9,16 +9,16 @@ authors: | |
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date: 2013- | 
| 12 | 
            +
            date: 2013-11-25 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 | 
            -
              name:  | 
| 15 | 
            +
              name: fog
         | 
| 16 16 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 17 17 | 
             
                none: false
         | 
| 18 18 | 
             
                requirements:
         | 
| 19 19 | 
             
                - - '='
         | 
| 20 20 | 
             
                  - !ruby/object:Gem::Version
         | 
| 21 | 
            -
                    version: 1. | 
| 21 | 
            +
                    version: 1.15.0
         | 
| 22 22 | 
             
              type: :runtime
         | 
| 23 23 | 
             
              prerelease: false
         | 
| 24 24 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| @@ -26,15 +26,15 @@ dependencies: | |
| 26 26 | 
             
                requirements:
         | 
| 27 27 | 
             
                - - '='
         | 
| 28 28 | 
             
                  - !ruby/object:Gem::Version
         | 
| 29 | 
            -
                    version: 1. | 
| 29 | 
            +
                    version: 1.15.0
         | 
| 30 30 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 31 | 
            -
              name:  | 
| 31 | 
            +
              name: multi_json
         | 
| 32 32 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 33 33 | 
             
                none: false
         | 
| 34 34 | 
             
                requirements:
         | 
| 35 35 | 
             
                - - '='
         | 
| 36 36 | 
             
                  - !ruby/object:Gem::Version
         | 
| 37 | 
            -
                    version: 1. | 
| 37 | 
            +
                    version: 1.7.7
         | 
| 38 38 | 
             
              type: :runtime
         | 
| 39 39 | 
             
              prerelease: false
         | 
| 40 40 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| @@ -42,15 +42,15 @@ dependencies: | |
| 42 42 | 
             
                requirements:
         | 
| 43 43 | 
             
                - - '='
         | 
| 44 44 | 
             
                  - !ruby/object:Gem::Version
         | 
| 45 | 
            -
                    version: 1. | 
| 45 | 
            +
                    version: 1.7.7
         | 
| 46 46 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 47 | 
            -
              name:  | 
| 47 | 
            +
              name: excon
         | 
| 48 48 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 49 49 | 
             
                none: false
         | 
| 50 50 | 
             
                requirements:
         | 
| 51 51 | 
             
                - - '='
         | 
| 52 52 | 
             
                  - !ruby/object:Gem::Version
         | 
| 53 | 
            -
                    version:  | 
| 53 | 
            +
                    version: 0.25.3
         | 
| 54 54 | 
             
              type: :runtime
         | 
| 55 55 | 
             
              prerelease: false
         | 
| 56 56 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| @@ -58,15 +58,15 @@ dependencies: | |
| 58 58 | 
             
                requirements:
         | 
| 59 59 | 
             
                - - '='
         | 
| 60 60 | 
             
                  - !ruby/object:Gem::Version
         | 
| 61 | 
            -
                    version:  | 
| 61 | 
            +
                    version: 0.25.3
         | 
| 62 62 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 63 | 
            -
              name:  | 
| 63 | 
            +
              name: mixlib-cli
         | 
| 64 64 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 65 65 | 
             
                none: false
         | 
| 66 66 | 
             
                requirements:
         | 
| 67 67 | 
             
                - - '='
         | 
| 68 68 | 
             
                  - !ruby/object:Gem::Version
         | 
| 69 | 
            -
                    version:  | 
| 69 | 
            +
                    version: 1.3.0
         | 
| 70 70 | 
             
              type: :runtime
         | 
| 71 71 | 
             
              prerelease: false
         | 
| 72 72 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| @@ -74,15 +74,15 @@ dependencies: | |
| 74 74 | 
             
                requirements:
         | 
| 75 75 | 
             
                - - '='
         | 
| 76 76 | 
             
                  - !ruby/object:Gem::Version
         | 
| 77 | 
            -
                    version:  | 
| 77 | 
            +
                    version: 1.3.0
         | 
| 78 78 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 79 | 
            -
              name:  | 
| 79 | 
            +
              name: mechanize
         | 
| 80 80 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 81 81 | 
             
                none: false
         | 
| 82 82 | 
             
                requirements:
         | 
| 83 83 | 
             
                - - '='
         | 
| 84 84 | 
             
                  - !ruby/object:Gem::Version
         | 
| 85 | 
            -
                    version:  | 
| 85 | 
            +
                    version: 2.5.1
         | 
| 86 86 | 
             
              type: :runtime
         | 
| 87 87 | 
             
              prerelease: false
         | 
| 88 88 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| @@ -90,15 +90,15 @@ dependencies: | |
| 90 90 | 
             
                requirements:
         | 
| 91 91 | 
             
                - - '='
         | 
| 92 92 | 
             
                  - !ruby/object:Gem::Version
         | 
| 93 | 
            -
                    version:  | 
| 93 | 
            +
                    version: 2.5.1
         | 
| 94 94 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 95 | 
            -
              name:  | 
| 95 | 
            +
              name: highline
         | 
| 96 96 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 97 97 | 
             
                none: false
         | 
| 98 98 | 
             
                requirements:
         | 
| 99 99 | 
             
                - - '='
         | 
| 100 100 | 
             
                  - !ruby/object:Gem::Version
         | 
| 101 | 
            -
                    version:  | 
| 101 | 
            +
                    version: 1.6.19
         | 
| 102 102 | 
             
              type: :runtime
         | 
| 103 103 | 
             
              prerelease: false
         | 
| 104 104 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| @@ -106,15 +106,15 @@ dependencies: | |
| 106 106 | 
             
                requirements:
         | 
| 107 107 | 
             
                - - '='
         | 
| 108 108 | 
             
                  - !ruby/object:Gem::Version
         | 
| 109 | 
            -
                    version:  | 
| 109 | 
            +
                    version: 1.6.19
         | 
| 110 110 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 111 | 
            -
              name:  | 
| 111 | 
            +
              name: nokogiri
         | 
| 112 112 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 113 113 | 
             
                none: false
         | 
| 114 114 | 
             
                requirements:
         | 
| 115 115 | 
             
                - - '='
         | 
| 116 116 | 
             
                  - !ruby/object:Gem::Version
         | 
| 117 | 
            -
                    version: 1. | 
| 117 | 
            +
                    version: 1.5.8
         | 
| 118 118 | 
             
              type: :runtime
         | 
| 119 119 | 
             
              prerelease: false
         | 
| 120 120 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| @@ -122,7 +122,23 @@ dependencies: | |
| 122 122 | 
             
                requirements:
         | 
| 123 123 | 
             
                - - '='
         | 
| 124 124 | 
             
                  - !ruby/object:Gem::Version
         | 
| 125 | 
            -
                    version: 1. | 
| 125 | 
            +
                    version: 1.5.8
         | 
| 126 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 127 | 
            +
              name: json_pure
         | 
| 128 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 129 | 
            +
                none: false
         | 
| 130 | 
            +
                requirements:
         | 
| 131 | 
            +
                - - '='
         | 
| 132 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 133 | 
            +
                    version: 1.8.1
         | 
| 134 | 
            +
              type: :runtime
         | 
| 135 | 
            +
              prerelease: false
         | 
| 136 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 137 | 
            +
                none: false
         | 
| 138 | 
            +
                requirements:
         | 
| 139 | 
            +
                - - '='
         | 
| 140 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 141 | 
            +
                    version: 1.8.1
         | 
| 126 142 | 
             
            description: Configures an Amazon AWS account for use with the CloudHealth service,
         | 
| 127 143 | 
             
              including creating a least privilege read only AWS user and enabling the retrieval
         | 
| 128 144 | 
             
              of cost and usage information.
         | 
| @@ -143,7 +159,6 @@ files: | |
| 143 159 | 
             
            - lib/cht/mechanize.rb
         | 
| 144 160 | 
             
            - lib/cht/output.rb
         | 
| 145 161 | 
             
            - lib/cht/policy.rb
         | 
| 146 | 
            -
            - lib/cloudhealth-accounts.csv
         | 
| 147 162 | 
             
            - lib/cloudhealth-setup.rb
         | 
| 148 163 | 
             
            - cloudhealth-setup.gemspec
         | 
| 149 164 | 
             
            homepage: http://www.cloudhealthtech.com
         | 
| @@ -1,4 +0,0 @@ | |
| 1 | 
            -
            Account ID,Console URL,IAM Username,IAM Password,AWS Access Key,AWS Access Secret,S3 Bucket,Is Consolidated?
         | 
| 2 | 
            -
            495052634639,https://495052634639.signin.aws.amazon.com/,some-new-aws-ro-user,576501261b83d6fd9203011822875fcc,AKIAJGMSIZUEXP2WLQWA,DgwWvYt0YaZrLw9AkRusWmjlrD5KDXAM5F4TqCwo,tst-mfa-3fweew,false
         | 
| 3 | 
            -
            495052634639,https://495052634639.signin.aws.amazon.com/,some-new-aws-ro-user2,0251ee4449b2d65d8b3a220bb19b1eb3,AKIAIC7MUEK5XPLVDFVA,iapRZL97kafIJjpv/4W6qZotSaVggZaIri60gbVN,new-mfa-test-for-mejoshp,false
         | 
| 4 | 
            -
            495052634639,https://495052634639.signin.aws.amazon.com/,some-new-aws-ro-user4,7830926c652bfb821607d71df9c2e200,AKIAIBVYS72XJNYDQWKA,jTOHuMUvChcdZhJDJn1p+9i9bGQvZYU9ItumsurU,tst-for-mfa,false
         |