panteras_api 0.0.24 → 0.0.25
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.
- checksums.yaml +4 -4
- data/bin/mesos_consul_consistency_check +24 -6
- data/lib/panteras_api/marathon_endpoint.rb +7 -2
- data/lib/panteras_api/version.rb +1 -1
- metadata +1 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: ea8ca118bcd94f2214e8b26b808ff340c0a2256f
         | 
| 4 | 
            +
              data.tar.gz: 19410c55001484b73f5febcafcfc73a56a6030da
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 774f39767226b84eebb8fdafa197cfe08e1922f2a5da3f9645e38e029a4f19cf44dde229b58d77cd9c66974220a75277929ef0b06699d7451fe7d11f356b6c78
         | 
| 7 | 
            +
              data.tar.gz: cb947d62cf63f2b3c5ede496b64900c441004151db1e9f7637b197f12cddca9b773655d191bf405ad995485611805e7a6d672d30aff8806c82eb6204985e506d
         | 
| @@ -72,9 +72,23 @@ puts "* My hostname: #{my_fqdn}" if config[:debug] | |
| 72 72 |  | 
| 73 73 | 
             
            timeout_in_seconds = config[:timeout]
         | 
| 74 74 |  | 
| 75 | 
            +
            marathon_temp = MarathonEndpoint.new(config[:mesos_master_hostname], 8080, config[:marathon_username], config[:marathon_password])
         | 
| 76 | 
            +
            @marathon = MarathonEndpoint.new(marathon_temp.leader, 8080, config[:marathon_username], config[:marathon_password])
         | 
| 77 | 
            +
             | 
| 78 | 
            +
            ### Skip when deploymetns - in multiple places to aviod race conditions
         | 
| 79 | 
            +
            def exit_on_deployment
         | 
| 80 | 
            +
              if ! @marathon.deployments.empty?
         | 
| 81 | 
            +
                puts "Deployment in progess"
         | 
| 82 | 
            +
                exit 0
         | 
| 83 | 
            +
              end
         | 
| 84 | 
            +
            end
         | 
| 85 | 
            +
             | 
| 86 | 
            +
            exit_on_deployment
         | 
| 87 | 
            +
             | 
| 75 88 | 
             
            begin
         | 
| 76 89 | 
             
            Timeout::timeout(timeout_in_seconds) do
         | 
| 77 90 |  | 
| 91 | 
            +
             | 
| 78 92 | 
             
              ### MESOS
         | 
| 79 93 | 
             
              puts "#" * 75 if config[:debug]
         | 
| 80 94 | 
             
              puts "* Mesos tasks ids running this cluster (all slaves):" if config[:debug]
         | 
| @@ -94,18 +108,17 @@ Timeout::timeout(timeout_in_seconds) do | |
| 94 108 | 
             
                #puts mesos.task_ids('chronos-config').sort
         | 
| 95 109 | 
             
              end
         | 
| 96 110 |  | 
| 111 | 
            +
              exit_on_deployment
         | 
| 112 | 
            +
             | 
| 97 113 | 
             
              ### MARATHON
         | 
| 98 114 | 
             
              puts "#" * 75 if config[:debug]
         | 
| 99 115 | 
             
              puts "* Marathon tasks on #{my_fqdn}:" if config[:debug]
         | 
| 100 | 
            -
               | 
| 101 | 
            -
              if ! marathon.deployments.empty?
         | 
| 102 | 
            -
                puts "Deployment in progess"
         | 
| 103 | 
            -
                exit 0
         | 
| 104 | 
            -
              end
         | 
| 105 | 
            -
              marathon_tasks = marathon.my_task_ids(my_fqdn, 'marathon')
         | 
| 116 | 
            +
              marathon_tasks = @marathon.my_task_ids(my_fqdn, 'marathon')
         | 
| 106 117 | 
             
              puts marathon_tasks.sort if config[:debug]
         | 
