help="Snapshot issue time")
    parser.add_option("--category",
                      type="string",
                      default="manual",
                      help="Snapshot Category")
    return parser


if __name__ == '__main__':
    options, argsleft = get_option_parser().parse_args()

    # Set the working dir prefix
    set_script_path(options.work_dir)

    # Credentials db must be initialized using the cred_mgmt.py file
    cdb = script_db.CredDB(options.work_dir + r'\cred_db')

    # Initialize the script database
    sdb = script_db.ScriptDB(options.work_dir + r'\script_db')
    sdb.setup()

    # Connect to server
    conn = options.storage_array

    if options.operation == 'HELLO':
        check_lun(conn, options.serial)
    elif options.operation == 'CREATE_SNAP':
        create_snap(cdb, sdb, conn, options.serial, options.snap_name,
                    options.access_group, options.proxy_host, options.category,
                    options.protect_category)
    elif options.operation == 'REMOVE_SNAP':
Ejemplo n.º 2
0
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
###############################################################################

# Script DB is used to store/load the cloned lun
# information and the credentials
import script_db
import sys

DB_NAME = 'cred_db'

if __name__ == '__main__':
    # Create DB
    db = script_db.CredDB('cred_db')

    done = False
    while not done:
        # Get the operation type
        op_str = input('\n1 - Setup new DB\n'\
                        '2 - Add/Modify Host\n'\
                        '3 - Delete Host\n'\
                        '4 - Show all passwords\n'\
                        '5 - Exit\nEnter Operation: ').strip()
        op = 0
        try:
            op = int(op_str)
        except:
            print('Invalid operation type ' + op_str + '\n')
            continue