Revision 56bece1f

b/lib/ssh.py
71 71
  """Wrapper for SSH commands.
72 72

  
73 73
  """
74
  def __init__(self, cfg):
75
    self.cfg = cfg
74
  def __init__(self, cluster_name):
75
    self.cluster_name = cluster_name
76 76

  
77 77
  def _BuildSshOptions(self, batch, ask_key, use_cluster_key,
78 78
                       strict_host_check):
......
84 84
      ]
85 85

  
86 86
    if use_cluster_key:
87
      options.append("-oHostKeyAlias=%s" % self.cfg.GetClusterName())
87
      options.append("-oHostKeyAlias=%s" % self.cluster_name)
88 88

  
89 89
    # TODO: Too many boolean options, maybe convert them to more descriptive
90 90
    # constants.
b/scripts/gnt-cluster
160 160
    nodes - list containing the name of target nodes; if empty, all nodes
161 161

  
162 162
  """
163
  # TODO: Query master
164
  cfg = ssconf.SimpleConfigReader()
165

  
166 163
  filename = args[0]
167 164
  if not os.path.exists(filename):
168 165
    raise errors.OpPrereqError("No such filename '%s'" % filename)
169 166

  
167
  cl = GetClient()
168

  
170 169
  myname = utils.HostInfo().name
171 170

  
171
  cluster_name = cl.QueryConfigValues(["cluster_name"])[0]
172

  
172 173
  op = opcodes.OpQueryNodes(output_fields=["name"], names=opts.nodes)
173
  results = [row[0] for row in SubmitOpCode(op) if row[0] != myname]
174
  results = [row[0] for row in SubmitOpCode(op, cl=cl) if row[0] != myname]
174 175

  
175
  # TODO: Potential inconsistency between local node and master
176
  srun = ssh.SshRunner(cfg)
176
  srun = ssh.SshRunner(cluster_name=cluster_name)
177 177
  for node in results:
178 178
    if not srun.CopyFileToNode(node, filename):
179 179
      print >> sys.stderr, ("Copy of file %s to node %s failed" %
......
192 192
    nodes: list containing the name of target nodes; if empty, all nodes
193 193

  
194 194
  """
195
  # TODO: Query master
196
  cfg = ssconf.SimpleConfigReader()
195
  cl = GetClient()
197 196

  
198 197
  command = " ".join(args)
199 198
  op = opcodes.OpQueryNodes(output_fields=["name"], names=opts.nodes)
200
  nodes = [row[0] for row in SubmitOpCode(op)]
199
  nodes = [row[0] for row in SubmitOpCode(op, cl=cl)]
200

  
201
  cluster_name, master_node = cl.QueryConfigValues(["cluster_name",
202
                                                    "master_node"])
201 203

  
202
  # TODO: Potential inconsistency between local node and master
203
  master_node = cfg.GetMasterNode()
204
  srun = ssh.SshRunner(cfg)
204
  srun = ssh.SshRunner(cluster_name=cluster_name)
205 205

  
206 206
  # Make sure master node is at list end
207 207
  if master_node in nodes:

Also available in: Unified diff