| 107 118 | 
             
              good_news << "#{marathon_tasks.size} marathon tasks running."
         | 
| 108 119 |  | 
| 120 | 
            +
              exit_on_deployment
         | 
| 121 | 
            +
             | 
| 109 122 | 
             
              ## MESOS LOCAL
         | 
| 110 123 | 
             
              puts "#" * 75 if config[:debug]
         | 
| 111 124 | 
             
              puts "* Mesos tasks ids for tasks running on #{my_fqdn}:" if config[:debug]
         | 
| @@ -114,6 +127,8 @@ Timeout::timeout(timeout_in_seconds) do | |
| 114 127 | 
             
              puts mesos_tasks.sort if config[:debug]
         | 
| 115 128 | 
             
              good_news << "#{mesos_tasks.size} mesos tasks running." if ! mesos_tasks.empty?
         | 
| 116 129 |  | 
| 130 | 
            +
              exit_on_deployment
         | 
| 131 | 
            +
             | 
| 117 132 | 
             
              ### CHRONOS
         | 
| 118 133 | 
             
              puts "#" * 75 if config[:debug]
         | 
| 119 134 | 
             
              puts "* Chronos tasks on #{my_fqdn}:" if config[:debug]
         | 
| @@ -152,6 +167,7 @@ Timeout::timeout(timeout_in_seconds) do | |
| 152 167 | 
             
              puts consul_services.sort if config[:debug]
         | 
| 153 168 | 
             
              good_news << "#{consul_services.size} consul services running."
         | 
| 154 169 |  | 
| 170 | 
            +
              exit_on_deployment
         | 
| 155 171 |  | 
| 156 172 | 
             
              ### set these environment variables here or in shell for testing a remote docker (ie, boot2docker)
         | 
| 157 173 | 
             
              #ENV['DOCKER_HOST']='tcp://192.168.59.103:2376'
         | 
| @@ -212,6 +228,8 @@ rescue Timeout::Error | |
| 212 228 | 
             
              good_news << "Time out - no response in reasonable time"
         | 
| 213 229 | 
             
            end
         | 
| 214 230 |  | 
| 231 | 
            +
            exit_on_deployment
         | 
| 232 | 
            +
             | 
| 215 233 | 
             
            if ! bad_news.empty?
         | 
| 216 234 | 
             
              puts "problems on #{my_fqdn}: #{bad_news.join(' ')}"
         | 
| 217 235 | 
             
              exit config[:error_exit_code]
         | 
| @@ -18,13 +18,18 @@ class MarathonEndpoint | |
| 18 18 | 
             
                to_j(get_response_with_redirect(@host, '/v2/apps/', @port, @user, @passwd))[:apps]
         | 
| 19 19 | 
             
              end
         | 
| 20 20 |  | 
| 21 | 
            +
              def leader
         | 
| 22 | 
            +
                to_j(get_response_with_redirect(@host, '/v2/leader', @port, @user, @passwd))[:leader].split(':').first
         | 
| 23 | 
            +
              end
         | 
| 24 | 
            +
             | 
| 21 25 | 
             
              def deployments
         | 
| 22 26 | 
             
                to_j(get_response_with_redirect(@host, '/v2/deployments', @port, @user, @passwd))
         | 
| 23 27 | 
             
              end
         | 
| 24 28 |  | 
| 25 29 | 
             
              def app_names
         | 
| 26 | 
            -
                 | 
| 27 | 
            -
                 | 
| 30 | 
            +
                apps = all_apps
         | 
| 31 | 
            +
                raise StandardError, "Empty response from marathon", caller if apps.nil?
         | 
| 32 | 
            +
                apps.collect { |a| a[:id][1..-1] }
         | 
| 28 33 | 
             
              end
         | 
| 29 34 |  | 
| 30 35 | 
             
              def tasks_ids(app_name)
         | 
    
        data/lib/panteras_api/version.rb
    CHANGED