예제 #1
0
        /// <summary>
        ///     The bootstrap options not present.
        /// </summary>
        public void BootstrapOptionsNotPresent()
        {
            var     name      = MethodBase.GetCurrentMethod().Name;
            dynamic eventArgs = new DscEventArgs(name, this.GetMessageForMethod(name));

            this.EventManager.CreateEvent(eventArgs);
        }
예제 #2
0
        public void UpgradeNodeRepositoryDatabaseSchema()
        {
            var     name      = MethodBase.GetCurrentMethod().Name;
            dynamic eventArgs = new DscEventArgs(name, this.GetMessageForMethod(name));

            this.EventManager.CreateEvent(eventArgs);
        }
예제 #3
0
        /// <summary>
        ///     The start.
        /// </summary>
        public void Start()
        {
            var     name      = MethodBase.GetCurrentMethod().Name;
            dynamic eventArgs = new DscEventArgs(name, this.GetMessageForMethod(name));

            this.EventManager.CreateEvent(eventArgs);
        }
예제 #4
0
        /// <summary>
        /// The mof file not created.
        /// </summary>
        /// <param name="target">
        /// The target.
        /// </param>
        public void MofFileNotCreated(string target)
        {
            var     name      = MethodBase.GetCurrentMethod().Name;
            dynamic eventArgs = new DscEventArgs(name, this.GetMessageForMethod(name, target));

            eventArgs.Target = target;
            this.EventManager.CreateEvent(eventArgs);
        }
예제 #5
0
        /// <summary>
        /// The mof build failed.
        /// </summary>
        /// <param name="buildId">
        /// The build id.
        /// </param>
        public void MofBuildFailed(int buildId)
        {
            var     name      = MethodBase.GetCurrentMethod().Name;
            dynamic eventArgs = new DscEventArgs(name, this.GetMessageForMethod(name, buildId));

            eventArgs.BuildId = buildId;
            this.EventManager.CreateEvent(eventArgs);
        }
예제 #6
0
        /// <summary>
        /// The begin database seed.
        /// </summary>
        /// <param name="initializer">
        /// The initializer.
        /// </param>
        public void BeginDeploymentServerDatabaseSeed(string initializer)
        {
            var     name      = MethodBase.GetCurrentMethod().Name;
            dynamic eventArgs = new DscEventArgs(name, this.GetMessageForMethod(name, initializer));

            eventArgs.Initializer = initializer;
            this.EventManager.CreateEvent(eventArgs);
        }
예제 #7
0
        /// <summary>
        /// The node updated.
        /// </summary>
        /// <param name="nodeName">
        /// The node name.
        /// </param>
        public void NodeUpdated(string nodeName)
        {
            var     name      = MethodBase.GetCurrentMethod().Name;
            dynamic eventArgs = new DscEventArgs(name, this.GetMessageForMethod(name, nodeName));

            eventArgs.NodeName = nodeName;
            this.EventManager.CreateEvent(eventArgs);
        }
예제 #8
0
        /// <summary>
        /// The begin database seed.
        /// </summary>
        /// <param name="name">
        /// The name.
        /// </param>
        public void BeginNodeRepositoryDatabaseSeed(string name)
        {
            var     name2     = MethodBase.GetCurrentMethod().Name;
            dynamic eventArgs = new DscEventArgs(name2, this.GetMessageForMethod(name2, name));

            eventArgs.Name = name;
            this.EventManager.CreateEvent(eventArgs);
        }
예제 #9
0
        /// <summary>
        /// The build requested no build service.
        /// </summary>
        /// <param name="nodeRequest">
        /// The node request.
        /// </param>
        public void BuildRequestedNoBuildService(IEnumerable <NodeDetailView> nodeRequest)
        {
            var     name      = MethodBase.GetCurrentMethod().Name;
            dynamic eventArgs = new DscEventArgs(name, this.GetMessageForMethod(name));

            eventArgs.NodeRequest = nodeRequest;
            this.EventManager.CreateEvent(eventArgs);
        }
예제 #10
0
        /// <summary>
        /// The build configuration build does not exist.
        /// </summary>
        /// <param name="buildId">
        /// The build id.
        /// </param>
        public void BuildConfigurationBuildDoesNotExist(int buildId)
        {
            var     name      = MethodBase.GetCurrentMethod().Name;
            dynamic eventArgs = new DscEventArgs(name, this.GetMessageForMethod(name, buildId));

            eventArgs.BuildId = buildId;
            this.EventManager.CreateEvent(eventArgs);
        }
