[Pkg-puppet-devel] [facter] 103/352: (fact-79) Convert ip and mac addreses to use a regex

Stig Sandbeck Mathisen ssm at debian.org
Sun Apr 6 22:21:36 UTC 2014


This is an automated email from the git hooks/post-receive script.

ssm pushed a commit to branch master
in repository facter.

commit 9876059f67ae3af3202646fe2b685f52c99cbde7
Author: Kylo Ginsberg <kylo at puppetlabs.com>
Date:   Sat Dec 21 22:18:45 2013 -0800

    (fact-79) Convert ip and mac addreses to use a regex
---
 schema/facter.json | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/schema/facter.json b/schema/facter.json
index bb8b299..05ff0c8 100644
--- a/schema/facter.json
+++ b/schema/facter.json
@@ -4,16 +4,26 @@
     "description": "All the built-in facts for facter cross-platform",
     "type":        "object",
     "additionalProperties": false,
+    "definitions": {
+         "ipaddress" : {
+             "type": "string",
+             "pattern" : "^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$"
+         },
+        "macaddress" : {
+            "type": "string",
+            "pattern" : "^(([0-9a-fA-F]){2}\:){5}([0-9a-fA-F]){2}$"
+        }
+    },
     "patternProperties": {
         "^blockdevice_[A-Za-z0-9]+_size$" : { "type": "integer" },
         "^blockdevice_[A-Za-z0-9]+_vendor$" : { "type": "string" },
         "^blockdevice_[A-Za-z0-9]+_model$" : { "type": "string" },
         "^mtu_[A-Za-z0-9]+$" : { "type": "string" },
-        "^netmask_[A-Za-z0-9_]+$" : { "type": "string" },
-        "^network_[A-Za-z0-9_]+$" : { "type": "string" },
-        "^ipaddress_[A-Za-z0-9_]+$" : { "type": "string" },
+        "^netmask_[A-Za-z0-9_]+$" : { "$ref" : "#/definitions/ipaddress" },
+        "^network_[A-Za-z0-9_]+$" : { "$ref" : "#/definitions/ipaddress" },
+        "^ipaddress_[A-Za-z0-9_]+$" : { "$ref" : "#/definitions/ipaddress" },
         "^ipaddress6_[A-Za-z0-9_]+$" : { "type": "string" },
-        "^macaddress_[A-Za-z0-9_]+$" : { "type": "string" },
+        "^macaddress_[A-Za-z0-9_]+$" : { "$ref" : "#/definitions/macaddress" },
         "^processor[0-9]+" : { "type": "string" }
     },
     "properties": {
@@ -38,7 +48,7 @@
         "hostname" : { "type": "string" },
         "id" : { "type": "string" },
         "interfaces" : { "type": "string" },
-        "ipaddress" : { "type": "string" },
+        "ipaddress" : { "$ref" : "#/definitions/ipaddress" },
         "ipaddress6" : { "type": "string" },
         "is_virtual" : { "type": "string" },
         "kernel" : { "type": "string" },
@@ -51,7 +61,7 @@
         "lsbdistrelease" : { "type": "string" },
         "lsbmajdistrelease" : { "type": "string" },
         "lsbrelease" : { "type": "string" },
-        "macaddress" : { "type": "string" },
+        "macaddress" : { "$ref" : "#/definitions/macaddress" },
         "macosx_buildversion" : { "type": "string" },
         "macosx_productname" : { "type": "string" },
         "macosx_productversion" : { "type": "string" },
@@ -63,7 +73,7 @@
         "memorysize" : { "type": "string" },
         "memorysize_mb" : { "type": "string" },
         "memorytotal" : { "type": "string" },
-        "netmask" : { "type": "string" },
+        "netmask" : { "$ref" : "#/definitions/ipaddress" },
         "operatingsystem" : { "type": "string" },
         "operatingsystemmajrelease" : { "type": "string" },
         "operatingsystemrelease" : { "type": "string" },

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-puppet/facter.git



More information about the Pkg-puppet-devel mailing list