private async Task <string[]> ExecuteAsync(PowershellLogger logger, string clusterEndPoint, string thumbPrint, string[] packagePaths)
        {
            try
            {
                var client = await new ServiceFabricClientBuilder().ConnectAsync(clusterEndPoint, thumbPrint);
                var tasks  = packagePaths
                             .Select(p => string.IsNullOrWhiteSpace(p) ? SessionState.Path.CurrentFileSystemLocation.Path : p)
                             .Select(p => Path.IsPathRooted(p) ? p : Path.Combine(SessionState.Path.CurrentFileSystemLocation.Path, p))
                             .Select(async p => new { Path = p, Result = await client.CreateDiffPackage(p) });

                var res = await Task.WhenAll(tasks);

                return(res.Where(t => t.Result).Select(t => t.Path).ToArray());
            }
            catch (Exception e)
            {
                logger.LogError(e.Message, e);
            }
            finally
            {
                logger.Stop();
            }

            return(null);
        }
Exemplo n.º 2
0
        protected override void ProcessRecord()
        {
            var logger = new PowershellLogger(this);

            _ = ExecuteAsync(logger, ClusterEndPoint, ThumbPrint, SessionState.Path.CurrentFileSystemLocation.Path);
            logger.Start();
        }
        protected override void ProcessRecord()
        {
            var logger = new PowershellLogger(this);
            var res    = ExecuteAsync(logger, ClusterEndPoint, ThumbPrint, PackagePaths);

            logger.Start();
            WriteObject(res.Result);
        }
Exemplo n.º 4
0
        private async Task ExecuteAsync(PowershellLogger logger, string clusterEndPoint, string thumbPrint, string path)
        {
            try
            {
                var client = await new ServiceFabricClientBuilder().ConnectAsync(clusterEndPoint, thumbPrint);
                var apps   = new ServiceFabricSolution(AppsHash, path);
                await client.DeployServiceFabricSolution(apps, UseSymlink.ToBool());
            }
            catch (Exception e)
            {
                logger.LogError(e.Message, e);
            }

            logger.Stop();
        }