예제 #11
0
        /// <summary>
        /// The mof build succeeded.
        /// </summary>
        /// <param name="buildId">
        /// The build id.
        /// </param>
        /// <param name="targets">
        /// </param>
        public void MofBuildSucceeded(int buildId, IEnumerable <string> targets)
        {
            var     name      = MethodBase.GetCurrentMethod().Name;
            dynamic eventArgs = new DscEventArgs(name, this.GetMessageForMethod(name, buildId, targets));

            eventArgs.BuildId = buildId;
            eventArgs.Targets = targets;
            this.EventManager.CreateEvent(eventArgs);
        }
예제 #12
0
        /// <summary>
        /// The node agent error.
        /// </summary>
        /// <param name="name">
        /// The name.
        /// </param>
        /// <param name="errorMessage">
        /// The error message.
        /// </param>
        public void NodeAgentError(string name, string errorMessage)
        {
            var     name2     = MethodBase.GetCurrentMethod().Name;
            dynamic eventArgs = new DscEventArgs(name2, this.GetMessageForMethod(name2, name, errorMessage));

            eventArgs.Name         = name;
            eventArgs.ErrorMessage = errorMessage;
            this.EventManager.CreateEvent(eventArgs);
        }
예제 #13
0
        /// <summary>
        /// The configuration published.
        /// </summary>
        /// <param name="target">
        /// The target.
        /// </param>
        /// <param name="configurationDocumentId">
        /// The configuration document id.
        /// </param>
        public void ConfigurationPublished(string target, int configurationDocumentId)
        {
            var     name      = MethodBase.GetCurrentMethod().Name;
            dynamic eventArgs = new DscEventArgs(name, this.GetMessageForMethod(name, target, configurationDocumentId));

            eventArgs.Target = target;
            eventArgs.ConfigurationDocumentId = configurationDocumentId;
            this.EventManager.CreateEvent(eventArgs);
        }
예제 #14
0
        /// <summary>
        /// The cleanup old log entries.
        /// </summary>
        /// <param name="count">
        /// The count.
        /// </param>
        /// <param name="daysToKeepLogs">
        /// The days to keep logs.
        /// </param>
        public void CleanupOldLogEntries(int count, int daysToKeepLogs)
        {
            var     name      = MethodBase.GetCurrentMethod().Name;
            dynamic eventArgs = new DscEventArgs(name, this.GetMessageForMethod(name, count, daysToKeepLogs));

            eventArgs.Count          = count;
            eventArgs.DaysToKeepLogs = daysToKeepLogs;
            this.EventManager.CreateEvent(eventArgs);
        }
예제 #15
0
        /// <summary>
        /// The bootstrap update received.
        /// </summary>
        /// <param name="nodeName">
        /// The node name.
        /// </param>
        /// <param name="nodeData">
        /// The node data.
        /// </param>
        public void BootstrapUpdateReceived(string nodeName, Hashtable nodeData)
        {
            var     name      = MethodBase.GetCurrentMethod().Name;
            dynamic eventArgs = new DscEventArgs(name, this.GetMessageForMethod(name, nodeName));

            eventArgs.NodeName = nodeName;
            eventArgs.NodeData = nodeData;
            this.EventManager.CreateEvent(eventArgs);
        }
예제 #16
0
        /// <summary>
        /// The node changed is in maintenance.
        /// </summary>
        /// <param name="name">
        /// The name.
        /// </param>
        /// <param name="isInMaintenance">
        /// The is in maintenance.
        /// </param>
        public void NodeChangedIsInMaintenance(string name, bool isInMaintenance)
        {
            var     name2     = MethodBase.GetCurrentMethod().Name;
            dynamic eventArgs = new DscEventArgs(name2, this.GetMessageForMethod(name2, name, isInMaintenance));

            eventArgs.Name            = name;
            eventArgs.IsInMaintenance = isInMaintenance;
            this.EventManager.CreateEvent(eventArgs);
        }
예제 #17
0
        /// <summary>
        /// The delete archive configurations.
        /// </summary>
        /// <param name="target">
        /// The target.
        /// </param>
        /// <param name="count">
        /// The count.
        /// </param>
        public void DeleteArchiveConfigurations(string target, int count)
        {
            var     name      = MethodBase.GetCurrentMethod().Name;
            dynamic eventArgs = new DscEventArgs(name, this.GetMessageForMethod(name, target, count));

            eventArgs.Target = target;
            eventArgs.Count  = count;
            this.EventManager.CreateEvent(eventArgs);
        }
예제 #18
0
        /// <summary>
        /// The delete expired builds.
        /// </summary>
        /// <param name="count">
        /// The count.
        /// </param>
        /// <param name="expirationTimestamp">
        /// The expiration timestamp.
        /// </param>
        public void DeleteExpiredBuilds(int count, DateTime expirationTimestamp)
        {
            var     name      = MethodBase.GetCurrentMethod().Name;
            dynamic eventArgs = new DscEventArgs(name, this.GetMessageForMethod(name, count, expirationTimestamp));

            eventArgs.Count = count;
            eventArgs.ExpirationTimestamp = expirationTimestamp;
            this.EventManager.CreateEvent(eventArgs);
        }
예제 #19
0
        /// <summary>
        /// The reference outside web context.
        /// </summary>
        /// <param name="name">
        /// The name.
        /// </param>
        /// <param name="source">
        /// The source.
        /// </param>
        void INodeRepositoryLogging.ReferenceOutsideWebContext(string name, string source)
        {
            var     name2     = MethodBase.GetCurrentMethod().Name;
            dynamic eventArgs = new DscEventArgs(name2, this.GetMessageForMethod(name2, name, source));

            eventArgs.Name   = name;
            eventArgs.Source = source;
            this.EventManager.CreateEvent(eventArgs);
        }
예제 #20
0
        /// <summary>
        /// The node changed initial deployment.
        /// </summary>
        /// <param name="name">
        /// The name.
        /// </param>
        /// <param name="status">
        /// The status.
        /// </param>
        public void NodeChangedInitialDeployment(string name, bool status)
        {
            var     name2     = MethodBase.GetCurrentMethod().Name;
            dynamic eventArgs = new DscEventArgs(name2, this.GetMessageForMethod(name2, name, status));

            eventArgs.Name   = name;
            eventArgs.Status = status;
            this.EventManager.CreateEvent(eventArgs);
        }
예제 #21
0
        /// <summary>
        /// The unpublish configurations node removed.
        /// </summary>
        /// <param name="count">
        /// The count.
        /// </param>
        /// <param name="nodeName">
        /// The node name.
        /// </param>
        public void UnpublishConfigurationsNodeRemoved(int count, string nodeName)
        {
            var     name      = MethodBase.GetCurrentMethod().Name;
            dynamic eventArgs = new DscEventArgs(name, this.GetMessageForMethod(name, count, nodeName));

            eventArgs.Count    = count;
            eventArgs.NodeName = nodeName;
            this.EventManager.CreateEvent(eventArgs);
        }
예제 #22
0
        /// <summary>
        /// The configuration report posted.
        /// </summary>
        /// <param name="target">
        /// The target.
        /// </param>
        /// <param name="request">
        /// The request.
        /// </param>
        public void ConfigurationReportPosted(string target, ConfigurationReportRecordRequest request)
        {
            var     name      = MethodBase.GetCurrentMethod().Name;
            dynamic eventArgs = new DscEventArgs(name, this.GetMessageForMethod(name, target, request.Type, request));

            eventArgs.Target  = target;
            eventArgs.Type    = request.Type;
            eventArgs.Request = request;
            this.EventManager.CreateEvent(eventArgs);
        }
예제 #23
0
        /// <summary>
        /// The submitted build request.
        /// </summary>
        /// <param name="build">
        /// The build.
        /// </param>
        public void SubmittedBuildRequest(Build build)
        {
            var     name      = MethodBase.GetCurrentMethod().Name;
            dynamic eventArgs = new DscEventArgs(name, this.GetMessageForMethod(name, build.Id, build.Targets.Count));

            eventArgs.BuildId     = build.Id;
            eventArgs.Targets     = build.Targets;
            eventArgs.TargetCount = build.Targets.Count;
            this.EventManager.CreateEvent(eventArgs);
        }
예제 #24
0
        /// <summary>
        /// The received request.
        /// </summary>
        /// <param name="uri">
        /// The uri.
        /// </param>
        /// <param name="method">
        /// The method.
        /// </param>
        /// <param name="clientIp">
        /// The client ip.
        /// </param>
        /// <param name="username">
        /// The username.
        /// </param>
        public void ReceivedRequest(string uri, string method, string clientIp, string username)
        {
            var     name      = MethodBase.GetCurrentMethod().Name;
            dynamic eventArgs = new DscEventArgs(name, this.GetMessageForMethod(name, uri, method, clientIp, username));

            eventArgs.Uri      = uri;
            eventArgs.Method   = method;
            eventArgs.ClientIp = clientIp;
            eventArgs.Username = username;
            this.EventManager.CreateEvent(eventArgs);
        }
예제 #25
0
        /// <summary>
        /// The handle event.
        /// </summary>
        /// <param name="eventArgs">
        /// The event args.
        /// </param>
        /// <returns>
        /// The <see cref="Task"/>.
        /// </returns>
        public override Task HandleEvent(DscEventArgs eventArgs)
        {
            var user = this.Container.IsRegistered <IPrincipal>()
                           ? this.Container.Resolve <IPrincipal>().Identity.Name
                           : "Unknown user";

            this.LogQueue.Enqueue(
                new LoggingEntity {
                Message = eventArgs.Message, Timestamp = DateTime.UtcNow, Username = user, Server = Environment.MachineName
            });
            return(Task.FromResult <object>(null));
        }
