Skip to content
  • This project
    • Loading...
  • Sign in

nexedi / slapos.toolbox

Go to a project
Toggle navigation
Toggle navigation pinning
  • Projects
  • Groups
  • Snippets
  • Help
  • Project
  • Activity
  • Repository
  • Pipelines
  • Graphs
  • Issues 0
  • Merge Requests 2
  • Wiki
  • Network
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Merged
Merge Request !50 opened 2019-01-31 13:31:09 UTC by Alain Takoudjou@alain.takoudjou

Migrate old promises to plugin promise format

Migrate all promises used by caddy-frontend SR to plugin promise format

Edited 2019-03-08 06:46:19 UTC
Request to merge promise-migration into master

Merged by Alain Takoudjou 2019-02-05 17:17:12 UTC

The changes were merged into master. The source branch has been removed.

  • Discussion 42
  • Commits 3
  • Changes 16
  • {{ resolvedDiscussionCount }}/{{ discussionCount }} {{ resolvedCountText }} resolved
  • @alain.takoudjou Alain Takoudjou
    @alain.takoudjou

    mentioned in merge request slapos!510

    2019-01-31 13:31:47 UTC

    mentioned in merge request slapos!510

    Toggle commit list
  • Avatar
    Toggle discussion
    Thomas Gambier
    @tomo started a discussion on an outdated diff 2019-01-31 15:07:23 UTC
    Resolved by Alain Takoudjou 2019-02-04 10:06:16 UTC
    slapos/promise/plugin/check_error_on_apache_log.py 0 → 100644
    1 from zope import interface as zope_interface
    • @tomo Thomas Gambier
      @tomo commented 2019-01-31 15:07:23 UTC
      Developer

      could you rename the file check_error_on_frontend_log.py ? I would like to get rid of apache name when possible

    • @alain.takoudjou Alain Takoudjou
      @alain.takoudjou commented 2019-02-04 10:06:15 UTC
      Developer

      renamed to check_error_on_http_log I didn't use the name caddy as it's too specific.

  • Avatar
    Toggle discussion
    Thomas Gambier
    @tomo started a discussion on an outdated diff 2019-01-31 15:09:04 UTC
    Resolved by Alain Takoudjou 2019-02-04 10:06:39 UTC
    slapos/promise/plugin/check_icmp_packet_lost.py 0 → 100644
    1 from zope import interface as zope_interface
    2 from slapos.grid.promise import interface
    3 from slapos.grid.promise.generic import GenericPromise
    4 import re
    5 import time
    6 from slapos.networkbench.ping import ping, ping6
    7
    8 class RunPromise(GenericPromise):
    9
    10 zope_interface.implements(interface.IPromise)
    11
    12 def __init__(self, config):
    13 GenericPromise.__init__(self, config)
    14 # set periodicity to run the promise twice per day
    15 self.custom_frequency = 720
    • @tomo Thomas Gambier
      @tomo commented 2019-01-31 15:09:04 UTC
      Developer

      can we have the periodicity as an option ? It would be good to be able to launch this promise with different periods

    • @alain.takoudjou Alain Takoudjou
      @alain.takoudjou commented 2019-02-04 10:06:38 UTC
      Developer

      I added it as promise option now

  • Avatar
    Toggle discussion
    Thomas Gambier
    @tomo started a discussion on an outdated diff 2019-01-31 15:09:42 UTC
    Resolved by Alain Takoudjou 2019-02-04 10:08:52 UTC
    slapos/promise/plugin/check_icmp_packet_lost.py 0 → 100644
    21 """
    22 # Address to ping to
    23 address = self.getConfig('address')
    24 if not address:
    25 raise ValueError("'address' was not set in promise parameters.")
    26 # Force use ipv4 protocol ?
    27 ipv4 = self.getConfig('ipv4') in ('True', 'true', '1')
    28 count = self.getConfig('count', 10)
    29
    30 if ipv4:
    31 result = ping(address, count=count)
    32 else:
    33 result = ping6(address, count=count)
    34
    35 message = "%s host=%s code=%s, result=%s, packet_lost_ratio=%s msg=%s" % result
    36 if result[4] != "0":
    • @tomo Thomas Gambier
      @tomo commented 2019-01-31 15:09:42 UTC
      Developer

      could we have also a threshold as an option ? like 1 packet lost is OK or 2 packets lost is OK

    • @alain.takoudjou Alain Takoudjou
      @alain.takoudjou commented 2019-02-04 10:08:51 UTC
      Developer

      done

  • Avatar
    Toggle discussion
    Thomas Gambier
    @tomo started a discussion on an outdated diff 2019-01-31 15:11:27 UTC
    Resolved by Alain Takoudjou 2019-02-04 10:09:35 UTC
    slapos/promise/plugin/check_re6st_optimal_status.py 0 → 100644
    24 ipv6 = self.getConfig('ipv6')
    25 count = self.getConfig('count', 10)
    26 if not ipv4:
    27 raise ValueError("'ipv4' was not set in promise parameters.")
    28 if not ipv6:
    29 raise ValueError("'ipv6' was not set in promise parameters.")
    30
    31 result_ipv4 = ping(ipv4, count=count)
    32 result_ipv6 = ping6(ipv6, count=count)
    33 # push into to the log file
    34 self.logger.info("%s host=%s code=%s, result=%s, packet_lost_ratio=%s msg=%s" % result_ipv4)
    35 self.logger.info("%s host=%s code=%s, result=%s, packet_lost_ratio=%s msg=%s" % result_ipv6)
    36
    37 if result_ipv4[3] == "failed" and result_ipv6[3] != "failed":
    38 # IPv4 is unreacheable
    39 self.logger.info("OK")
    • @tomo Thomas Gambier
      @tomo commented 2019-01-31 15:11:27 UTC
      Developer

      could add more precise log in logger ? like OK: IPv4 unreachable, IPv6 reachable

    • @alain.takoudjou Alain Takoudjou
      @alain.takoudjou commented 2019-02-04 10:09:35 UTC
      Developer

      I added in 8db39d3b

  • Avatar
    Toggle discussion
    Thomas Gambier
    @tomo started a discussion on an outdated diff 2019-01-31 15:11:40 UTC
    Resolved by Alain Takoudjou 2019-02-04 10:09:47 UTC
    slapos/promise/plugin/check_re6st_optimal_status.py 0 → 100644
    29 raise ValueError("'ipv6' was not set in promise parameters.")
    30
    31 result_ipv4 = ping(ipv4, count=count)
    32 result_ipv6 = ping6(ipv6, count=count)
    33 # push into to the log file
    34 self.logger.info("%s host=%s code=%s, result=%s, packet_lost_ratio=%s msg=%s" % result_ipv4)
    35 self.logger.info("%s host=%s code=%s, result=%s, packet_lost_ratio=%s msg=%s" % result_ipv6)
    36
    37 if result_ipv4[3] == "failed" and result_ipv6[3] != "failed":
    38 # IPv4 is unreacheable
    39 self.logger.info("OK")
    40 return
    41
    42 if result_ipv6[3] == "failed":
    43 # IPv6 is unreacheable
    44 self.logger.error("FAILED")
    • @tomo Thomas Gambier
      @tomo commented 2019-01-31 15:11:40 UTC
      Developer

      same here: better log

    • @alain.takoudjou Alain Takoudjou
      @alain.takoudjou commented 2019-02-04 10:09:47 UTC
      Developer

      added in 8db39d3b

  • Avatar
    Toggle discussion
    Thomas Gambier
    @tomo started a discussion on an outdated diff 2019-01-31 15:12:19 UTC
    Resolved by Alain Takoudjou 2019-02-04 10:09:56 UTC
    slapos/promise/plugin/check_re6st_optimal_status.py 0 → 100644
    40 return
    41
    42 if result_ipv6[3] == "failed":
    43 # IPv6 is unreacheable
    44 self.logger.error("FAILED")
    45 return
    46
    47 latency4 = float(result_ipv4[3])
    48 latency6 = float(result_ipv6[3])
    49 # We can consider that at worst 1ms is added to
    50 # ipv4 response, due the usage of openvpn.
    51 acceptable_delay = 1
    52 # We can consider that we accept a certain increase
    53 # on latency, if we are on a bit congested link.
    54 # So 10% is reseonable enough.
    55 acceptable_lost = 0.10
    • @tomo Thomas Gambier
      @tomo commented 2019-01-31 15:12:19 UTC
      Developer

      can acceptable_delay and acceptable_lost be an option ?

    • @alain.takoudjou Alain Takoudjou
      @alain.takoudjou commented 2019-02-04 10:09:55 UTC
      Developer

      added

  • Avatar
    Toggle discussion
    Thomas Gambier
    @tomo started a discussion on the diff 2019-01-31 15:13:54 UTC
    Resolved by Alain Takoudjou 2019-02-04 10:10:02 UTC
    slapos/promise/plugin/check_re6st_optimal_status.py 0 → 100644
    48 latency6 = float(result_ipv6[3])
    49 # We can consider that at worst 1ms is added to
    50 # ipv4 response, due the usage of openvpn.
    51 acceptable_delay = 1
    52 # We can consider that we accept a certain increase
    53 # on latency, if we are on a bit congested link.
    54 # So 10% is reseonable enough.
    55 acceptable_lost = 0.10
    56 # Increase latency with the value.
    57 latency4 += acceptable_delay + latency4 * acceptable_lost
    58 if latency4 < latency6:
    59 self.logger.error("FAIL %s (latency4) > %s (latence6)" % (latency4, latency6))
    60 else:
    61 # Compare if both has Same working rate
    62 self.logger.info("OK")
    63
    • @tomo Thomas Gambier
      @tomo commented 2019-01-31 15:13:54 UTC
      Developer

      the test function should return None as we don't want this promise to make instantiation fail.

  • Avatar
    Toggle discussion
    Thomas Gambier
    @tomo started a discussion on an outdated diff 2019-01-31 15:15:34 UTC
    Resolved by Alain Takoudjou 2019-02-04 10:10:19 UTC
    slapos/promise/plugin/frontend_config_validate.py 0 → 100644
    9
    10 zope_interface.implements(interface.IPromise)
    11
    12 def __init__(self, config):
    13 GenericPromise.__init__(self, config)
    14 # check configuration every 5 minutes (only for anomaly)
    15 self.setPeriodicity(minute=5)
    16
    17 def sense(self):
    18 """
    19 RUn frontend validatation script
    20 """
    21
    22 validate_script = self.getConfig('verification-script')
    23 result = float(subprocess.check_output([validate_script]))
    24 process = SlapPopen([validate_script])
    • @tomo Thomas Gambier
      @tomo commented 2019-01-31 15:15:34 UTC
      Developer

      aren't you running the script twice ??

    • @alain.takoudjou Alain Takoudjou
      @alain.takoudjou commented 2019-02-04 10:10:18 UTC
      Developer

      yes, thanks. I fixed

  • Avatar
    Toggle discussion
    Thomas Gambier
    @tomo started a discussion on an outdated diff 2019-01-31 15:16:26 UTC
    Resolved by Alain Takoudjou 2019-02-04 10:10:44 UTC
    slapos/promise/plugin/frontend_config_validate.py 0 → 100644
    17 def sense(self):
    18 """
    19 RUn frontend validatation script
    20 """
    21
    22 validate_script = self.getConfig('verification-script')
    23 result = float(subprocess.check_output([validate_script]))
    24 process = SlapPopen([validate_script])
    25 stdout, stderr = process.communicate()
    26 if process.returncode != 0:
    27 self.logger.info("OK")
    28 else:
    29 self.logger.error("%s\n%s" % (stdout, stderr))
    30
    31 def anomaly(self):
    32 return self._test(result_count=2, failure_amount=2)
    • @tomo Thomas Gambier
      @tomo commented 2019-01-31 15:16:26 UTC
      Developer

      here anomaly can be like test, this is not something that will have glitches

    • @alain.takoudjou Alain Takoudjou
      @alain.takoudjou commented 2019-02-04 10:10:42 UTC
      Developer

      ok, I changed

  • Avatar
    Toggle discussion
    Thomas Gambier
    @tomo started a discussion on an outdated diff 2019-01-31 15:17:55 UTC
    Resolved by Alain Takoudjou 2019-02-04 10:10:50 UTC
    slapos/promise/plugin/trafficserver_cache_availability.py 0 → 100644
    1 from zope import interface as zope_interface
    2 from slapos.grid.promise import interface
    3 from slapos.grid.promise.generic import GenericPromise
    4
    5 import subprocess
    6
    7 class RunPromise(GenericPromise):
    8
    9 zope_interface.implements(interface.IPromise)
    10
    11 def __init__(self, config):
    12 GenericPromise.__init__(self, config)
    13 self.setPeriodicity(minute=5)
    • @tomo Thomas Gambier
      @tomo commented 2019-01-31 15:17:55 UTC
      Developer

      can we have the period as a config option ? In general, I think it would be good to make all the promises have a configurable period because we don't know how SR will evolve and it's better to have only to change slapos repository.

  • Avatar
    Toggle discussion
    Thomas Gambier
    @tomo started a discussion on an outdated diff 2019-01-31 15:18:48 UTC
    Resolved by Alain Takoudjou 2019-02-04 10:10:54 UTC
    slapos/test/promise/plugin/test_check_error_on_apache_log.py 0 → 100644
    1 ##############################################################################
    • @tomo Thomas Gambier
      @tomo commented 2019-01-31 15:18:48 UTC
      Developer

      the same for the name : frontend instead of apache

  • 0d26e5885b4c844763ca1fc0f7f4f444?s=80&d=identicon
    Toggle discussion
    Jérome Perrin
    @jerome started a discussion on an outdated diff 2019-02-01 00:00:07 UTC
    Resolved by Alain Takoudjou 2019-02-01 10:11:38 UTC
    slapos/promise/plugin/check_error_on_apache_log.py 0 → 100644
    5 import time
    6 import os
    7
    8 class RunPromise(GenericPromise):
    9
    10 zope_interface.implements(interface.IPromise)
    11
    12 def __init__(self, config):
    13 GenericPromise.__init__(self, config)
    14 # set periodicity to run the promise twice per day
    15 self.custom_frequency = 720
    16 self.setPeriodicity(self.custom_frequency)
    17
    18 def sense(self):
    19 """
    20 Check if frontend URL is available
    • @jerome Jérome Perrin
      @jerome commented 2019-02-01 00:00:07 UTC
      Owner

      this comment seem to be copy pasted

    • @jerome Jérome Perrin
      @jerome commented 2019-02-01 00:00:28 UTC
      Owner

      ( I mean it's same in other promise classes from this MR but they don't seem to check frontend URL )

    • @alain.takoudjou Alain Takoudjou
      @alain.takoudjou commented 2019-02-01 10:11:37 UTC
      Developer

      Yes Thanks @jerome, I fixed. I'll review everything again

  • 0d26e5885b4c844763ca1fc0f7f4f444?s=80&d=identicon
    Toggle discussion
    Jérome Perrin
    @jerome started a discussion on an outdated diff 2019-02-01 00:01:53 UTC
    Resolved by Alain Takoudjou 2019-02-04 10:12:17 UTC
    slapos/promise/plugin/check_error_on_apache_log.py 0 → 100644
    62 raise
    63 if maximum_delay and (time.time()-time.mktime(t)) > maximum_delay:
    64 # no result in the latest hour
    65 break
    66 if level != "[error]":
    67 continue
    68 # Classify the types of errors
    69 if "(113)No route to host" in msg:
    70 no_route_error += 1
    71 elif "(101)Network is unreachable" in msg:
    72 network_is_unreacheable += 1
    73 elif "(110)Connection timed out" in msg:
    74 timeout += 1
    75 error_amount += 1
    76 if error_amount:
    77 self.logger.error("ERROR=%s (NOTROUTE=%s, UNREACHEABLENET=%s, TIMEOUT=%s)" % (
    • @jerome Jérome Perrin
      @jerome commented 2019-02-01 00:01:53 UTC
      Owner

      NOTROUTE seem to be a typo ( NOROUTE ? )

      also, spelling of UNREACHEABLE is UNREACHABLE

  • 0d26e5885b4c844763ca1fc0f7f4f444?s=80&d=identicon
    Toggle discussion
    Jérome Perrin
    @jerome started a discussion on an outdated diff 2019-02-01 00:02:10 UTC
    Resolved by Alain Takoudjou 2019-02-04 10:30:31 UTC
    slapos/promise/plugin/check_icmp_packet_lost.py 0 → 100644
    13 GenericPromise.__init__(self, config)
    14 # set periodicity to run the promise twice per day
    15 self.custom_frequency = 720
    16 self.setPeriodicity(self.custom_frequency)
    17
    18 def sense(self):
    19 """
    20 Check if frontend URL is available
    21 """
    22 # Address to ping to
    23 address = self.getConfig('address')
    24 if not address:
    25 raise ValueError("'address' was not set in promise parameters.")
    26 # Force use ipv4 protocol ?
    27 ipv4 = self.getConfig('ipv4') in ('True', 'true', '1')
    28 count = self.getConfig('count', 10)
    • @jerome Jérome Perrin
      @jerome commented 2019-02-01 00:02:10 UTC
      Owner

      isn't a cast as int missing here ?

    • @alain.takoudjou Alain Takoudjou
      @alain.takoudjou commented 2019-02-01 10:13:06 UTC
      Developer

      yes, thanks

  • 0d26e5885b4c844763ca1fc0f7f4f444?s=80&d=identicon
    Toggle discussion
    Jérome Perrin
    @jerome started a discussion on an outdated diff 2019-02-01 00:03:02 UTC
    Resolved by Alain Takoudjou 2019-02-04 10:12:35 UTC
    slapos/promise/plugin/check_re6st_optimal_status.py 0 → 100644
    10 zope_interface.implements(interface.IPromise)
    11
    12 def __init__(self, config):
    13 GenericPromise.__init__(self, config)
    14 # set periodicity to run the promise twice per day
    15 self.custom_frequency = 720
    16 self.setPeriodicity(self.custom_frequency)
    17
    18 def sense(self):
    19 """
    20 Check if frontend URL is available
    21 """
    22 # promise ipv6 and ipv4 address to compare.
    23 ipv4 = self.getConfig('ipv4')
    24 ipv6 = self.getConfig('ipv6')
    25 count = self.getConfig('count', 10)
    • @jerome Jérome Perrin
      @jerome commented 2019-02-01 00:03:02 UTC
      Owner

      isn't a cast as int missing also here ?

    • @alain.takoudjou Alain Takoudjou
      @alain.takoudjou commented 2019-02-04 10:12:34 UTC
      Developer

      fixed, thanks

  • 0d26e5885b4c844763ca1fc0f7f4f444?s=80&d=identicon
    Toggle discussion
    Jérome Perrin
    @jerome started a discussion on the diff 2019-02-01 00:04:37 UTC
    Resolved by Alain Takoudjou 2019-02-04 10:29:55 UTC
    slapos/promise/plugin/trafficserver_cache_availability.py 0 → 100644
    9 zope_interface.implements(interface.IPromise)
    10
    11 def __init__(self, config):
    12 GenericPromise.__init__(self, config)
    13 self.setPeriodicity(minute=5)
    14
    15 def sense(self):
    16 """
    17 Check trafficserver cache availability
    18 """
    19 traffic_line = self.getConfig('wrapper-path')
    20
    21 process = subprocess.Popen(
    22 [traffic_line, '-r', 'proxy.node.cache.percent_free'],
    23 stdout=subprocess.PIPE,
    24 stderr=subprocess.STDOUT,
    • @jerome Jérome Perrin
      @jerome commented 2019-02-01 00:04:37 UTC
      Owner

      can we close_fds=True here ?

      or change the

      import subprocess
      

      into

      try:
        import subprocess32 as subprocess
      except ImportError:
        import subprocess
      
    • @alain.takoudjou Alain Takoudjou
      @alain.takoudjou commented 2019-02-04 10:13:57 UTC
      Developer

      I used the second option with try import subprocess32 as subprocess.

  • 0d26e5885b4c844763ca1fc0f7f4f444?s=80&d=identicon
    Toggle discussion
    Jérome Perrin
    @jerome started a discussion on an outdated diff 2019-02-01 00:05:53 UTC
    Resolved by Alain Takoudjou 2019-02-05 17:10:40 UTC
    slapos/test/promise/plugin/test_check_error_on_apache_log.py 0 → 100644
    22 # You should have received a copy of the GNU General Public License
    23 # along with this program; if not, write to the Free Software
    24 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    25 #
    26 ##############################################################################
    27
    28 from slapos.test.promise.plugin import TestPromisePluginMixin
    29 import os
    30 from slapos.test.promise import data
    31
    32 class TestCheckErrorOnApacheLog(TestPromisePluginMixin):
    33
    34 def get_time(self, sec):
    35 return time.strftime("%a %b %d %H:%M:%S %Y", time.localtime(time.time()-sec))
    36
    37 def _update_logs(self):
    • @jerome Jérome Perrin
      @jerome commented 2019-02-01 00:05:53 UTC
      Owner

      in zodbtools, we used https://github.com/spulec/freezegun . It might be useful here as well

  • 0d26e5885b4c844763ca1fc0f7f4f444?s=80&d=identicon
    Toggle discussion
    Jérome Perrin
    @jerome started a discussion on an outdated diff 2019-02-01 00:07:08 UTC
    Last updated by Alain Takoudjou 2019-02-01 10:16:59 UTC
    slapos/test/promise/plugin/test_check_error_on_apache_log.py 0 → 100644
    17 # This program is distributed in the hope that it will be useful,
    18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
    19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    20 # GNU General Public License for more details.
    21 #
    22 # You should have received a copy of the GNU General Public License
    23 # along with this program; if not, write to the Free Software
    24 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    25 #
    26 ##############################################################################
    27
    28 from slapos.test.promise.plugin import TestPromisePluginMixin
    29 import os
    30 from slapos.test.promise import data
    31
    32 class TestCheckErrorOnApacheLog(TestPromisePluginMixin):
    • @jerome Jérome Perrin
      @jerome commented 2019-02-01 00:07:08 UTC
      Owner

      I'm not requesting changes, but TestPromisePluginMixin is not really a Mixin according to https://en.wikipedia.org/wiki/Mixin#In_Python maybe PromisePluginTestCase would have been a better name

    • @alain.takoudjou Alain Takoudjou
      @alain.takoudjou commented 2019-02-01 10:16:59 UTC
      Developer

      OK @jerome , I'll check and change it in another commit (as I also need to change others tests).

  • @alain.takoudjou Alain Takoudjou
    @alain.takoudjou

    added 2 commits

    • 3cbe5e3e - promise: make tests work
    • 8db39d3b - promises: fixup, first part

    Compare with previous version

    2019-02-01 10:09:09 UTC

    added 2 commits

    • 3cbe5e3e - promise: make tests work
    • 8db39d3b - promises: fixup, first part

    Compare with previous version

    Toggle commit list
  • @alain.takoudjou Alain Takoudjou
    @alain.takoudjou

    added 1 commit

    • 6fd5eebe - promise fix failures

    Compare with previous version

    2019-02-01 15:01:37 UTC

    added 1 commit

    • 6fd5eebe - promise fix failures

    Compare with previous version

    Toggle commit list
  • @alain.takoudjou Alain Takoudjou
    @alain.takoudjou

    added 2 commits

    • ea7966d9 - promise: fixup fixupgit status
    • 5cd803e0 - promise: remove old version of promises used for caddy-frontend

    Compare with previous version

    2019-02-04 08:42:49 UTC

    added 2 commits

    • ea7966d9 - promise: fixup fixupgit status
    • 5cd803e0 - promise: remove old version of promises used for caddy-frontend

    Compare with previous version

    Toggle commit list
  • @alain.takoudjou Alain Takoudjou
    @alain.takoudjou

    added 1 commit

    • 59c67acb - do not close pycurl to early

    Compare with previous version

    2019-02-04 09:54:57 UTC

    added 1 commit

    • 59c67acb - do not close pycurl to early

    Compare with previous version

    Toggle commit list
  • @alain.takoudjou Alain Takoudjou
    @alain.takoudjou

    added 2 commits

    • 33111784 - migrates old promises used in caddy-frontend SR to new format
    • fddc5e5c - promise: remove old version of promises used for caddy-frontend

    Compare with previous version

    2019-02-04 10:28:42 UTC

    added 2 commits

    • 33111784 - migrates old promises used in caddy-frontend SR to new format
    • fddc5e5c - promise: remove old version of promises used for caddy-frontend

    Compare with previous version

    Toggle commit list
  • Avatar
    Toggle discussion
    Thomas Gambier
    @tomo started a discussion on an outdated diff 2019-02-04 10:46:01 UTC
    Resolved by Alain Takoudjou 2019-02-05 17:05:48 UTC
    slapos/promise/check_error_on_apache_log/__init__.py → slapos/promise/plugin/check_error_on_http_log.py
    57 if parsing_failure < 3:
    58 # Accept failure 2 times, as the line can be actually
    59 # cut on the middle.
    60 parsing_failure += 1
    61 continue
    62 raise
    63 if maximum_delay and (time.time()-time.mktime(t)) > maximum_delay:
    64 # no result in the latest hour
    65 break
    66 if level != "[error]":
    67 continue
    68 # Classify the types of errors
    69 if "(113)No route to host" in msg:
    70 no_route_error += 1
    71 elif "(101)Network is unreachable" in msg:
    72 network_is_unreacheable += 1
    • @tomo Thomas Gambier
      @tomo commented 2019-02-04 10:46:01 UTC
      Developer

      unreachable also in variable name

  • Avatar
    Toggle discussion
    Thomas Gambier
    @tomo started a discussion on an outdated diff 2019-02-04 10:50:51 UTC
    Resolved by Alain Takoudjou 2019-02-05 17:07:59 UTC
    slapos/promise/plugin/check_re6st_optimal_status.py 0 → 100644
    54 # So 10% is reseonable enough.
    55 acceptable_lost = int(self.getConfig('acceptable-lost', 0.10))
    56 # Increase latency with the value.
    57 latency4 += acceptable_delay + latency4 * acceptable_lost
    58 if latency4 < latency6:
    59 self.logger.error("FAIL %s (latency4) > %s (latence6)" % (latency4, latency6))
    60 else:
    61 # Compare if both has Same working rate
    62 self.logger.info("OK: IPv4 reachable, IPv6 reachable")
    63
    64 def anomaly(self):
    65 # only check the result of the two latest sense call
    66 return self._test(result_count=2, failure_amount=2, latest_minute=self.custom_frequency*3)
    67
    68 def test(self):
    69 return TestResult(message="")
    • @tomo Thomas Gambier
      @tomo commented 2019-02-04 10:50:51 UTC
      Developer

      I don"t think we can return an empty TestResult in test function.

      Indeed, imagine the ping is always bad, the promise will fail each time it is run. But each time we will run the test function, the promise will not fail hence we will see in the history of the promise: fail fail fail fail fail ok fail fail fail fail fail ok ...

      Edited 2019-02-04 10:51:05 UTC
    • @alain.takoudjou Alain Takoudjou
      @alain.takoudjou commented 2019-02-05 17:07:58 UTC
      Developer

      This promise is now test_less which solve fail,...ok issue

  • Avatar
    Toggle discussion
    Thomas Gambier
    @tomo started a discussion on an outdated diff 2019-02-04 10:52:11 UTC
    Resolved by Alain Takoudjou 2019-02-05 10:32:34 UTC
    slapos/promise/plugin/validate_frontend_configuration.py 0 → 100644
    23 validate_script = self.getConfig('verification-script')
    24 if not validate_script:
    25 raise ValueError("'verification-script' was not set in promise parameters.")
    26 process = subprocess.Popen(
    27 [validate_script],
    28 stdout=subprocess.PIPE,
    29 stderr=subprocess.STDOUT,
    30 )
    31 message = process.communicate()[0]
    32 if process.returncode == 0:
    33 self.logger.info("OK")
    34 else:
    35 self.logger.error("%s" % message)
    36
    37 def anomaly(self):
    38 return self._test()
    • @tomo Thomas Gambier
      @tomo commented 2019-02-04 10:52:11 UTC
      Developer

      maybe we should return AnomalyResult here because we would like a bang... what do you think ?

    • @alain.takoudjou Alain Takoudjou
      @alain.takoudjou commented 2019-02-05 10:32:33 UTC
      Developer

      yes, it'll be better. I change to return anomaly

  • Avatar
    Toggle discussion
    Thomas Gambier
    @tomo started a discussion on an outdated diff 2019-02-04 10:53:05 UTC
    Resolved by Alain Takoudjou 2019-02-05 10:32:29 UTC
    slapos/test/promise/plugin/test_check_error_on_http_log.py 0 → 100644
    127
    128 content = self.base_content % {
    129 'log_file': self.base_path + "/SOFTINST-0_apache_error_log",
    130 'maximum_delay': 3600
    131 }
    132 self.writePromise(self.promise_name, content)
    133
    134 # remove previous pyc, so modified promise file will be used
    135 if os.path.exists(self.promise_pyc):
    136 os.unlink(self.promise_pyc)
    137 # Ignore periodicity of the promise
    138 with self.assertRaises(PromiseError):
    139 self.launcher.run()
    140 result = self.getPromiseResult(self.promise_name)
    141 self.assertEqual(result['result']['failed'], True)
    142 self.assertEqual(result['result']['message'], "ERROR=1 (NOTROUTE=1, UNREACHEABLENET=0, TIMEOUT=0)")
    • @tomo Thomas Gambier
      @tomo commented 2019-02-04 10:53:05 UTC
      Developer

      UNREACHABLENET

  • @jerome Jérome Perrin
    @jerome

    mentioned in merge request !51

    2019-02-05 00:11:20 UTC

    mentioned in merge request !51

    Toggle commit list
  • @alain.takoudjou Alain Takoudjou
    @alain.takoudjou

    added 2 commits

    • 27cf4944 - promise: disabled test call for some promises
    • adb42536 - promise fixup

    Compare with previous version

    2019-02-05 10:32:20 UTC

    added 2 commits

    • 27cf4944 - promise: disabled test call for some promises
    • adb42536 - promise fixup

    Compare with previous version

    Toggle commit list
  • @alain.takoudjou Alain Takoudjou
    @alain.takoudjou

    added 3 commits

    • d08332e8 - migrates old promises used in caddy-frontend SR to new format
    • f370181a - promise: remove old version of promises used for caddy-frontend
    • d98616b0 - promise: disable test check for some promises

    Compare with previous version

    2019-02-05 16:58:34 UTC

    added 3 commits

    • d08332e8 - migrates old promises used in caddy-frontend SR to new format
    • f370181a - promise: remove old version of promises used for caddy-frontend
    • d98616b0 - promise: disable test check for some promises

    Compare with previous version

    Toggle commit list
  • @alain.takoudjou Alain Takoudjou
    @alain.takoudjou

    unmarked as a Work In Progress

    2019-02-05 17:13:38 UTC

    unmarked as a Work In Progress

    Toggle commit list
  • @alain.takoudjou Alain Takoudjou
    @alain.takoudjou

    merged

    2019-02-05 17:17:12 UTC

    merged

    Toggle commit list
  • @bminusl Bryton Lacquement
    @bminusl

    mentioned in commit 00434ba1

    2019-02-07 12:41:54 UTC

    mentioned in commit 00434ba1

    Toggle commit list
  • @bminusl Bryton Lacquement
    @bminusl

    mentioned in commit 051f3471

    2019-02-07 12:45:18 UTC

    mentioned in commit 051f3471

    Toggle commit list
  • @jerome Jérome Perrin
    @jerome commented 2019-02-25 03:17:58 UTC
    Owner

    Apparently this introduced a regression

    image
    ======================================================================
    FAIL: test_ipv6_is_faster (slapos.test.promise.plugin.test_check_re6st_optimal_status.TestCheckRe6stOptimalStatus)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
    File "/srv/slapgrid/slappart7/srv/testnode/ij/inst/test0-0/parts/slapos.toolbox/slapos/test/promise/plugin/test_check_re6st_optimal_status.py", line 65, in test_ipv6_is_faster
    self.assertEqual(last_message, "OK: IPv4 reachable, IPv6 reachable")
    AssertionError: u'OK: IPv4 unreachable, IPv6 reachable' != 'OK: IPv4 reachable, IPv6 reachable'
    
  • @jerome Jérome Perrin
    @jerome commented 2019-03-05 03:57:11 UTC
    Owner

    @tomo this is still failing as far as I see

  • @alain.takoudjou Alain Takoudjou
    @alain.takoudjou commented 2019-03-05 08:59:24 UTC
    Developer

    @jerome, I'll fix it thanks.

  • @jerome Jérome Perrin
    @jerome commented 2019-03-08 06:46:19 UTC
    Owner

    Since 0d084fb6 we are back to [PASS] SLAPOS-EGG-TEST: 862 Tests, 0 Errors, 0 Failures, 29 Skips , thanks @alain.takoudjou !

  • Write
  • Preview
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
  • Please register or sign in to post a comment
Assignee
No assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
4
4 participants
Reference: nexedi/slapos.toolbox!50
×

Revert this commit

Switch branch
Cancel
A new branch will be created in your fork and a new merge request will be started.
×

Cherry-pick this commit

Switch branch
Cancel
A new branch will be created in your fork and a new merge request will be started.
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备14008524号