~ubuntu-branches/ubuntu/trusty/landscape-client/trusty

« back to all changes in this revision

Viewing changes to landscape/deployment.py

  • Committer: Package Import Robot
  • Author(s): Andreas Hasenack
  • Date: 2014-03-28 10:20:01 UTC
  • Revision ID: package-import@ubuntu.com-20140328102001-x229iltmzrpcc2gl
Tags: 14.01-0ubuntu3
landscape-sysinfo should ignore non existent or unreadable default
config files. (LP: #1293990)

Show diffs side-by-side

added added

removed removed

Lines of Context:
148
148
        """
149
149
        self.load(self._command_line_args)
150
150
 
151
 
    def load(self, args, accept_nonexistent_config=False):
 
151
    def load(self, args, accept_nonexistent_default_config=False):
152
152
        """
153
153
        Load configuration data from command line arguments and a config file.
154
154
 
 
155
        @param accept_nonexistent_default_config: If True, don't complain if
 
156
            default configuration files aren't found
 
157
 
155
158
        @raise: A SystemExit if the arguments are bad.
 
159
 
156
160
        """
157
161
        self.load_command_line(args)
158
162
 
159
163
        if self.config:
160
164
            config_filenames = [self.config]
 
165
            allow_missing = False
161
166
        else:
162
167
            config_filenames = self.default_config_filenames
 
168
            allow_missing = accept_nonexistent_default_config
163
169
        # Parse configuration file, if found.
164
170
        for config_filename in config_filenames:
165
171
            if (os.path.isfile(config_filename)
169
175
                break
170
176
 
171
177
        else:
172
 
            if not accept_nonexistent_config:
 
178
            if not allow_missing:
173
179
                if len(config_filenames) == 1:
174
180
                    message = (
175
181
                        "error: config file %s can't be read" %
402
408
 
403
409
        return parser
404
410
 
405
 
    def load(self, args, accept_nonexistent_config=False):
 
411
    def load(self, args):
406
412
        """
407
413
        Load configuration data from command line arguments and a config file.
408
414
        """
409
 
        super(Configuration, self).load(
410
 
            args, accept_nonexistent_config=accept_nonexistent_config)
 
415
        super(Configuration, self).load(args)
411
416
 
412
417
        if not isinstance(self.server_autodiscover, bool):
413
418
            autodiscover = str(self.server_autodiscover).lower()