예제 #26
0
        public void MofFileCreated(string target, string configurationPackageName, string configurationVersion, string certificateThumbprint)
        {
            var     name      = MethodBase.GetCurrentMethod().Name;
            dynamic eventArgs = new DscEventArgs(
                name,
                this.GetMessageForMethod(name, target, configurationPackageName, configurationVersion, certificateThumbprint));

            eventArgs.Target = target;
            eventArgs.ConfigurationPackageName    = configurationPackageName;
            eventArgs.ConfigurationPackageVersion = configurationVersion;
            eventArgs.CertificateThumbprint       = certificateThumbprint;
            this.EventManager.CreateEvent(eventArgs);
        }
예제 #27
0
        /// <summary>
        /// The request exception.
        /// </summary>
        /// <param name="requestUrl">
        /// The request url.
        /// </param>
        /// <param name="message">
        /// The message.
        /// </param>
        /// <param name="source">
        /// The source.
        /// </param>
        /// <param name="stackTrace">
        /// The stack trace.
        /// </param>
        public void RequestException(string requestUrl, string message, string source, string stackTrace)
        {
            var     name      = MethodBase.GetCurrentMethod().Name;
            dynamic eventArgs = new DscEventArgs(
                name,
                this.GetMessageForMethod(name, requestUrl, message, source, stackTrace));

            eventArgs.RequestUri   = requestUrl;
            eventArgs.ErrorMessage = message;
            eventArgs.Source       = source;
            eventArgs.StackTrace   = stackTrace;
            this.EventManager.CreateEvent(eventArgs);
        }
예제 #28
0
        /// <summary>
        /// The handle event.
        /// </summary>
        /// <param name="eventArgs">
        /// The event args.
        /// </param>
        /// <returns>
        /// The <see cref="Task"/>.
        /// </returns>
        public override Task HandleEvent(DscEventArgs eventArgs)
        {
            var message    = new SlackMessage();
            var attachment = new SlackAttachment();

            message.Attachments.Add(attachment);
            switch (eventArgs.Name)
            {
            case "MofBuildSucceeded":
                attachment.Text  = "<https://dsc.winsys.tmcs/api/v2/builds/" + eventArgs.GetMember("BuildId") + "|Mof build #" + eventArgs.GetMember("BuildId") + "> has completed successfully.";
                attachment.Color = Color.Green;
                break;

            case "MofBuildFailed":
                attachment.Text  = "<https://dsc.winsys.tmcs/api/v2/builds/" + eventArgs.GetMember("BuildId") + "|Mof build #" + eventArgs.GetMember("BuildId") + "> has failed.";
                attachment.Color = Color.Red;
                break;

            case "NodeChangedInitialDeployment":
                var target   = eventArgs.GetMember <string>("name");
                var newValue = eventArgs.GetMember <bool>("status");
                if (!newValue)
                {
                    attachment.Text  = "Node *" + target + "* has successfully completed initial deployment.";
                    attachment.Color = Color.LightGray;
                }
                break;

            case "NodeAgentError":
                var name = eventArgs.GetMember <string>("name");
                attachment.Text  = "Node *" + name + "* has reported the following error: " + eventArgs.GetMember <string>("errorMessage") + ".";
                attachment.Color = Color.Red;
                break;

            case "SubmittedBuildRequest":
                attachment.Text  = "<https://dsc.winsys.tmcs/api/v2/builds/" + eventArgs.GetMember("BuildId") + "|Mof build #" + eventArgs.GetMember("BuildId") + "> has been submitted. " + eventArgs.GetMember("TargetCount") + " node(s) will be built.";
                attachment.Color = Color.LightGray;
                break;

            default:
                return(Task.FromResult <object>(null));
            }

            this.SlackService.SendMessage(message);
            return(Task.FromResult <object>(null));
        }
예제 #29
0
 /// <summary>
 /// The create event.
 /// </summary>
 /// <param name="eventArgs">
 /// The event args.
 /// </param>
 /// <returns>
 /// The <see cref="Task"/>.
 /// </returns>
 public async Task CreateEvent(DscEventArgs eventArgs)
 {
     await Task.WhenAll(this.Subscribers.Select(a => a.Invoke(eventArgs)));
 }
예제 #30
0
 /// <summary>
 /// The handle event.
 /// </summary>
 /// <param name="eventArgs">
 /// The event args.
 /// </param>
 /// <returns>
 /// The <see cref="Task"/>.
 /// </returns>
 public override Task HandleEvent(DscEventArgs eventArgs)
 {
     Console.WriteLine(eventArgs.Message);
     return(Task.FromResult <object>(null));
 }