public string GetPhysicalPath(PhysicalServer site, string path, bool forceLocalPath) { var standardizedPath = path; if (!IsUncPath(standardizedPath)) { standardizedPath = @"\\{0}\{1}".FormatWith(site.Name, standardizedPath); } if (path.StartsWith("~")) { standardizedPath = standardizedPath.Replace(@"~\", ""); } standardizedPath = standardizedPath.Replace(':', '$'); if (site.IsLocal || forceLocalPath) { var serviceLocation = standardizedPath; var regex = new Regex(@"(?<front>[\\\\]?.+?)\\(?<shareName>[A-Za-z0-9\+\.\~\!\@\#\$\%\^\&\(\)_\-'\{\}\s-[\r\n\f]]+)\\?(?<rest>.*)", RegexOptions.IgnoreCase & RegexOptions.Multiline & RegexOptions.IgnorePatternWhitespace); var shareMatch = regex.Match(standardizedPath); if (shareMatch.Success) { var shareName = shareMatch.Groups["shareName"].Value; serviceLocation = Win32Share.GetLocalPathForShare(site.Name, shareName); } var rest = shareMatch.Groups["rest"].Value; standardizedPath = System.IO.Path.Combine(serviceLocation, rest); } return(standardizedPath); }
public RemoteMsmqGrantAccessRightsTask(PhysicalServer server, QueueAddress address, string user, MessageQueueAccessRights accessRights) { _server = server; _address = address; _user = user; _accessRights = accessRights; }
public override void RegisterRealTasks(PhysicalServer site) { string filePath = site.MapPath(_filePath); var o = new XmlPokeTask(filePath, _items, new DotNetPath()); site.AddTask(o); }
public override void RegisterRealTasks(PhysicalServer server) { var to = server.MapPath(_to); var archiveFilename = server.MapPath(_archiveFilename); var task = new UnzipArchiveTask(archiveFilename, to, _options, _path, _explicitExistingFileAction); server.AddTask(task); }
public override void RegisterRealTasks(PhysicalServer server) { string to = server.MapPath(_folderName); var task = new EmptyFolderTask(to, new DotNetPath()); server.AddTask(task); }
public CopyRemoteOut(PhysicalServer server) { _server = server; //copy remote out //TODO: make this path configurable var remotePath = RemotePathHelper.Convert(server, @"C:\Temp\dropkick.remote"); if (!Directory.Exists(remotePath)) Directory.CreateDirectory(remotePath); _path = remotePath; var ewd = Assembly.GetExecutingAssembly().Location; var local = Path.GetDirectoryName(ewd); if (local == null) throw new Exception("shouldn't be null"); var filesToCopy = new[] { "dropkick.remote.exe", "dropkick.dll", "log4net.dll", "Magnum.dll" }; foreach (var file in filesToCopy) { var dest = Path.Combine(remotePath, file); var src = Path.Combine(local, file); _fineLog.DebugFormat("[msmq][remote] '{0}'->'{1}'", src, dest); try { if(!File.Exists(dest)) File.Copy(src, dest, true); } catch (IOException ex) { _fineLog.DebugFormat("[msmq][remote][file] Error copying '{0}' to '{1}'", file, remotePath); throw; } } }
public override void RegisterRealTasks(PhysicalServer site) { var path = PathConverter.Convert(site,_path); var task = new RemoveAclsInheritanceTask(path); site.AddTask(task); }
public string GetPhysicalPath(PhysicalServer site, string path,bool forceLocalPath) { var standardizedPath = path; if (!IsUncPath(standardizedPath)) { standardizedPath = @"\\{0}\{1}".FormatWith(site.Name, standardizedPath); } if (path.StartsWith("~")) { standardizedPath = standardizedPath.Replace(@"~\", ""); } standardizedPath = standardizedPath.Replace(':', '$'); if (site.IsLocal || forceLocalPath) { var serviceLocation = standardizedPath; var regex = new Regex(@"(?<front>[\\\\]?.+?)\\(?<shareName>[A-Za-z0-9\+\.\~\!\@\#\$\%\^\&\(\)_\-'\{\}\s-[\r\n\f]]+)\\?(?<rest>.*)", RegexOptions.IgnoreCase & RegexOptions.Multiline & RegexOptions.IgnorePatternWhitespace); var shareMatch = regex.Match(standardizedPath); if (shareMatch.Success) { var shareName = shareMatch.Groups["shareName"].Value; serviceLocation = Win32Share.GetLocalPathForShare(site.Name, shareName); } var rest = shareMatch.Groups["rest"].Value; standardizedPath = System.IO.Path.Combine(serviceLocation, rest); } return standardizedPath; }
public override void RegisterRealTasks(PhysicalServer server) { foreach (BaseProtoTask task in _innerTasks) { task.RegisterRealTasks(server); } }
public override void RegisterRealTasks(PhysicalServer site) { string filePath = site.MapPath(_filePath); var o = new XmlPokeTask(filePath, _items, _setOrInsertItems, _removeItems, new DotNetPath(), _namespacePrefixes); site.AddTask(o); }
public override void RegisterRealTasks(PhysicalServer server) { var ub = new UriBuilder("msmq", server.Name) {Path = _queueName}; if(server.IsLocal) server.AddTask(new CreateLocalMsmqQueueTask(server, new QueueAddress(ub.Uri), _queueOptions.transactional)); else server.AddTask(new CreateRemoteMsmqQueueTask(server, new QueueAddress(ub.Uri), _queueOptions.transactional)); }
public RemoteNServiceBusInstallTask(string exeName, string location, string instanceName, PhysicalServer site, string username, string password, string serviceName, string displayName, string description, bool startManually) { StringBuilder args = new StringBuilder("/install "); if (username != null && password != null) { var user = username; var pass = password; if (username.ShouldPrompt()) user = _prompt.Prompt("Win Service '{0}' UserName".FormatWith(exeName)); if (password.ShouldPrompt()) pass = _prompt.Prompt("Win Service '{0}' For User '{1}' Password".FormatWith(exeName, username)); args.Append(" /username:{0} /password:{1}".FormatWith(user, pass)); } if (!string.IsNullOrEmpty(instanceName)) args.AppendFormat(" /instanceName:{0}", instanceName); if (!string.IsNullOrEmpty(serviceName)) args.AppendFormat(" /serviceName:{0}", serviceName); if (!string.IsNullOrEmpty(displayName)) args.AppendFormat(" /displayName:{0}", displayName); if (!string.IsNullOrEmpty(description)) args.AppendFormat(" /description:{0}", description); if (startManually) args.Append(" /startManually"); _task = new RemoteCommandLineTask(exeName) { Args = args.ToString(), ExecutableIsLocatedAt = location, Machine = site.Name, WorkingDirectory = location }; }
public override void RegisterRealTasks(PhysicalServer server) { var to = server.MapPath(_to); var archiveFilename = _isLocal ? _archiveFilename : server.MapPath(_archiveFilename); var task = new UnzipArchiveTask(archiveFilename, to, _options, _path); server.AddTask(task); }
public override void RegisterRealTasks(PhysicalServer site) { var path = PathConverter.Convert(site, _path); var task = new ClearAclsTask(path, _groupsToPreserve, _groupsToRemove); site.AddTask(task); }
public RemoteNServiceBusHostTask(string exeName, string location, string instanceName, PhysicalServer site, string username, string password, string serviceName, string displayName, string description) { string args = string.IsNullOrEmpty(instanceName) ? "" : " /instance:\"{0}\"".FormatWith(instanceName); if (username != null && password != null) { var user = username; var pass = password; if (username.ShouldPrompt()) user = _prompt.Prompt("Win Service '{0}' UserName".FormatWith(exeName)); if (shouldPromptForPassword(username, password)) pass = _prompt.Prompt("Win Service '{0}' For User '{1}' Password".FormatWith(exeName, username)); args += " /userName:\"{0}\" /password:\"{1}\"".FormatWith(user, pass); } if (!string.IsNullOrEmpty(serviceName)) args += " /serviceName:\"{0}\"".FormatWith(serviceName); if (!string.IsNullOrEmpty(displayName)) args += " /displayName:\"{0}\"".FormatWith(displayName); if (!string.IsNullOrEmpty(description)) args += " /description:\"{0}\"".FormatWith(description); _task = new RemoteCommandLineTask(exeName) { Args = "/install" + args, ExecutableIsLocatedAt = location, Machine = site.Name, WorkingDirectory = location }; }
public override void RegisterRealTasks(PhysicalServer site) { var task = new PublishSsrsTask(_publishTo); task.AddReportsIn(_publishAllIn); task.AddReport(_publish); site.AddTask(task); }
public override void RegisterRealTasks(PhysicalServer site) { DbConnectionInfo connectionInfo; if (_connectionString.IsNotEmpty()) { connectionInfo = new DbConnectionInfo(_connectionString); } else { connectionInfo = new DbConnectionInfo { Server = site.Name, Instance = _instanceName, DatabaseName = _databaseName, UserName = _userName, Password = _password }; } var task = new RoundhousETask(connectionInfo, _scriptsLocation, _environmentName, _roundhouseMode, _recoveryMode, _restorePath, _restoreTimeout, _restoreCustomOptions, _repositoryPath, _versionFile, _versionXPath, _commandTimeout, _commandTimeoutAdmin, _functionsFolderName, _sprocsFolderName, _viewsFolderName, _upFolderName, _versionTable, _scriptsRunTable, _scriptsRunErrorTable, _warnOnOneTimeScriptChanges, _outputPath); site.AddTask(task); }
public RemoteMsmqGrantReadWriteTask(PhysicalServer server, string queueName, string group) { _server = server; _group = group; var ub = new UriBuilder("msmq", server.Name) { Path = queueName }; _address = new QueueAddress(ub.Uri); }
public override void RegisterRealTasks(PhysicalServer s) { s.AddTask(new RunSqlScriptTask(s.Name, _databaseName) { ScriptToRun = ScriptToRun }); }
public override void RegisterRealTasks(PhysicalServer s) { s.AddTask(new OutputSqlTask(s.Name, _databaseName) { OutputSql = OutputSql }); }
public override void RegisterRealTasks(PhysicalServer site) { var ub = new UriBuilder("msmq", site.Name) { Path = _queue }; var task = new MsmqGrantWriteTask(site, new QueueAddress(ub.Uri), _group); site.AddTask(task); }
public override void RegisterRealTasks(PhysicalServer site) { string to = site.MapPath(_to); var o = new CopyFileTask(_from, to, _newFileName, new DotNetPath()); site.AddTask(o); }
public RemoteTopshelfTask(string exeName, string location, string instanceName, PhysicalServer site, string username, string password) { string args = string.IsNullOrEmpty(instanceName) ? "" : " /instance:" + instanceName; if (username != null && password != null) { var user = username; var pass = password; if (username.ShouldPrompt()) user = _prompt.Prompt("Win Service '{0}' UserName".FormatWith(exeName)); if (password.ShouldPrompt()) pass = _prompt.Prompt("Win Service '{0}' For User '{1}' Password".FormatWith(exeName, username)); args += " /username:{0} /password:{1}".FormatWith(user, pass); } _task = new RemoteCommandLineTask(exeName) { Args = "install" + args, ExecutableIsLocatedAt = location, Machine = site.Name, WorkingDirectory = location }; }
private async Task <bool> ServerOffline() { PhysicalServer server = _serverManager.GetPhysicalServerByServer(_state.Server); if (server == null) { _logger.Info($"The server {_state.Server.Name} ({_state.Server.ExitIp}) was removed from the API."); return(true); } try { ApiResponseResult <PhysicalServerResponse> result = await _apiClient.GetServerAsync(server.Id); if (!result.Success) { return(false); } bool isServerUnderMaintenance = result.Value.Server.Status == 0; if (isServerUnderMaintenance) { _logger.Info($"The server {_state.Server.Name} ({_state.Server.ExitIp}) is under maintenance."); } return(isServerUnderMaintenance); } catch (HttpRequestException) { return(false); } }
public override void RegisterRealTasks(PhysicalServer s) { var scrubbedPath = _path.GetPhysicalPath(s, PathOnServer, true); if (Version == IisVersion.Six) { s.AddTask(new Iis6Task { PathOnServer = scrubbedPath, ServerName = s.Name, VirtualDirectoryPath = VdirPath, WebsiteName = WebsiteName, AppPoolName = AppPoolName }); return; } s.AddTask(new Iis7Task { PathOnServer = scrubbedPath, ServerName = s.Name, VirtualDirectoryPath = VdirPath, WebsiteName = WebsiteName, AppPoolName = AppPoolName, UseClassicPipeline = ClassicPipelineRequested, ManagedRuntimeVersion = this.ManagedRuntimeVersion, PathForWebsite = this.PathForWebsite, PortForWebsite = this.PortForWebsite, Enable32BitAppOnWin64 = Bit32Requested, SetProcessModelIdentity = this.ProcessModelIdentityTypeSpecified, ProcessModelIdentityType = ProcessModelIdentityType.ToProcessModelIdentityType(), ProcessModelUsername = this.ProcessModelUsername, ProcessModelPassword = this.ProcessModelPassword, AuthenticationToSet = this.AuthenticationToSet }); }
public static X509Certificate2 FindCertificateBy(string thumbprint, StoreName storeName, StoreLocation storeLocation, PhysicalServer server, DeploymentResult result) { if (string.IsNullOrEmpty(thumbprint)) return null; var certstore = new X509Store(storeName, storeLocation); try { certstore.Open(OpenFlags.ReadOnly); thumbprint = thumbprint.Trim(); thumbprint = thumbprint.Replace(" ", ""); foreach (var cert in certstore.Certificates) { if (string.Equals(cert.Thumbprint, thumbprint, StringComparison.OrdinalIgnoreCase) || string.Equals(cert.Thumbprint, thumbprint, StringComparison.InvariantCultureIgnoreCase)) { return cert; } } result.AddError("Could not find a certificate with thumbprint '{0}' on '{1}'".FormatWith(thumbprint, server.Name)); return null; } finally { certstore.Close(); } }
public override void RegisterRealTasks(PhysicalServer server) { var to = server.MapPath(_to); var archiveFilename = server.MapPath(_archiveFilename); var task = new UnzipArchiveTask(archiveFilename, to, _options, _path); server.AddTask(task); }
public override void RegisterRealTasks(PhysicalServer s) { s.AddTask(new RunSqlScriptTask(s.Name, _databaseName) { ScriptToRun = _scriptFile, InstanceName = InstanceName }); }
public override void RegisterRealTasks(PhysicalServer site) { string target = PathConverter.Convert(site, _target); string newName = PathConverter.Convert(site, _newName); var o = new RenameTask(target, newName, new DotNetPath()); site.AddTask(o); }
public override void RegisterRealTasks(PhysicalServer server) { server.AddTask(new FilePokeTask( server.MapPath(ReplaceTokens(_filePath)), _encoding, _replacements, new DotNetPath())); }
public override void RegisterRealTasks(PhysicalServer server) { server.AddTask(new CreateRegistryKeyTask(server.Name, _hive, _name)); _subKeys.Each(subKey => subKey.RegisterRealTasks(server)); _values.Each(value => server.AddTask(new CreateRegistryValueTask(server.Name, _hive, _name, value.Name, value.ValueType, value.Value))); }
public override void RegisterRealTasks(PhysicalServer site) { var path = PathConverter.Convert(site, _path); path = RemotePathHelper.Convert(site, path); var task = new GrantReadWriteTask(path, _group, new DotNetPath()); site.AddTask(task); }
public override void RegisterRealTasks(PhysicalServer site) { string filePath = site.MapPath(_filePath); var o = new XmlPokeTask(filePath, _items, _setOrInsertItems, new DotNetPath(), _namespacePrefixes); site.AddTask(o); }
public override void RegisterRealTasks(PhysicalServer site) { var path = PathConverter.Convert(site, _path); var task = new RemoveAclsInheritanceTask(path); site.AddTask(task); }
public override void RegisterRealTasks(PhysicalServer s) { s.AddTask(new FolderShareTask { PointingTo = _pointingTo, Server = s.Name, ShareName = _shareName }); }
public override void RegisterRealTasks(PhysicalServer site) { string target = _target; string newName = _newName; target = RemotePathHelper.Convert(site, target); var o = new RenameTask(target, newName, new DotNetPath()); site.AddTask(o); }
public override void RegisterRealTasks(PhysicalServer site) { var path = PathConverter.Convert(site, _path); //path = RemotePathHelper.Convert(site, path); var task = new GrantReadWriteTask(path, _group, new DotNetPath()); site.AddTask(task); }
public static string Convert(PhysicalServer server, string path) { if (server.IsLocal) { return _dotnetPath.ConvertUncShareToLocalPath(server, path); } else { return RemotePathHelper.Convert(server, path); } }
public GrantReadCertificatePrivateKeyTask(PhysicalServer server, IList<string> groups, string thumbprint, StoreName storeName, StoreLocation storeLocation, Path dotNetPath) { _dotNetPath = dotNetPath; _server = server; _thumbprint = thumbprint; _storeName = storeName; _storeLocation = storeLocation; _groups = groups; }
public override void RegisterRealTasks(PhysicalServer site) { var ub = new UriBuilder("msmq", site.Name) { Path = _queue }; site.AddTask(new SetSensibleMsmqDefaults(site, new QueueAddress(ub.Uri))); }
public GrantReadCertificatePrivateKeyTask(PhysicalServer server, IList <string> groups, string thumbprint, StoreName storeName, StoreLocation storeLocation, Path dotNetPath) { _dotNetPath = dotNetPath; _server = server; _thumbprint = thumbprint; _storeName = storeName; _storeLocation = storeLocation; _groups = groups; }
public override void RegisterRealTasks(PhysicalServer server) { string to = server.MapPath(_to); foreach (var f in _froms) { var o = new CopyDirectoryTask(f, to, _options, _path); server.AddTask(o); } }
public override void RegisterRealTasks(PhysicalServer server) { server.AddTask(new ExistsTask(new DotNetPath(), _reason, _filesShouldExist.Select(x => server.MapPath(x)).ToList(), _directoriesShouldExist.Select(x => server.MapPath(x)).ToList(), _filesShould_NOT_Exist.Select(x => server.MapPath(x)).ToList(), _directoriesShould_NOT_Exist.Select(x => server.MapPath(x)).ToList(), _shouldAbortOnError)); }
public override void RegisterRealTasks(PhysicalServer s) { s.AddTask(new FolderShareTask { PointingTo = _pointingTo, Server = s.Name, ShareName = _shareName, DeleteAndRecreate = _existingShareOptions.deleteAndRecreate }); }
public RemoteNServiceBusHostTask(string exeName, string location, PhysicalServer site, NServiceBusHostExeArgs args) { _task = new RemoteCommandLineTask(exeName) { Args = args.ToString(), ExecutableIsLocatedAt = location, Machine = site.Name, WorkingDirectory = location }; }
public LocalMsmqGrantReadTask(PhysicalServer server, string queueName, string group) { _group = group; var ub = new UriBuilder("msmq", server.Name) { Path = queueName }; _address = new QueueAddress(ub.Uri); }
public CreateRemoteMsmqQueueTask(PhysicalServer server, string queueName) { _server = server; var ub = new UriBuilder("msmq", server.Name) { Path = queueName }; Address = new QueueAddress(ub.Uri); }