Statistics
| Branch: | Tag: | Revision:

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

History | View | Annotate | Download (1.2 kB)

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

    
18

    
19
"""Example QA hook.
20

21
"""
22

    
23
from ganeti import utils
24

    
25
import qa_utils
26
import qa_config
27

    
28
from qa_utils import AssertEqual, StartSSH
29

    
30

    
31
class DateHook:
32
  def run(self, ctx):
33
    if ctx.name == 'cluster-init' and ctx.phase == 'pre':
34
      self._CallDate(ctx)
35

    
36
  def _CallDate(self, ctx):
37
    for node in qa_config.get('nodes'):
38
      cmd = ['date']
39
      AssertEqual(StartSSH(node['primary'],
40
                           utils.ShellQuoteArgs(cmd)).wait(), 0)
41

    
42
hook = DateHook