示例#1
0
 protected string GetSecret(Host host)
 {
     try
     {
         var opaqueRef = Secret.get_by_uuid(host.Connection.Session, host.power_on_config[POWER_ON_PASSWORD_SECRET]);
         return(Secret.get_value(host.Connection.Session, opaqueRef));
     }
     catch
     {
         return(string.Empty);
     }
 }
示例#2
0
        public string GetSecretyInfo(IXenConnection connection, string secretType)
        {
            string UUID = string.Empty;

            switch (secretType)
            {
            case CallHomeSettings.UPLOAD_CREDENTIAL_USER_SECRET:
                UUID = UserNameSecretUuid;
                break;

            case CallHomeSettings.UPLOAD_CREDENTIAL_PASSWORD_SECRET:
                UUID = PasswordSecretUuid;
                break;

            case CallHomeSettings.UPLOAD_TOKEN_SECRET:
                UUID = UploadTokenSecretUuid;
                break;

            default:
                log.ErrorFormat("Error getting the {0} from the xapi secret", secretType);
                break;
            }

            if (connection == null || string.IsNullOrEmpty(UUID))
            {
                return(null);
            }
            try
            {
                string opaqueref = Secret.get_by_uuid(connection.Session, UUID);
                return(Secret.get_value(connection.Session, opaqueref));
            }
            catch (Exception e)
            {
                log.Error("Exception getting the upload token from the xapi secret", e);
                return(null);
            }
        }