summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Brown <ben.brown@codethink.co.uk>2015-12-09 16:49:20 +0000
committerPedro Alvarez <pedro.alvarez@codethink.co.uk>2015-12-15 11:34:51 +0000
commit0ce1059bf31f9a4b37de5424d8bde4543976353b (patch)
tree87c52bf95408b64c7718f79674726a8caced2039
parent8ffdca7ec095f73f7527e2756fe732ae8bef231a (diff)
downloadlorry-controller-0ce1059bf31f9a4b37de5424d8bde4543976353b.tar.gz
Add IMPLEMENTS for the removal of a field in a `troves` section
Change-Id: I42fbb8a2f2150cfbc48e07340ecedea76f41639a
-rw-r--r--yarns.webapp/900-implementations.yarn21
1 files changed, 21 insertions, 0 deletions
diff --git a/yarns.webapp/900-implementations.yarn b/yarns.webapp/900-implementations.yarn
index 6e0b380..24dcf51 100644
--- a/yarns.webapp/900-implementations.yarn
+++ b/yarns.webapp/900-implementations.yarn
@@ -178,6 +178,27 @@ Set a specific field for a `troves` section.
yarnlib.dump_json_to_file(obj, filename)
'
+Remove a specified field for a `troves` section
+
+ IMPLEMENTS GIVEN (\S+) in (\S+) removes field (\S+) from trove (\S+)
+ cd "$SRCDIR"/yarns.webapp
+ python -c '
+ import os
+ import yarnlib
+
+ MATCH_1, MATCH_2, MATCH_3, MATCH_4 = yarnlib.matches()
+
+ filename = os.path.join(yarnlib.DATADIR, MATCH_2, MATCH_1)
+ obj = yarnlib.load_json_from_file(filename)
+
+ for section in obj:
+ if section["type"] in ["trove", "troves"]:
+ if section["trovehost"] == MATCH_4:
+ del section[MATCH_3]
+
+ yarnlib.dump_json_to_file(obj, filename)
+ '
+
Set the prefixmap for a Trove in a Lorry Controller configuration
file. Note that the Trove must already be in the configuration file.