some versions of bind require serial < 2^32 so use _seconds_ since epoch
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-library/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-library/commit/54db83d5 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-library/tree/54db83d5 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-library/diff/54db83d5 Branch: refs/heads/master Commit: 54db83d593deaad756df154d037e232110c7fa64 Parents: 911ba55 Author: Alex Heneveld <alex.henev...@cloudsoftcorp.com> Authored: Wed Aug 24 15:37:10 2016 +0100 Committer: Alex Heneveld <alex.henev...@cloudsoftcorp.com> Committed: Wed Aug 24 15:37:10 2016 +0100 ---------------------------------------------------------------------- .../apache/brooklyn/entity/network/bind/BindDnsServer.java | 1 + .../brooklyn/entity/network/bind/BindDnsServerImpl.java | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/54db83d5/software/network/src/main/java/org/apache/brooklyn/entity/network/bind/BindDnsServer.java ---------------------------------------------------------------------- diff --git a/software/network/src/main/java/org/apache/brooklyn/entity/network/bind/BindDnsServer.java b/software/network/src/main/java/org/apache/brooklyn/entity/network/bind/BindDnsServer.java index f5b5e21..54754cb 100644 --- a/software/network/src/main/java/org/apache/brooklyn/entity/network/bind/BindDnsServer.java +++ b/software/network/src/main/java/org/apache/brooklyn/entity/network/bind/BindDnsServer.java @@ -135,6 +135,7 @@ public interface BindDnsServer extends SoftwareProcess { "bind.records.ptr", "All PTR records for the server, in form address -> name. Entries will be in REVERSE_LOOKUP_CIDR. " + "Entries are guaranteed to have an inverse mapping in A_RECORDS."); + // NB must be less than 2^32, so just larger than Integer; we use current time mills / 1000 AttributeSensor<Long> SERIAL = Sensors.newLongSensor( "bind.serial", "A serial number guaranteed to be valid for use in a modified domain.zone or reverse.zone file"); http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/54db83d5/software/network/src/main/java/org/apache/brooklyn/entity/network/bind/BindDnsServerImpl.java ---------------------------------------------------------------------- diff --git a/software/network/src/main/java/org/apache/brooklyn/entity/network/bind/BindDnsServerImpl.java b/software/network/src/main/java/org/apache/brooklyn/entity/network/bind/BindDnsServerImpl.java index 2ee89e2..834a371 100644 --- a/software/network/src/main/java/org/apache/brooklyn/entity/network/bind/BindDnsServerImpl.java +++ b/software/network/src/main/java/org/apache/brooklyn/entity/network/bind/BindDnsServerImpl.java @@ -112,7 +112,7 @@ public class BindDnsServerImpl extends SoftwareProcessImpl implements BindDnsSer sensors().set(PTR_RECORDS, ImmutableMap.<String, String>of()); sensors().set(ADDRESS_MAPPINGS, ImmutableMultimap.<String, String>of()); synchronized (serialMutex) { - sensors().set(SERIAL, System.currentTimeMillis()); + sensors().set(SERIAL, System.currentTimeMillis() / 1000); } } @@ -298,7 +298,12 @@ public class BindDnsServerImpl extends SoftwareProcessImpl implements BindDnsSer } /** - * @return A serial number guaranteed to be valid for use in a modified domain.zone or reverse.zone file. + * Increments the serial number sensor and returns it. + * Increment is so that it is guaranteed to be valid for use in a + * modified domain.zone or reverse.zone file. + * <p> + * The side-effect is not entirely obvious by the method name but it + * makes it easier to use from the freemarker templates which call it! */ public long getSerial() { synchronized (serialMutex) {