Пример #1
0
  def doActivar(self):
    self.__callScript([
      'sudo',
      'a2ensite',
      self.get_apache_site(),
      ])

    self.__callScript([
      'sudo',
      'a2ensite',
      self.get_apache_ssl_site(),
      ])

    self.__callScript([
      'sudo',
      'service',
      'apache2',
      'reload'
      ])

    ddns = Zonomi(settings.AMBIENTE.zonomi.api_key)
    ddns.domain_update(self.get_dominio())
    ddns.add_domain_update_to_crontab(self.get_dominio(),settings.AMBIENTE.default_user)

    self.activa = True
    self.save()
Пример #2
0
 def test_add_domain_update_to_crontab(self):
     if zonomi_settings.ZONOMI_API_KEY is None:
         return
     zonomi = Zonomi()
     dominio = 'dominio.de.prueba'
     user = '******'
     zonomi.add_domain_update_to_crontab(dominio,user)
     self.assertEqual(0,subprocess.call(['grep', dominio, zonomi.get_crontab(user)]))
Пример #3
0
 def test_add_domain_update_to_crontab(self):
     if zonomi_settings.ZONOMI_API_KEY is None:
         return
     zonomi = Zonomi()
     dominio = 'dominio.de.prueba'
     user = '******'
     zonomi.add_domain_update_to_crontab(dominio, user)
     self.assertEqual(
         0, subprocess.call(['grep', dominio,
                             zonomi.get_crontab(user)]))
Пример #4
0
  def doDesactivar(self):
    
    try:
      self.__callScript([
        'sudo',
        'a2dissite',
        self.get_apache_site(),
        ])
    except:
      logger = logging.getLogger(__name__)
      logger.error(traceback.format_exc())

    try:
      self.__callScript([
        'sudo',
        'a2dissite',
        self.get_apache_ssl_site(),
        ])
    except:
      logger = logging.getLogger(__name__)
      logger.error(traceback.format_exc())

    try:
      self.__callScript([
        'sudo',
        'service',
        'apache2',
        'reload'
        ])
    except:
      logger = logging.getLogger(__name__)
      logger.error(traceback.format_exc())
    
    try:
      os.remove(self.get_apache_config_file_path())
    except:
      logger = logging.getLogger(__name__)
      logger.error(traceback.format_exc())

    try:
      os.remove(self.get_apache_ssl_config_file_path())
    except:
      logger = logging.getLogger(__name__)
      logger.error(traceback.format_exc())

    try:
      ddns = Zonomi(settings.AMBIENTE.zonomi.api_key)

      try:
        ddns.delete_domain(self.get_dominio())
      except:
        logger = logging.getLogger(__name__)
        logger.error(traceback.format_exc())

      try:
        ddns.remove_domain_update_from_crontab(self.get_dominio(),settings.AMBIENTE.default_user)
      except:
        logger = logging.getLogger(__name__)
        logger.error(traceback.format_exc())

    except:
      logger = logging.getLogger(__name__)
      logger.error(traceback.format_exc())

    self.activa = False
    self.save()
Пример #5
0
 def test_add_domain_update_to_crontab(self):
     zonomi = Zonomi()
     dominio = 'dominio.de.prueba'
     user = '******'
     zonomi.add_domain_update_to_crontab(dominio,user)
     self.assertEqual(0,subprocess.call(['grep', dominio, zonomi.get_crontab(user)]))
Пример #6
0
  def set_ddns_updater(self):

    if settings.AMBIENTE.zonomi.api_key:
      ddns = Zonomi(settings.AMBIENTE.zonomi.api_key)
      ddns.domain_update(self.get_dominio())
Пример #7
0
    def set_ddns_updater(self):

        if settings.AMBIENTE.zonomi.api_key:
            ddns = Zonomi(settings.AMBIENTE.zonomi.api_key)
            ddns.domain_update(self.get_dominio())