~billy-olsen/maas/lp1484696-proxypass-websockets-1.9

« back to all changes in this revision

Viewing changes to src/maasserver/management/commands/_config.py

[r=allenap][bug=1524007][author=allenap] Backport of r4551 from lp:maas: By default, open configuration files read-only.

This eliminates the need for locking when using the YAML-based back-end.

Show diffs side-by-side

added added

removed removed

Lines of Context:
197
197
    help = "Reset local configuration for the MAAS region controller."
198
198
 
199
199
    def handle(self, *args, **options):
200
 
        with RegionConfiguration.open() as config:
 
200
        with RegionConfiguration.open_for_update() as config:
201
201
            for name, option in gen_configuration_options():
202
202
                if options.get(name):
203
203
                    delattr(config, name)
213
213
    help = "Set local configuration for the MAAS region controller."
214
214
 
215
215
    def handle(self, *args, **options):
216
 
        with RegionConfiguration.open() as config:
 
216
        with RegionConfiguration.open_for_update() as config:
217
217
            for name, option in gen_configuration_options():
218
218
                value = options.get(name)
219
219
                if value is not None: