Project

General

Profile

Fix #10906

pushing config results in obscure error reporting

Added by Alfredo Deza about 9 years ago.

Status:
New
Priority:
Normal
Assignee:
Travis Rhoden
Target version:
-
% Done:

0%

Source:
other
Tags:
Backport:
Reviewed:
Affected Versions:
ceph-qa-suite:
Crash signature (v1):
Crash signature (v2):

Description

Attempting to copy a ceph.conf config to a remote host with `ceph-deploy config push` results in an error
that doesn't really reports what is the problem:

$ ceph-deploy --overwrite-conf config push magna121
[ceph_deploy.conf][DEBUG ] found configuration file at: /home/ubuntu/.cephdeploy.conf
[ceph_deploy.cli][INFO  ] Invoked (1.5.21): /usr/bin/ceph-deploy --overwrite-conf config push magna121
[ceph_deploy.config][DEBUG ] Pushing config to magna121
[magna121][DEBUG ] connection detected need for sudo
[magna121][DEBUG ] connected to host: magna121
[magna121][DEBUG ] detect platform information from remote host
[magna121][DEBUG ] detect machine type
[magna121][DEBUG ] write cluster configuration to /etc/ceph/{cluster}.conf
[ceph_deploy.config][ERROR ] OSError: [Errno 2] No such file or directory: '/etc/ceph/tmp2j5q6d'
[ceph_deploy][ERROR ] GenericError: Failed to config 1 hosts

The problem here is that this node does not have an /etc/ceph directory (no idea why, but the function in ceph-deploy
that does the work assumes that the directory exists to create the temporary file before writing to it:

def write_conf(cluster, conf, overwrite):
    """ write cluster configuration to /etc/ceph/{cluster}.conf """ 
    path = '/etc/ceph/{cluster}.conf'.format(cluster=cluster)
    tmp_file = tempfile.NamedTemporaryFile(dir='/etc/ceph', delete=False)
    err_msg = 'config file %s exists with different content; use --overwrite-conf to overwrite' % path

    if os.path.exists(path):
        with file(path, 'rb') as f:

The fix is double pronged:

  • ensure the directory exists
  • report nicely with something that makes sense (vs. "Failed to config 1 hosts")

Also available in: Atom PDF