4 # Copyright (C) 2006, 2007, 2010 Google Inc.
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22 """Module implementing a fake ConfigWriter"""
24 from ganeti import utils
25 from ganeti import netutils
28 FAKE_CLUSTER_KEY = ("AAAAB3NzaC1yc2EAAAABIwAAAQEAsuGLw70et3eApJ/ZEJkAVZogIrm"
29 "EYPQJvb1ll52Ti0nr80Wztxibaa8bYGzY22rQIAloIlePeTGcJceAYK"
30 "PZgm0I/Mp2EUGg2NVsQZIzasz6cW0vYuiUbF9GkVlROmvOAykT58RfM"
31 "L8RhPrjrQxZc+NXgZtgDugYSZcXHDLUyWM1xKUoYy0MqYG6ZXCC/Zno"
32 "RThhmjOJgEmvwrMcTWQjmzH3NeJAxaBsEHR8tiVZ/Y23C/ULWLyNT6R"
33 "fB+DE7IovsMQaS+83AK1Teg7RWNyQczachatf/JT8VjUqFYjJepPjMb"
34 "vYdB2nQds7/+Bf40C/OpbvnAxna1kVtgFHAo18cQ==")
38 """Fake configuration object"""
43 def GetNodeList(self):
44 return ["a", "b", "c"]
47 return FAKE_CLUSTER_KEY
49 def GetClusterName(self):
52 def GetMasterNode(self):
53 return netutils.Hostname.GetSysName()
55 def GetDefaultIAllocator(Self):
56 return "testallocator"
60 """Fake processor object"""
62 def Log(self, msg, *args, **kwargs):
65 def LogWarning(self, msg, *args, **kwargs):
68 def LogInfo(self, msg, *args, **kwargs):
71 def LogStep(self, current, total, message):
76 """Fake context object"""
79 self.cfg = FakeConfig()
80 # TODO: decide what features a mock Ganeti Lock Manager must have