Success

Notes

Error

 
 
 
 
Budget

Small project <800

Posted on

2014-05-14 19:50:40.0

Buyer:

mug***

This project has expired

Why don't you register anyway? We are sure that you will find many similar projects out of the thousands waiting for you!

Post similar project now

Description

Perl SDK scripting

The purpose of the script is to scan one or more datastores for “orphaned” files, and allow the administrator to decide whether they can be deleted or not. Orphaned files would be files that do not belong to any VM that is currently registered on vCenter. There could be other files that reside on the datastore, which might not need to be deleted, so the administrator should have options to review the list of files to be deleted, or to specify a list of files that should never be considered orphaned.

Command Line Options Parsing The script should have the following options: 1. “ds”, which requires a string argument describing the name of the datastore to be scanned. 2. “print” , optional, boolean, default value left to the student, indicating whether the script should print to stdout the list of orphaned files found after parsing each datastore. 3. “simulate”, optional, boolean, default value left to the student, indicating whether the script should actually delete the files, or just print what it would do. 4. “delete” , optional, boolean, default not specified, indicating whether the orphaned files are to be deleted. 5. “delete-from”, optional, requires a string argument pointing to a file containing the list of files to be deleted. 6. “delete-exclude”, optional, requires a string argument, indicating a file containing a list of regular expressions of files that should not be identified as orphans. For each of the above options, the script should check if the parameters are conflicting with each other: •    “delete” can’t be specified if “delete-from” is specified •    “ds” is mandatory except for when “delete-from” is specified, when it will be conflicting. •    “print” and “simulate” can be specified together. In case of insufficient parameters, or parameters that are outside of the accepted values, or conflicting, the script should print an appropriate error message, mentioning at least the name of the parameter, its value and why it is not valid, and terminate with an error.

 

 

Command Line Options Implementation The script should implement the options according to the following requirements: 1. “ds”: Should be a regex, so that multiple datastores can be selected. 2. “print”: print to stdout the list of selected files, regardless of whether they are also being deleted. The format of the output should be strictly one file per line, using the datastore path format ([datastorename] folder/file). No folder/directory should be printed, unless optional requirement below is implemented. 3. “simulate”: when an action is going to be performed (basically only delete), if this option I sset, instead of issuing the delete command, print a message per file on stderr. The format of this output is left to the student’s choice. 4. “delete”: regardless of whether --print is specified, if --delete is specified, go through the list of files, and delete them one by one. 5. “delete-from”: disable any scanning and parsing, and directly get the file pointed to by this option, and use it to produce the list of orphaned files. The format of the file must be exactly the same as the one produced by –print. If directories or folders are specified in the files, the script should delete them. 6. “delete-exclude”: if this option is specified, prepare a list of regular expressions to decide which of the files should never be considered as orphaned. The format of this file is one regular expression per line. 1. “ds"  2. “print”  3. “simulate”  4. “delete”  5. “delete-from”  6. “delete-exclude”