cfengine/design-center — pull request #351 by zzamboni (2013-07-12 06:50:50+00:00)
Title: Sketchify!

The sketchify command is now implemented. This pull request also includes a few other cleanups and improvements.

Sample sketchify session:

```
cf-sketch> sketchify /vagrant/password_expiration.cf

Reading file '/vagrant/password_expiration.cf'.
Automatically choosing the only agent bundle in /vagrant/password_expiration.cf: 'password_expiration'
I will now prompt you for the data needed to generate the sketch.
Please enter STOP at any prompt to interrumpt the process.

Please enter the sketch name: Security::password_expiration
Please enter a one-line description for the new sketch: Manage password expiration periods
Please enter a version number: 1.0
Please enter a license for this sketch: MIT
Please enter a comma-separated list of tags for this sketch: cfdc,security
Please enter a comma-separated list of author names (preferably of the form Name ): Diego Zamboni
Please enter any other files that need to be included with this sketch (press Enter to stop):

Thank you. I will now prompt you for the information regarding the parameters
of the entry point for the sketch.
For each parameter, you need to provide a type and a description.
(enter STOP at any prompt to abort)

For parameter 'pass_max_days':
Please indicate the type as (1) string, (2) boolean, (3) list, (4) array (1-4): 1
Please give me a short description for this parameter: Max pass age in days
Please enter the default value for this parameter (empty for no default): 180
For parameter 'pass_min_days':
Please indicate the type as (1) string, (2) boolean, (3) list, (4) array (1-4): 1
Please give me a short description for this parameter: Min pass age in days
Please enter the default value for this parameter (empty for no default): 5
For parameter 'pass_warn_age':
Please indicate the type as (1) string, (2) boolean, (3) list, (4) array (1-4): 1
Please give me a short description for this parameter: Warning period before expiry
Please enter the default value for this parameter (empty for no default): 2
For parameter 'min_uid':
Please indicate the type as (1) string, (2) boolean, (3) list, (4) array (1-4): 1
Please give me a short description for this parameter: Minimum UID to update
Please enter the default value for this parameter (empty for no default): 500
For parameter 'skipped_users':
Please indicate the type as (1) string, (2) boolean, (3) list, (4) array (1-4): 1
Please give me a short description for this parameter: Users to skip
Please enter the default value for this parameter (empty for no default):
For parameter 'skipped_uids':
Please indicate the type as (1) string, (2) boolean, (3) list, (4) array (1-4): 1
Please give me a short description for this parameter: UIDs to skip
Please enter the default value for this parameter (empty for no default):

We are done with the API. Now checking the namespace declaration.

The file '/vagrant/password_expiration.cf' does not have a namespace declaration.
It is recommended that every sketch has its own namespace to avoid potential naming conflicts with other sketches or policies.
I can insert the appropriate namespace declaration, and have generated a suggested namespace for you: cfdc_security_password_expiration
Please enter the namespace to use for this sketch: cfdc_security_password_expiration

The entry point 'password_expiration' doesn't seem to receive parameters of type 'environment' or 'metadata'.
These arguments are not necessary, but can be useful for the sketch to respond to different run environment parameters (i.e. test or verbose mode) or to have access to its own metadata.
I can automatically add these parameters to the bundle, together with some code to put their information in classes and variables, and also to create an activation_id variable that will make it possible to use the new sketch with the CFEngine Enterprise Design Center GUI.
Would you like me to do this? (Y/n)

Thank you! We are almost done.
Please enter the directory within the sketches repository where this sketch should be stored: security/password_expiration
Your new sketch will be stored under /design-center/sketches/security/password_expiration/
Writing /design-center/sketches/security/password_expiration/sketch.json
Transferring /vagrant/password_expiration.cf to /design-center/sketches/security/password_expiration/password_expiration.cf
Adding new sketch to /design-center/sketches/cfsketches.json
Generating a README file for the new sketch.
wrote /design-center/sketches/security/password_expiration/README.md...
We are done! Please check your new sketch under /design-center/sketches/security/password_expiration

cf-sketch>
```