~free.ekanayaka/landscape-client/lucid-1.5.2.1-0ubuntu0.10.04.0

« back to all changes in this revision

Viewing changes to landscape/broker/deployment.py

  • Committer: Bazaar Package Importer
  • Author(s): Mathias Gug, Free Ekanayaka
  • Date: 2009-07-22 14:54:50 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20090722145450-pvbp13gh8734c8ft
Tags: 1.3.2.2-0ubuntu0.9.10.1
[ Free Ekanayaka ]
* New upstream release:
  - Include the README file in landscape-client (LP: #396260)
  - Fix client capturing stderr from run_command when constructing
    hash-id-databases url (LP: #397480)
  - Use substvars to conditionally depend on update-motd or
    libpam-modules (LP: #393454)
  - Fix reporting wrong version to the server (LP: #391225)
  - The init script does not wait for the network to be available
    before checking for EC2 user data (LP: #383336)
  - When the broker is restarted by the watchdog, the state of the client
    is inconsistent (LP: #380633)
  - Package stays unknown forever in the client with hash-id-databases
    support (LP: #381356)
  - Standard error not captured when calling smart-update (LP: #387441)
  - Changer calls reporter without switching groups, just user (LP: #388092)
  - Run smart update in the package-reporter instead of having a cronjob (LP: #362355)
  - Package changer does not inherit proxy settings (LP: #381241)
  - The ./test script doesn't work in landscape-client (LP: #381613)
  - The source package should build on all supported releases (LP: #385098)
  - Strip smart update's output (LP: #387331)
  - The fetch() timeout isn't based on activity (#389224)
  - Client can use a UUID of "None" when fetching the hash-id-database (LP: #381291)
  - Registration should use the fqdn rather than just the hostname (LP: #385730)

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
 
15
15
 
16
16
class BrokerConfiguration(Configuration):
17
 
    """Specialized configuration for the Landscape Broker."""
 
17
    """Specialized configuration for the Landscape Broker.
 
18
 
 
19
    @cvar required_options: C{["url"]}
 
20
    """
18
21
 
19
22
    required_options = ["url"]
20
23
 
24
27
        self._original_https_proxy = os.environ.get("https_proxy")
25
28
 
26
29
    def make_parser(self):
27
 
        """
28
 
        Specialize L{Configuration.make_parser}, adding many
29
 
        broker-specific options.
 
30
        """Parser factory for broker-specific options.
 
31
 
 
32
        @return: An L{OptionParser} preset for all the options
 
33
            from L{Configuration.make_parser} plus:
 
34
              - C{account_name}
 
35
              - C{registration_password}
 
36
              - C{computer_title}
 
37
              - C{url}
 
38
              - C{ssl_public_key}
 
39
              - C{exchange_interval} (C{15*60})
 
40
              - C{urgent_exchange_interval} (C{1*60})
 
41
              - C{ping_url}
 
42
              - C{http_proxy}
 
43
              - C{https_proxy}
 
44
              - C{cloud}
30
45
        """
31
46
        parser = super(BrokerConfiguration, self).make_parser()
32
47
 
63
78
 
64
79
    @property
65
80
    def message_store_path(self):
 
81
        """Get the path to the message store."""
66
82
        return os.path.join(self.data_path, "messages")
67
83
 
68
84
    def load(self, args, accept_nonexistent_config=False):
69
85
        """
 
86
        Load options from command line arguments and a config file.
 
87
 
70
88
        Load the configuration with L{Configuration.load}, and then set
71
 
        http_proxy and https_proxy environment variables based on that config
72
 
        data.
 
89
        C{http_proxy} and C{https_proxy} environment variables based on
 
90
        that config data.
73
91
        """
74
92
        super(BrokerConfiguration, self).load(
75
93
            args, accept_nonexistent_config=accept_nonexistent_config)
85
103
 
86
104
 
87
105
class BrokerService(LandscapeService):
88
 
    """
89
 
    The core Twisted Service which creates and runs all necessary
90
 
    components when started.
 
106
    """The core C{Service} of the Landscape Broker C{Application}.
 
107
 
 
108
    The Landscape broker service handles all the communication between the
 
109
    client and server. When started it creates and runs all necessary components
 
110
    to exchange messages with the Landscape server.
 
111
 
 
112
    @ivar persist_filename: Path to broker-specific persisted data.
 
113
    @ivar persist: A L{Persist} object saving and loading from
 
114
        C{self.persist_filename}.
 
115
    @ivar message_store: A L{MessageStore} used by the C{exchanger} to
 
116
        queue outgoing messages.
 
117
    @ivar transport: A L{HTTPTransport} used by the C{exchanger} to deliver messages.
 
118
    @ivar identity: The L{Identity} of the Landscape client the broker runs on.
 
119
    @ivar exchanger: The L{MessageExchange} exchanges messages with the server.
 
120
    @ivar pinger: The L{Pinger} checks if the server has new messages for us.
 
121
    @ivar registration: The L{RegistrationHandler} performs the initial
 
122
        registration.
 
123
 
 
124
    @cvar service_name: C{"broker"}
91
125
    """
92
126
 
93
127
    transport_factory = HTTPTransport
94
128
    service_name = "broker"
95
129
 
96
130
    def __init__(self, config):
 
131
        """
 
132
        @param config: a L{BrokerConfiguration}.
 
133
        """
97
134
        self.persist_filename = os.path.join(
98
135
            config.data_path, "%s.bpickle" % (self.service_name,))
99
136
        super(BrokerService, self).__init__(config)
128
165
        reactor.stop()
129
166
 
130
167
    def startService(self):
131
 
        """
132
 
        Set up the persist, message store, transport, reactor, and
133
 
        dbus message exchange service.
 
168
        """Start the broker.
 
169
 
 
170
        Create the DBus-published L{BrokerDBusObject}, and start
 
171
        the L{MessageExchange} and L{Pinger} services.
134
172
 
135
173
        If the configuration specifies the bus as 'session', the DBUS
136
174
        message exchange service will use the DBUS Session Bus.