Host probes.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
diff --git a/core/defs.lisp b/core/defs.lisp
index f0555eb..3b8e06d 100644
--- a/core/defs.lisp
+++ b/core/defs.lisp
@@ -184,7 +184,9 @@
((probe-os-using-uname :properties (:os))
(probe-hostname :properties (:hostname))
(probe-boot-time :properties (:boot-time))
- (probe-host-user :properties (:user))))
+ (probe-host-user :properties (:user))
+ (probe-host-packages :properties (:packages)))
+ ((op-hostname :properties (:hostname))))
(defgeneric probe-os-using-uname (host os))
(defgeneric probe-hostname (host os))
diff --git a/core/spec.lisp b/core/spec.lisp
index ecffa16..082c5fa 100644
--- a/core/spec.lisp
+++ b/core/spec.lisp
@@ -100,6 +100,11 @@
(defmethod match-specified-value (resource property specified probed)
(equalp specified (describe-probed-property-value resource property probed)))
+(defmethod match-specified-value (resource (property (eql :ensure))
+ (specified (eql :present))
+ (probed null))
+ t)
+
;; Methods to get current status of resource
(defgeneric resource-diff (resource)
diff --git a/unix/defs.lisp b/unix/defs.lisp
index d311676..3ede6ef 100644
--- a/unix/defs.lisp
+++ b/unix/defs.lisp
@@ -21,20 +21,30 @@
;; Group
(define-resource-class group () ()
- ((probe-group-in-/etc/group :properties (:name :passwd :gid :members))))
+ ((probe-group-in-/etc/group :properties (:ensure :name :passwd :gid :members)))
+ ((op-update-group :properties (:ensure :gid))))
(defgeneric probe-group-in-/etc/group (resource os))
+(defgeneric op-update-group (resource os &key ensure gid))
;; User
(define-resource-class user ()
()
- ((probe-user-in-/etc/passwd :properties (:login :uid :gid :realname :home
- :shell))
- (probe-user-groups-in-/etc/group :properties (:groups))))
+ ((probe-user-in-/etc/passwd :properties (:ensure :login :uid :gid :realname
+ :home :shell))
+ (probe-user-groups-in-/etc/group :properties (:groups)))
+ ((op-update-user :properties (:ensure :uid :gid :realname :home :shell
+ :login-class :groups))))
(defgeneric probe-user-in-/etc/passwd (resource os))
(defgeneric probe-user-groups-in-/etc/group (resource os))
+(defgeneric op-update-user (resource os &key ensure uid gid realname home shell
+ login-class
+ groups))
+
+(defmethod resource-before-p ((r1 group) (r2 user))
+ t)
;; Filesystem virtual node