Module: check_mk
Branch: master
Commit: 212d25e90cca96afdd0025b847e2af2a7f35014a
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=212d25e90cca96…
Author: Jukka Aro <ja(a)mathias-kettner.de>
Date: Mon Apr 16 10:33:25 2018 +0200
Win-agent integration tests: retry 20 min if VM occupied
Retry obtaining test lock 20 times at intervals of 60s if the VM running
the tests is occupied. This has become essential as at least 1.5.0 and
master builds are sharing the same VM so another build is likely to be
running on the same VM much more often than before.
---
agents/windows/it/conftest.py | 12 +++++++++---
agents/windows/it/lock.py | 20 +++++++++++++-------
2 files changed, 22 insertions(+), 10 deletions(-)
diff --git a/agents/windows/it/conftest.py b/agents/windows/it/conftest.py
index e306010..83f73e5 100644
--- a/agents/windows/it/conftest.py
+++ b/agents/windows/it/conftest.py
@@ -18,19 +18,25 @@ def lock_cmd(subcmd):
]
-def acquire_lock():
+def lock_operation(command):
+ # Copy essential sources always to remote host. This is necessary as
+ # another test executor might have removed the files meanwhile.
files = [os.path.join(localdir, f) for f in ['lock.py', 'remote.py']]
cmds = [[
'scp',
sshopts,
] + files + ['%s@%s:%s' % (remoteuser, remote_ip, remotedir)],
- lock_cmd('acquire')]
+ lock_cmd(command)]
for cmd in cmds:
assert_subprocess(cmd)
+def acquire_lock():
+ lock_operation('acquire')
+
+
def release_lock():
- assert_subprocess(lock_cmd('release'))
+ lock_operation('release')
def scp_agent_exe():
diff --git a/agents/windows/it/lock.py b/agents/windows/it/lock.py
index 0d5d647..ac1a5d8 100644
--- a/agents/windows/it/lock.py
+++ b/agents/windows/it/lock.py
@@ -6,6 +6,7 @@
from contextlib import contextmanager
import os
import sys
+import time
from win32api import GetLastError
from win32event import CreateMutex, ReleaseMutex
from winerror import ERROR_ALREADY_EXISTS
@@ -14,7 +15,7 @@ from remote import remotedir
lockname = os.path.join(remotedir, 'test.lock')
mutexname = '__test_lock__'
-
+retry_count = 20
@contextmanager
def synchronized():
@@ -31,12 +32,17 @@ def synchronized():
def acquire():
- with synchronized():
- if os.path.exists(lockname):
- sys.stderr.write(
- 'Lock file exists. Is another test process running?')
- sys.exit(1)
- open(lockname, 'w').close()
+ for i in range(retry_count):
+ with synchronized():
+ if not os.path.exists(lockname):
+ open(lockname, 'w').close()
+ return
+ sys.stderr.write('Lock file exists. Waiting 60s...')
+ time.sleep(60)
+
+ sys.stderr.write('Lock file still exists after waiting %d minutes. '
+ 'Another test process hung?')
+ sys.exit(1)
def release():
Module: check_mk
Branch: master
Commit: b6b775f3867c5bce44ff2f7904e7fe800366d1b5
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b6b775f3867c5b…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Apr 16 09:27:20 2018 +0200
5976 FIX Fixed possible "AttributeError" exception on custom graph list page
When a user opened up the custom graph list page while another user
had a custom graph that was not published to other users, this lead
to an exception on this page.
Change-Id: I84ccf4efbf43527f8f3fdb12b8551c7f7bbba02f
---
.werks/5976 | 13 +++++++++++++
web/htdocs/pagetypes.py | 2 +-
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/.werks/5976 b/.werks/5976
new file mode 100644
index 0000000..76545c5
--- /dev/null
+++ b/.werks/5976
@@ -0,0 +1,13 @@
+Title: Fixed possible "AttributeError" exception on custom graph list page
+Level: 1
+Component: multisite
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1523863569
+
+When a user opened up the custom graph list page while another user
+had a custom graph that was not published to other users, this lead
+to an exception on this page.
diff --git a/web/htdocs/pagetypes.py b/web/htdocs/pagetypes.py
index de0bc4f..1bd8050 100644
--- a/web/htdocs/pagetypes.py
+++ b/web/htdocs/pagetypes.py
@@ -497,7 +497,7 @@ class Overridable(Base):
# Is this the visual which would be shown to the user in case the user
# requests a visual with the current name?
page = self.find_page(self.name())
- if page.owner() != self.owner():
+ if page and page.owner() != self.owner():
return False
return self.is_public()
Module: check_mk
Branch: master
Commit: baac5db21063ae804acb06d3301cac5bdd362b54
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=baac5db21063ae…
Author: Tom Baerwinkel <tb(a)mathias-kettner.de>
Date: Fri Apr 13 09:14:26 2018 +0200
Move subclass specific things in ModeEditCustomAttrs to the subclasses
Change-Id: I6f5a43fdabc2651556e75ea240baed1718c66343
---
web/htdocs/wato.py | 105 ++++++++++++++++++++++++++++++++++-------------------
1 file changed, 68 insertions(+), 37 deletions(-)
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index d432944..7c044da 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -15621,6 +15621,9 @@ class ModeEditCustomAttr(WatoMode):
def title(self):
raise NotImplementedError()
+ def _add_extra_attrs_from_html_vars(self):
+ pass
+
def action(self):
# TODO: remove subclass specific things specifict things (everything with _type == 'user')
if not html.check_transaction():
@@ -15636,8 +15639,6 @@ class ModeEditCustomAttr(WatoMode):
topic = html.var('topic', '').strip()
help = html.get_unicode_input('help').strip()
- if self._type == "user":
- user_editable = html.get_checkbox('user_editable')
show_in_table = html.get_checkbox('show_in_table')
add_custom_macro = html.get_checkbox('add_custom_macro')
@@ -15673,21 +15674,35 @@ class ModeEditCustomAttr(WatoMode):
'add_custom_macro' : add_custom_macro,
})
- if self._type == "user":
- self._attr['user_editable'] = user_editable
+ self._add_extra_attrs_from_html_vars()
save_custom_attrs_to_mk_file(self._all_attrs)
self._update_config()
return self._type + "_attrs"
+ @property
+ def _topics(self):
+ raise NotImplementedError()
+
+ @property
+ def _macro_help(self):
+ raise NotImplementedError()
+
+ @property
+ def _macro_label(self):
+ raise NotImplementedError()
+
+ def _add_extra_form_sections(self):
+ pass
+
def page(self):
# TODO: remove subclass specific things specifict things (everything with _type == 'user')
html.begin_form("attr")
forms.header(_("Properties"))
forms.section(_("Name"), simple = not self._new)
html.help(_("The name of the attribute is used as an internal key. It cannot be "
- "changed later."))
+ "changed later."))
if self._new:
html.text_input("name", self._attr.get('name'))
html.set_focus("name")
@@ -15701,21 +15716,8 @@ class ModeEditCustomAttr(WatoMode):
forms.section(_('Topic'))
html.help(_('The attribute is added to this section in the edit dialog.'))
-
- if self._type == "user":
- topics = [
- ('ident', _('Identity')),
- ('security', _('Security')),
- ('notify', _('Notifications')),
- ('personal', _('Personal Settings')),
- ]
- default_topic = "personal"
- else:
- topics = list(set([ (a[1], a[1]) for a in watolib.all_host_attributes() if a[1] != None ]))
- topics.insert(0, (_("Custom attributes"), _("Custom attributes")))
- default_topic = _("Custom attributes")
-
- html.dropdown('topic', topics, deflt=self._attr.get('topic', 'personal'))
+ # TODO: is deflt set correctly?
+ html.dropdown('topic', self._topics, deflt=self._attr.get('topic', 'personal'))
forms.section(_('Help Text') + "<sup>*</sup>")
html.help(_('You might want to add some helpful description for the attribute.'))
@@ -15728,11 +15730,7 @@ class ModeEditCustomAttr(WatoMode):
else:
html.write(dict(custom_attr_types())[self._attr.get('type')])
- if self._type == "user":
- forms.section(_('Editable by Users'))
- html.help(_('It is possible to let users edit their custom attributes.'))
- html.checkbox('user_editable', self._attr.get('user_editable', True),
- label = _("Users can change this attribute in their personal settings"))
+ self._add_extra_form_sections()
forms.section(_('Show in Table'))
html.help(_('This attribute is only visibile on the detail pages by default, but '
@@ -15741,19 +15739,9 @@ class ModeEditCustomAttr(WatoMode):
label = _("Show the setting of the attribute in the list table"))
forms.section(_('Add as custom macro'))
- if self._type == "user":
- html.help(_('The attribute can be added to the contact definiton in order '
- 'to use it for notifications.'))
- label = _("Make this variable available in notifications")
- else:
- html.help(_("The attribute can be added to the host definition in order to "
- "use it as monitoring macro in different places, for example "
- "as macro in check commands or notifications."))
- label = _("Make this variable available as monitoring macro, "
- "e.g. in check commands or in notifications.")
-
+ html.help(self._macro_help)
html.checkbox('add_custom_macro', self._attr.get('add_custom_macro', False),
- label=label)
+ label=self._macro_label)
forms.end()
html.show_localization_hint()
@@ -15770,9 +15758,35 @@ class ModeEditCustomUserAttr(ModeEditCustomAttr):
def _type(self):
return 'user'
+ @property
+ def _topics(self):
+ return [
+ ('ident', _('Identity')),
+ ('security', _('Security')),
+ ('notify', _('Notifications')),
+ ('personal', _('Personal Settings')),
+ ]
+
+ @property
+ def _macro_help(self):
+ return _('The attribute can be added to the contact definiton in order to use it for notifications.')
+
+ @property
+ def _macro_label(self):
+ return _("Make this variable available in notifications")
+
def _update_config(self):
update_user_custom_attrs()
+ def _add_extra_attrs_from_html_vars(self):
+ self._attr['user_editable'] = html.get_checkbox('user_editable')
+
+ def _add_extra_form_sections(self):
+ forms.section(_('Editable by Users'))
+ html.help(_('It is possible to let users edit their custom attributes.'))
+ html.checkbox('user_editable', self._attr.get('user_editable', True),
+ label = _("Users can change this attribute in their personal settings"))
+
def title(self):
if self._new:
return _("Create User Attribute")
@@ -15792,6 +15806,23 @@ class ModeEditCustomHostAttr(ModeEditCustomAttr):
def _type(self):
return 'host'
+ @property
+ def _topics(self):
+ topics = list(set([ (a[1], a[1]) for a in watolib.all_host_attributes() if a[1] != None ]))
+ topics.insert(0, (_("Custom attributes"), _("Custom attributes")))
+ return topics
+
+ @property
+ def _macro_help(self):
+ return _("The attribute can be added to the host definition in order to "
+ "use it as monitoring macro in different places, for example "
+ "as macro in check commands or notifications.")
+
+ @property
+ def _macro_label(self):
+ return _("Make this variable available as monitoring macro, "
+ "e.g. in check commands or in notifications.")
+
def _update_config(self):
update_host_custom_attrs()