#!/usr/bin/python

#
# Copyright (c) 2014 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#

import keyring
import os
import sys

def get_stealth_password():
    """Get the stealth password vault for manifest to run"""
    orig_root = os.environ.get('XDG_DATA_HOME', None)
    os.environ["XDG_DATA_HOME"] = "/tmp"
      
    stealth_pw = keyring.get_password("CGCS", "admin")

    if orig_root is not None:
        os.environ("XDG_DATA_HOME",orig_root)
    else:
        del os.environ["XDG_DATA_HOME"]
    return stealth_pw 

if __name__ == "__main__":
    sys.stdout.write(get_stealth_password())
    sys.stdout.flush()
    sys.exit(0)

