~ubuntu-branches/ubuntu/trusty/freeipa/trusty

« back to all changes in this revision

Viewing changes to ipaserver/install/plugins/baseupdate.py

  • Committer: Package Import Robot
  • Author(s): Timo Aaltonen
  • Date: 2013-03-07 14:10:03 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20130307141003-kz4lq9vj4x692mqq
Tags: 3.1.2-0ubuntu1
* Merge from unreleased debian git.
  - new upstream release
  - doesn't use chkconfig anymore (LP: #1025018, #1124093)
  - drop -U from the ntpdate options (LP: #1149468)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Authors:
 
2
#   Rob Crittenden <rcritten@redhat.com>
 
3
#
 
4
# Copyright (C) 2011  Red Hat
 
5
# see file 'COPYING' for use and warranty information
 
6
#
 
7
# This program is free software; you can redistribute it and/or modify
 
8
# it under the terms of the GNU General Public License as published by
 
9
# the Free Software Foundation, either version 3 of the License, or
 
10
# (at your option) any later version.
 
11
#
 
12
# This program is distributed in the hope that it will be useful,
 
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
# GNU General Public License for more details.
 
16
#
 
17
# You should have received a copy of the GNU General Public License
 
18
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
19
 
 
20
from ipalib import api
 
21
from ipalib import errors
 
22
from ipalib import Updater, Object
 
23
from ipaserver.install import service
 
24
from ipaserver.install.plugins import PRE_UPDATE, POST_UPDATE, MIDDLE
 
25
 
 
26
class DSRestart(service.Service):
 
27
    """
 
28
    Restart the 389-ds service.
 
29
    """
 
30
    def __init__(self):
 
31
        """
 
32
        This class is present to provide ldapupdate the means to
 
33
        restart 389-ds.
 
34
        """
 
35
        service.Service.__init__(self, "dirsrv")
 
36
 
 
37
    def start(self, instance_name="", capture_output=True, wait=True):
 
38
        """
 
39
        During upgrades the server is listening only on the socket so
 
40
        we don't want to wait on ports. The caller is responsible for
 
41
        waiting for the socket to be ready.
 
42
        """
 
43
        super(DSRestart, self).start(wait=False)
 
44
 
 
45
    def create_instance(self):
 
46
        self.step("stopping directory server", self.stop)
 
47
        self.step("starting directory server", self.start)
 
48
        self.start_creation(start_message="Restarting Directory server "
 
49
                            "to apply updates", show_service_name=False)
 
50
 
 
51
class update(Object):
 
52
    """
 
53
    Generic object used to register all updates into a single namespace.
 
54
    """
 
55
    backend_name = 'ldap2'
 
56
 
 
57
api.register(update)
 
58
 
 
59
class PreUpdate(Updater):
 
60
    """
 
61
    Base class for updates that run prior to file processing.
 
62
    """
 
63
    updatetype = PRE_UPDATE
 
64
    order = MIDDLE
 
65
 
 
66
    def __init__(self):
 
67
        super(PreUpdate, self).__init__()
 
68
 
 
69
class PostUpdate(Updater):
 
70
    """
 
71
    Base class for updates that run after file processing.
 
72
    """
 
73
    updatetype = POST_UPDATE
 
74
    order = MIDDLE
 
75
 
 
76
    def __init__(self):
 
77
        super(PostUpdate, self).__init__()