]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-disk: fix activate() indent
authorLoic Dachary <loic@dachary.org>
Mon, 30 Dec 2013 16:11:30 +0000 (17:11 +0100)
committerAlfredo Deza <alfredo@deza.pe>
Wed, 12 Feb 2014 21:17:11 +0000 (16:17 -0500)
Signed-off-by: Loic Dachary <loic@dachary.org>
(cherry picked from commit 324804a81c37ff89f2488e2ba106033c0e6e119e)

src/ceph-disk

index 4edf842af4a7e923c8c864df6d8d85071b4fe0f3..a1a89b51d5feb3d17b1da44070aa3546e5e0b9ef 100755 (executable)
@@ -1722,84 +1722,84 @@ def activate(
     init,
     ):
 
-        check_osd_magic(path)
+    check_osd_magic(path)
 
-        ceph_fsid = read_one_line(path, 'ceph_fsid')
-        if ceph_fsid is None:
-            raise Error('No cluster uuid assigned.')
-        LOG.debug('Cluster uuid is %s', ceph_fsid)
+    ceph_fsid = read_one_line(path, 'ceph_fsid')
+    if ceph_fsid is None:
+        raise Error('No cluster uuid assigned.')
+    LOG.debug('Cluster uuid is %s', ceph_fsid)
 
-        cluster = find_cluster_by_uuid(ceph_fsid)
-        if cluster is None:
-            raise Error('No cluster conf found in /etc/ceph with fsid %s' % ceph_fsid)
-        LOG.debug('Cluster name is %s', cluster)
+    cluster = find_cluster_by_uuid(ceph_fsid)
+    if cluster is None:
+        raise Error('No cluster conf found in /etc/ceph with fsid %s' % ceph_fsid)
+    LOG.debug('Cluster name is %s', cluster)
 
-        fsid = read_one_line(path, 'fsid')
-        if fsid is None:
-            raise Error('No OSD uuid assigned.')
-        LOG.debug('OSD uuid is %s', fsid)
+    fsid = read_one_line(path, 'fsid')
+    if fsid is None:
+        raise Error('No OSD uuid assigned.')
+    LOG.debug('OSD uuid is %s', fsid)
 
-        keyring = activate_key_template.format(cluster=cluster)
+    keyring = activate_key_template.format(cluster=cluster)
 
-        osd_id = get_osd_id(path)
-        if osd_id is None:
-            osd_id = allocate_osd_id(
-                cluster=cluster,
-                fsid=fsid,
-                keyring=keyring,
-                )
-            write_one_line(path, 'whoami', osd_id)
-        LOG.debug('OSD id is %s', osd_id)
+    osd_id = get_osd_id(path)
+    if osd_id is None:
+        osd_id = allocate_osd_id(
+            cluster=cluster,
+            fsid=fsid,
+            keyring=keyring,
+            )
+        write_one_line(path, 'whoami', osd_id)
+    LOG.debug('OSD id is %s', osd_id)
+
+    if not os.path.exists(os.path.join(path, 'ready')):
+        LOG.debug('Initializing OSD...')
+        # re-running mkfs is safe, so just run until it completes
+        mkfs(
+            path=path,
+            cluster=cluster,
+            osd_id=osd_id,
+            fsid=fsid,
+            keyring=keyring,
+            )
 
-        if not os.path.exists(os.path.join(path, 'ready')):
-            LOG.debug('Initializing OSD...')
-            # re-running mkfs is safe, so just run until it completes
-            mkfs(
-                path=path,
+    if init is not None:
+        if init == 'auto':
+            conf_val = get_conf(
                 cluster=cluster,
-                osd_id=osd_id,
-                fsid=fsid,
-                keyring=keyring,
+                variable='init'
                 )
-
-        if init is not None:
-            if init == 'auto':
-                conf_val = get_conf(
-                    cluster=cluster,
-                    variable='init'
-                    )
-                if conf_val is not None:
-                    init = conf_val
+            if conf_val is not None:
+                init = conf_val
+            else:
+                (distro, release, codename) = platform.dist()
+                if distro == 'Ubuntu':
+                    init = 'upstart'
                 else:
-                    (distro, release, codename) = platform.dist()
-                    if distro == 'Ubuntu':
-                        init = 'upstart'
-                    else:
-                        init = 'sysvinit'
-
-            LOG.debug('Marking with init system %s', init)
-            with file(os.path.join(path, init), 'w'):
-                pass
+                    init = 'sysvinit'
 
-            # remove markers for others, just in case.
-            for other in INIT_SYSTEMS:
-                if other != init:
-                    try:
-                        os.unlink(os.path.join(path, other))
-                    except OSError:
-                        pass
+        LOG.debug('Marking with init system %s', init)
+        with file(os.path.join(path, init), 'w'):
+            pass
 
-        if not os.path.exists(os.path.join(path, 'active')):
-            LOG.debug('Authorizing OSD key...')
-            auth_key(
-                path=path,
-                cluster=cluster,
-                osd_id=osd_id,
-                keyring=keyring,
-                )
-            write_one_line(path, 'active', 'ok')
-        LOG.debug('%s osd.%s data dir is ready at %s', cluster, osd_id, path)
-        return (osd_id, cluster)
+        # remove markers for others, just in case.
+        for other in INIT_SYSTEMS:
+            if other != init:
+                try:
+                    os.unlink(os.path.join(path, other))
+                except OSError:
+                    pass
+
+    if not os.path.exists(os.path.join(path, 'active')):
+        LOG.debug('Authorizing OSD key...')
+        auth_key(
+            path=path,
+            cluster=cluster,
+            osd_id=osd_id,
+            keyring=keyring,
+            )
+        write_one_line(path, 'active', 'ok')
+    LOG.debug('%s osd.%s data dir is ready at %s', cluster, osd_id, path)
+    return (osd_id, cluster)
 
 
 def main_activate(args):