AppController/djinn.rb
# Gets the status of the current node in the AppScale deployment
#
# Args:
#   secret: The shared key for authentication
# Returns:
#   A string with the current node's status
#
Gets the status of the current node in the AppScale deployment
Args:
secret: The shared key for authentication
Returns:
A string with the current node's status
Gets the status of the current node in the AppScale deployment Args : secret : The shared key for authentication Returns : A string with the current node ' s status
def status(secret)
    return BAD_SECRET_MSG unless valid_secret?(secret)
    stats = get_stats(secret)
    stats_str = <<-STATUS
    Currently using #{stats['cpu']} Percent CPU and #{stats['memory']} Percent Memory
    Hard disk is #{stats['disk']} Percent full
    Is currently: #{stats['roles'].join(', ')}
    Database is at #{stats['db_location']}
    Is in cloud: #{stats['cloud']}
    Current State: #{stats['state']}
    STATUS
    if my_node.is_shadow?
      apps = []
      stats['apps'].each { |key, _|
        apps << key
      }
      stats_str << "    Hosting the following apps: #{apps.join(', ')}\n"
      stats['apps'].each { |app_name, is_loaded|
        next unless is_loaded
        next if app_name == "none"
        stats_str << "    Information for application: #{app_name}\n"
        stats_str << "        Language            : "
        if @app_info_map[app_name]['language'].nil?
          stats_str << "Unknown\n"
        else
          stats_str << "#{@app_info_map[app_name]['language']}\n"
        end
        stats_str << "        Number of AppServers: "
        if @app_info_map[app_name]['appengine'].nil?
          stats_str << "Unknown\n"
        else
          running = 0
          pending = 0
          @app_info_map[app_name]['appengine'].each{ |location|
             _host, port = location.split(":")
             if Integer(port) > 0
               running += 1
             else
               pending += 1
             end
          }
          stats_str << "#{running} running"
          if pending > 0
            stats_str << ", #{pending} pending"
          end
          stats_str << "\n"
        end
        stats_str << "        HTTP port           : "
        if @app_info_map[app_name]['nginx'].nil?
          stats_str << "Unknown\n"
        else
          stats_str << "#{@app_info_map[app_name]['nginx']}\n"
        end
        stats_str << "        HTTPS port          : "
        if @app_info_map[app_name]['nginx_https'].nil?
          stats_str << "Unknown\n"
        else
          stats_str << "#{@app_info_map[app_name]['nginx_https']}\n"
        end
      }
    end
    return stats_str
  end
def status ( secret ) return BAD_SECRET_MSG unless valid_secret? ( secret ) stats = get_stats ( secret ) stats_str = <<-STATUS 
    Currently using  #{ stats [ 'cpu' ] }  Percent CPU and  #{ stats [ 'memory' ] }  Percent Memory
    Hard disk is  #{ stats [ 'disk' ] }  Percent full
    Is currently:  #{ stats [ 'roles' ] . join ( ', ' ) } 
    Database is at  #{ stats [ 'db_location' ] } 
    Is in cloud:  #{ stats [ 'cloud' ] } 
    Current State:  #{ stats [ 'state' ] } STATUS if my_node . is_shadow? apps = [ ] stats [ 'apps' ] . each { | key , _ | apps << key } stats_str << "    Hosting the following apps: #{apps.join(', ')}\n" stats [ 'apps' ] . each { | app_name , is_loaded | next unless is_loaded next if app_name == "none" stats_str << "    Information for application: #{app_name}\n" stats_str << "        Language            : " if @app_info_map [ app_name ] [ 'language' ] . nil? stats_str << "Unknown\n" else stats_str << "#{@app_info_map[app_name]['language']}\n" end stats_str << "        Number of AppServers: " if @app_info_map [ app_name ] [ 'appengine' ] . nil? stats_str << "Unknown\n" else running = 0 pending = 0 @app_info_map [ app_name ] [ 'appengine' ] . each { | location | _host , port = location . split ( ":" ) if Integer ( port ) > 0 running += 1 else pending += 1 end } stats_str << "#{running} running" if pending > 0 stats_str << ", #{pending} pending" end stats_str << "\n" end stats_str << "        HTTP port           : " if @app_info_map [ app_name ] [ 'nginx' ] . nil? stats_str << "Unknown\n" else stats_str << "#{@app_info_map[app_name]['nginx']}\n" end stats_str << "        HTTPS port          : " if @app_info_map [ app_name ] [ 'nginx_https' ] . nil? stats_str << "Unknown\n" else stats_str << "#{@app_info_map[app_name]['nginx_https']}\n" end } end return stats_str end
Gets the status of the current node in the AppScale deployment
Args:
secret: The shared key for authentication
Returns:
A string with the current node's status
Gets the status of the current node in the AppScale deployment Args : secret : The shared key for authentication Returns : A string with the current node ' s status
secret
<not_specific>