Merge lp://staging/~tealeg/landscape-client/use-configobj into lp://staging/~landscape/landscape-client/trunk

Proposed by Geoff Teale
Status: Merged
Approved by: Geoff Teale
Approved revision: 729
Merged at revision: 723
Proposed branch: lp://staging/~tealeg/landscape-client/use-configobj
Merge into: lp://staging/~landscape/landscape-client/trunk
Diff against target: 351 lines (+110/-37)
7 files modified
debian/control (+1/-0)
landscape/broker/tests/test_server.py (+5/-1)
landscape/configuration.py (+11/-8)
landscape/deployment.py (+42/-16)
landscape/tests/test_configuration.py (+11/-4)
landscape/tests/test_deployment.py (+37/-0)
landscape/ui/model/configuration/tests/test_mechanism.py (+3/-8)
To merge this branch: bzr merge lp://staging/~tealeg/landscape-client/use-configobj
Reviewer Review Type Date Requested Status
Chris Glass (community) Approve
Free Ekanayaka (community) Approve
Review via email: mp+184802@code.staging.launchpad.net

Commit message

This branch does a minimal conversion of the landscape-client config
system to use ConfigObj instead of ConfigParser, which fixes the issue
of trashing any comments in the configuration file when we make
updates to it (ConfigParser simply ignores comments at read time, and
is not capable of writing them).

Description of the change

This branch does a minimal conversion of the landscape-client config system to use ConfigObj instead of ConfigParser, which fixes the issue of trashing any comments in the configuration file when we make updates to it (ConfigParser simply ignores comments at read time, and is not capable of writing them).

To post a comment you must log in.
Revision history for this message
Free Ekanayaka (free.ekanayaka) wrote :

Looks good! +1

[1]

+from configobj import ConfigObj

We need to add a Depends entry for this in debian/control (and check that it's available and on all supported releases).

[2]

+ def get_config_object(self, config_source=None):

Please add a docstring and make this private, since it's not meant to be used by calling code.

[3]

+ if config_source:
+ config_obj = ConfigObj(config_source)
+ else:
+ config_obj = ConfigObj(self.get_config_filename())

Please prefer removing code duplication when instantiating objects, e.g.:

filename = config_source or self.get_config_filename()
config_obj = ConfigObj(filename)

or:

if config_source is not None:
    filename = config_source
else:
    filename = self.get_config_filename()
config_obj = ConfigObj(filename)

review: Approve
Revision history for this message
Geoff Teale (tealeg) wrote :

> Looks good! +1
>
> [1]
>
> +from configobj import ConfigObj
>
> We need to add a Depends entry for this in debian/control (and check that it's
> available and on all supported releases).

Done.

>
> [2]
>
> + def get_config_object(self, config_source=None):
>
> Please add a docstring and make this private, since it's not meant to be used
> by calling code.

Done.

>
> [3]
>
> + if config_source:
> + config_obj = ConfigObj(config_source)
> + else:
> + config_obj = ConfigObj(self.get_config_filename())
>
> Please prefer removing code duplication when instantiating objects, e.g.:
>
> filename = config_source or self.get_config_filename()
> config_obj = ConfigObj(filename)
>
> or:
>
> if config_source is not None:
> filename = config_source
> else:
> filename = self.get_config_filename()
> config_obj = ConfigObj(filename)

Done

Revision history for this message
Chris Glass (tribaal) wrote :

Looks good! +1

review: Approve
Revision history for this message
🤖 Landscape Builder (landscape-builder) wrote :
Download full text (194.0 KiB)

The attempt to merge lp:~tealeg/landscape-client/use-configobj into lp:landscape-client failed. Below is the output from the failed tests.

python setup.py build_ext -i
running build_ext
landscape.broker.tests.test_amp
  RemoteBrokerTest
    test_call_if_accepted ... [OK]
    test_call_if_accepted_with_not_accepted ... [OK]
    test_call_on_events ... [OK]
    test_exit ... [OK]
    test_fire_event ... [OK]
    test_get_accepted_message_types ... [OK]
    test_get_server_uuid ... [OK]
    test_is_message_pending ... [OK]
    test_listen_events ... [OK]
    test_method_call_error ... [OK]
    test_ping ... [OK]
    test_register ... [OK]
    test_register_client ... [OK]
    test_register_client_accepted_message_type ... [OK]
    test_reload_configuration ... [OK]
    test_send_message ... [OK]
    test_send_message_with_urgent ... [OK]
    test_stop_clients ... [OK]
  RemoteClientTest
    test_exit ... [OK]
    test_fire_event ... [OK]
    test_message ... [OK]
    test_method_call_error ... [OK]
    test_ping ... [OK]
landscape.broker.tests.test_client
  BrokerClientTest
    test_add ... [OK]
    test_dispatch_message ... [OK]
    test_dispatch_message_with_exception ... [OK]
    test_dispatch_message_with_no_handler ... [OK]
    test_exchange ... [OK]
    test_exchange_logs_errors_and_continues ... [OK]
    test_exchange_on_plugin_without_exchange_method ... [OK]
    test_exit ... [OK]
    test_fire_event ... [OK]
    test_fire_event_with_acceptance_changed ... [OK]
    test_fire_event_with_arguments ... [OK]
    test_fire_event_with_mixed_results ... [OK]
    test_get_named_plugin ... [OK]
    test_...

729. By Geoff Teale

Fix up failing landscape-client-ui tests that were skipped, but thankfully picked up by Tarmac! *yay tarmac*

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches

to all changes: