Function: shadow-define-cluster

shadow-define-cluster is an autoloaded, interactive and byte-compiled function defined in shadowfile.el.gz.

Signature

(shadow-define-cluster NAME)

Documentation

Edit (or create) the definition of a cluster NAME.

This is a group of hosts that share directories, so that copying to or from one of them is sufficient to update the file on all of them. Clusters are defined by a name, the network address of a primary host (the one we copy files to), and a regular expression that matches the hostnames of all the sites in the cluster.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/shadowfile.el.gz
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; User-level Commands
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;###autoload
(defun shadow-define-cluster (name)
  "Edit (or create) the definition of a cluster NAME.
This is a group of hosts that share directories, so that copying to or from
one of them is sufficient to update the file on all of them.  Clusters are
defined by a name, the network address of a primary host (the one we copy
files to), and a regular expression that matches the hostnames of all the
sites in the cluster."
  (interactive (list (completing-read "Cluster name: " shadow-clusters)))
  (let* ((old (shadow-get-cluster name))
	 (primary (let (try-primary)
		    (while (not
			    (or
			     (string-equal
			      (setq try-primary
				    (read-string
				     "Primary host: "
				     (if old (shadow-cluster-primary old)
				       name)))
			      shadow-system-name)
			     (file-remote-p try-primary)))
		      (message "Not a valid primary!")
		      (sit-for 2))
		    try-primary))
	 (regexp  (let (try-regexp)
		    (while (not
			    (string-match
			     (setq try-regexp
				   (read-string
				    "Regexp matching all host names: "
				    (if old (shadow-cluster-regexp old)
				      (shadow-regexp-superquote primary))))
			     primary))
		      (message "Regexp doesn't include the primary host!")
		      (sit-for 2))
		    try-regexp)))
    (shadow-set-cluster name primary regexp)))