Statistics
| Branch: | Tag: | Revision:

root / qa / hooks / datehook.py @ 663ed0ce

History | View | Annotate | Download (1.2 kB)

1 663ed0ce Michael Hanselmann
# Copyright (C) 2007 Google Inc.
2 663ed0ce Michael Hanselmann
#
3 663ed0ce Michael Hanselmann
# This program is free software; you can redistribute it and/or modify
4 663ed0ce Michael Hanselmann
# it under the terms of the GNU General Public License as published by
5 663ed0ce Michael Hanselmann
# the Free Software Foundation; either version 2 of the License, or
6 663ed0ce Michael Hanselmann
# (at your option) any later version.
7 663ed0ce Michael Hanselmann
#
8 663ed0ce Michael Hanselmann
# This program is distributed in the hope that it will be useful, but
9 663ed0ce Michael Hanselmann
# WITHOUT ANY WARRANTY; without even the implied warranty of
10 663ed0ce Michael Hanselmann
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 663ed0ce Michael Hanselmann
# General Public License for more details.
12 663ed0ce Michael Hanselmann
#
13 663ed0ce Michael Hanselmann
# You should have received a copy of the GNU General Public License
14 663ed0ce Michael Hanselmann
# along with this program; if not, write to the Free Software
15 663ed0ce Michael Hanselmann
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
16 663ed0ce Michael Hanselmann
# 02110-1301, USA.
17 663ed0ce Michael Hanselmann
18 663ed0ce Michael Hanselmann
19 663ed0ce Michael Hanselmann
"""Example QA hook.
20 663ed0ce Michael Hanselmann

21 663ed0ce Michael Hanselmann
"""
22 663ed0ce Michael Hanselmann
23 663ed0ce Michael Hanselmann
from ganeti import utils
24 663ed0ce Michael Hanselmann
25 663ed0ce Michael Hanselmann
import qa_utils
26 663ed0ce Michael Hanselmann
import qa_config
27 663ed0ce Michael Hanselmann
28 663ed0ce Michael Hanselmann
from qa_utils import AssertEqual, StartSSH
29 663ed0ce Michael Hanselmann
30 663ed0ce Michael Hanselmann
31 663ed0ce Michael Hanselmann
class DateHook:
32 663ed0ce Michael Hanselmann
  def run(self, ctx):
33 663ed0ce Michael Hanselmann
    if ctx.name == 'cluster-init' and ctx.phase == 'pre':
34 663ed0ce Michael Hanselmann
      self._CallDate(ctx)
35 663ed0ce Michael Hanselmann
36 663ed0ce Michael Hanselmann
  def _CallDate(self, ctx):
37 663ed0ce Michael Hanselmann
    for node in qa_config.get('nodes'):
38 663ed0ce Michael Hanselmann
      cmd = ['date']
39 663ed0ce Michael Hanselmann
      AssertEqual(StartSSH(node['primary'],
40 663ed0ce Michael Hanselmann
                           utils.ShellQuoteArgs(cmd)).wait(), 0)
41 663ed0ce Michael Hanselmann
42 663ed0ce Michael Hanselmann
hook = DateHook