This file is indexed.

/usr/lib/python2.7/dist-packages/ocfs2interface/pushconfig.py is in ocfs2console 1.6.4-3.1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# OCFS2Console - GUI frontend for OCFS2 management and debugging
# Copyright (C) 2005 Oracle.  All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 021110-1307, USA.

import socket

import gtk

import o2cb_ctl

from guiutil import error_box

from terminal import TerminalDialog, terminal_ok as pushconfig_ok

CONFIG_FILE = '/etc/ocfs2/cluster.conf'

command_template = '''set -e
mkdir -p /etc/ocfs2
cat > /etc/ocfs2/cluster.conf <<\_______EOF
%(cluster_config)s
_______EOF
#/etc/init.d/o2cb online %(cluster_name)s
'''

def get_hosts(parent=None):
    hostname = socket.gethostname()

    cluster_name = o2cb_ctl.get_active_cluster_name(parent)

    nodes = o2cb_ctl.get_cluster_nodes(cluster_name, parent)

    remote_nodes = [node['name'] for node in nodes if node['name'] != hostname]

    return cluster_name, remote_nodes

def generate_command(cluster_name):
    conf_file = open(CONFIG_FILE)
    config_data = conf_file.read()
    conf_file.close()

    if config_data.endswith('\n'):
        config_data = config_data[:-1]

    info = {'cluster_config' : config_data,
            'cluster_name'   : cluster_name}

    return command_template % info

def propagate(terminal, dialog, remote_command, host_iter):
    try:
        host = host_iter.next()
    except StopIteration:
        terminal.feed('Finished!\r\n', -1)
        dialog.finished = True
        return

    command = ('ssh', 'root@%s' % host, remote_command)

    terminal.feed('Propagating cluster configuration to %s...\r\n' % host, -1)
    terminal.fork_command(command=command[0], argv=command)

def push_config(parent=None):
    try:
        cluster_name, hosts = get_hosts(parent)
    except o2cb_ctl.CtlError, e:
        error_box(parent, str(e))
        return

    try:
        command = generate_command(cluster_name)
    except IOError, e:
        error_box(parent, str(e))
        return

    title = 'Propagate Cluster Configuration'

    dialog = TerminalDialog(parent=parent, title=title)
    terminal = dialog.terminal

    dialog.finished = False
    dialog.show_all()

    host_iter = iter(hosts)
    terminal.connect('child-exited', propagate, dialog, command, host_iter)

    propagate(terminal, dialog, command, host_iter)

    while 1:
        dialog.run()

        if dialog.finished:
            break

        msg = ('Cluster configuration propagation is still running. You '
               'should not close this window until it is finished')

        info = gtk.MessageDialog(parent=dialog,
                                 flags=gtk.DIALOG_DESTROY_WITH_PARENT,
                                 type=gtk.MESSAGE_WARNING,
                                 buttons=gtk.BUTTONS_CLOSE,
                                 message_format=msg)
        info.run()
        info.destroy()
 
    dialog.destroy()

def main():
    push_config()

if __name__ == '__main__':
    main()