Merge lp://qastaging/~vbocek/ubuntu-system-image/support_http into lp://qastaging/~registry/ubuntu-system-image/client
Proposed by
Vojtech Bocek
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Barry Warsaw | ||||
Approved revision: | 242 | ||||
Merged at revision: | 241 | ||||
Proposed branch: | lp://qastaging/~vbocek/ubuntu-system-image/support_http | ||||
Merge into: | lp://qastaging/~registry/ubuntu-system-image/client | ||||
Diff against target: |
290 lines (+180/-11) 7 files modified
ini-manpage.rst (+4/-2) systemimage/bag.py (+8/-0) systemimage/config.py (+30/-9) systemimage/tests/data/config_05.ini (+36/-0) systemimage/tests/data/config_06.ini (+36/-0) systemimage/tests/data/config_07.ini (+36/-0) systemimage/tests/test_config.py (+30/-0) |
||||
To merge this branch: | bzr merge lp://qastaging/~vbocek/ubuntu-system-image/support_http | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Barry Warsaw (community) | Approve | ||
Review via email: mp+208242@code.qastaging.launchpad.net |
Description of the change
* Add support for "disabled" value in http_port and https_port config options, which disables that protocol.
* Support overriding of [system] section from channel.ini
- The tests are incomplete.
To post a comment you must log in.
Just a quick comment as I'm going through your branch.
=== modified file 'systemimage/ config. py' config. py 2014-02-13 18:16:17 +0000 config. py 2014-02-25 22:24:24 +0000 or(path) dict(http_ port=int, update( converters= dict(http_ port=port_ value_converter , port_value_ converter, 'service' ]) http_port is DISABLED_PROTOCOL and https_port is DISABLED_PROTOCOL): http_port == 80: 'http_base' ] = 'http://{}'.format( self.service. base) http_port is not DISABLED_PROTOCOL: 'http_base' ] = 'http://{}:{}'.format( http_port) https_port == 443: 'https_ base'] = 'https://{}'.format( self.service. base) http_port is not DISABLED_PROTOCOL: 'https_ base'] = 'https://{}:{}'.format( https_port) dict(timeout= as_timedelta, http_port is DISABLED_PROTOCOL: 'http_base' ] = self.service[ 'https_ base'] https_port is DISABLED_PROTOCOL: 'https_ base'] = self.service[ 'http_base' ] update( converters= dict(timeout= as_timedelta, expand_ path, as_loglevel, db=expand_ path, expand_ path),
--- systemimage/
+++ systemimage/
> @@ -64,32 +78,39 @@
> if files_read != [path]:
> raise FileNotFoundErr
> self.config_file = path
> - self.service = Bag(converters=
> - https_port=int,
> + self.service.
> + https_port=
> build_number=int),
> **parser[
> + if (self.service.
> + self.service.
> + raise ValueError('both http and https ports were disabled')
> # Construct the HTTP and HTTPS base urls, which most applications will
> # actually use.
> if self.service.
> self.service[
> - else:
> + elif self.service.
> self.service[
> self.service.base, self.service.
> if self.service.
> self.service[
> - else:
> + elif self.service.
> self.service[
> self.service.base, self.service.
> - # Short-circuit, since we're loading a channel.ini file.
> - self._override = override
> - if override:
> - return
> - self.system = Bag(converters=
> + if self.service.
> + self.service[
> + elif self.service.
> + self.service[
> + self.system.
> build_file=
> loglevel=
> settings_
> tempdir=
> **parser['system'])
The changes above are problematic because currently, Bags have the semantic
that their values cannot change after the initial setting. So updating as is
done here raises a ValueError. It's worse too because the test infrastructure
requires a Configuration object before any tests run (for unfortunate reasons
having to do with the D-Bus tests).
I'm not exactly sure of the best way to resolve this. I should probably just
remove this read-only restriction, since it's not really serving a useful
purpose.