Exemple #1
0
  def get_apache_service_name(self):
      result = run_quick('yum info httpd', echo=False)
      if "httpd" in result.stdout:
          return "httpd"

      result = run_quick('dpkg -p apache2', echo=False)
      if "apache2" in result.stdout:
          return "apache2"
      

      print 'Unable to determine apache service name. Using apache2.'
      return "apache2"
def is_local(ip):
  """Determine if the given ip address refers to this machine or not.

  Args:
    ip [string]: A hostname or ip address suitable for binding to a socket.
  """
  if (ip == 'localhost' or ip == '127.0.0.1'  # variations of localhost binding
      or ip == socket.gethostname()           # external NIC binding
      or ip == '0.0.0.0'):                    # all local interfaces
    return True

  global __ifconfig_lines
  if not __ifconfig_lines:
    result = run_quick('/sbin/ifconfig | egrep -i " inet?"', echo=False)
    __ifconfig_lines = result.stdout

  # This should be quick and dirty without worrying about IP4 vs IP6 or
  # particulars about how the system ifconfig formats its output.
  # It assumes the ip is valid.
  return __ifconfig_lines.find(ip) >= 0
def is_local(ip):
  """Determine if the given ip address refers to this machine or not.

  Args:
    ip [string]: A hostname or ip address suitable for binding to a socket.
  """
  if (ip == 'localhost' or ip == '127.0.0.1'  # variations of localhost binding
      or ip == socket.gethostname()           # external NIC binding
      or ip == '0.0.0.0'):                    # all local interfaces
    return True

  global __ifconfig_lines
  if not __ifconfig_lines:
    result = run_quick('/sbin/ifconfig | egrep -i " inet?"', echo=False)
    __ifconfig_lines = result.stdout

  # This should be quick and dirty without worrying about IP4 vs IP6 or
  # particulars about how the system ifconfig formats its output.
  # It assumes the ip is valid.
  return __ifconfig_lines.find(ip) >= 0
 def start_deck(self):
     print 'Starting apache server.'
     run_quick('service apache2 start', echo=True)
 def stop_deck(self):
     print 'Stopping apache server while stopping Spinnaker.'
     run_quick('service apache2 stop', echo=True)
 def start_deck(self):
   print 'Starting apache server.'
   run_quick('service apache2 start', echo=True)
 def stop_deck(self):
   print 'Stopping apache server while starting Spinnaker.'
   run_quick('service apache2 stop', echo=True)
 def start_deck(self):
     print "Starting apache server."
     run_quick("service apache2 start", echo=True)
 def stop_deck(self):
     print "Stopping apache server while starting Spinnaker."
     run_quick("service apache2 stop", echo=True)
Exemple #10
0
 def start_spinnaker_monitoring(self):
   service = "spinnaker-monitoring"
   print 'Starting %s server.' % service
   run_quick('service %s start' % service, echo=True)
Exemple #11
0
 def stop_spinnaker_monitoring(self):
   service = "spinnaker-monitoring"
   print 'Stopping %s server while stopping Spinnaker.' % service
   run_quick('service %s stop' % service, echo=True)
Exemple #12
0
 def start_deck(self):
   apache = self.get_apache_service_name()
   print 'Starting %s server.' % apache
   run_quick('service %s start' % apache, echo=True)
Exemple #13
0
 def stop_deck(self):
   apache = self.get_apache_service_name()
   print 'Stopping %s server while stopping Spinnaker.' % apache
   run_quick('service %s stop' % apache, echo=True)