void ProcessLocalQueue(DeploymentResult result) { Logging.Coarse("[msmq] Setting default permissions for on local queue '{0}'", _address.ActualUri); try { var q = new MessageQueue(_address.LocalName); q.SetPermissions(WellKnownSecurityRoles.Administrators, MessageQueueAccessRights.FullControl, AccessControlEntryType.Allow); result.AddGood("Successfully set permissions for '{0}' on queue '{1}'".FormatWith(WellKnownSecurityRoles.Administrators, _address.LocalName)); q.SetPermissions(WellKnownSecurityRoles.CurrentUser, MessageQueueAccessRights.FullControl, AccessControlEntryType.Revoke); result.AddGood("Successfully set permissions for '{0}' on queue '{1}'".FormatWith(WellKnownSecurityRoles.Administrators, _address.LocalName)); q.SetPermissions(WellKnownSecurityRoles.Everyone, MessageQueueAccessRights.FullControl, AccessControlEntryType.Revoke); result.AddGood("Successfully set permissions for '{0}' on queue '{1}'".FormatWith(WellKnownSecurityRoles.Administrators, _address.LocalName)); q.SetPermissions(WellKnownSecurityRoles.Anonymous, MessageQueueAccessRights.FullControl, AccessControlEntryType.Revoke); result.AddGood("Successfully set permissions for '{0}' on queue '{1}'".FormatWith(WellKnownSecurityRoles.Administrators, _address.LocalName)); } catch (MessageQueueException ex) { if (ex.Message.Contains("does not exist")) { throw new DeploymentException("The queue '{0}' doesn't exist.", ex); } throw; } }
public void CheckForSiteAndVDirExistance(Func <bool> website, Func <bool> vdir, DeploymentResult result) { if (website()) { result.AddGood("Found Website '{0}'", WebsiteName); if (vdir()) { result.AddGood("Found VDir '{0}'", VdirPath); } else { result.AddAlert("Couldn't find VDir '{0}'", VdirPath); if (ShouldCreate) { result.AddAlert("The VDir '{0}' will be created", VdirPath); } } } else { result.AddAlert("Couldn't find Website '{0}'", WebsiteName); if (ShouldCreate) { result.AddAlert("Website '{0}' and VDir '{1}' will be created", WebsiteName, VdirPath); } } }
public void CheckForSiteAndVDirExistance(Func<bool> website, Func<bool> vdir, DeploymentResult result) { if (website()) { result.AddGood("Found Website '{0}'", WebsiteName); if (vdir()) { result.AddGood("Found VDir '{0}'", VdirPath); } else { result.AddAlert("Couldn't find VDir '{0}'", VdirPath); if (ShouldCreate) result.AddAlert("The VDir '{0}' will be created", VdirPath); } } else { result.AddAlert("Couldn't find Website '{0}'", WebsiteName); if (ShouldCreate) result.AddAlert("Website '{0}' and VDir '{1}' will be created", WebsiteName, VdirPath); } }
void ProcessLocalQueue(DeploymentResult result) { Logging.Coarse("[msmq] Setting default permissions for on local queue '{0}'", _address.ActualUri); try { var q = new MessageQueue(_address.LocalName); q.SetPermissions(WellKnownSecurityRoles.Administrators, MessageQueueAccessRights.FullControl, AccessControlEntryType.Allow); result.AddGood("Successfully set permissions for '{0}' on queue '{1}'".FormatWith(WellKnownSecurityRoles.Administrators, _address.LocalName)); q.SetPermissions(WellKnownSecurityRoles.CurrentUser, MessageQueueAccessRights.FullControl, AccessControlEntryType.Revoke); result.AddGood("Successfully set permissions for '{0}' on queue '{1}'".FormatWith(WellKnownSecurityRoles.Administrators, _address.LocalName)); q.SetPermissions(WellKnownSecurityRoles.Everyone, MessageQueueAccessRights.FullControl, AccessControlEntryType.Revoke); result.AddGood("Successfully set permissions for '{0}' on queue '{1}'".FormatWith(WellKnownSecurityRoles.Administrators, _address.LocalName)); q.SetPermissions(WellKnownSecurityRoles.Anonymous, MessageQueueAccessRights.FullControl, AccessControlEntryType.Revoke); result.AddGood("Successfully set permissions for '{0}' on queue '{1}'".FormatWith(WellKnownSecurityRoles.Administrators, _address.LocalName)); } catch (MessageQueueException ex) { if (ex.Message.Contains("does not exist")) throw new DeploymentException("The queue '{0}' doesn't exist.", ex); throw; } }
public override DeploymentResult Execute() { var result = new DeploymentResult(); if (ServiceExists()) { if (!dropkick.Wmi.WmiService.AuthenticationSpecified) { using (var c = new ServiceController(ServiceName, MachineName)) { Logging.Coarse("[svc] Stopping service '{0}'", ServiceName); if (c.CanStop) { int pid = GetProcessId(ServiceName); c.Stop(); c.WaitForStatus(ServiceControllerStatus.Stopped, 30.Seconds()); WaitForProcessToDie(pid); } } result.AddGood("Stopped Service '{0}'", ServiceName); Logging.Coarse("[svc] Stopped service '{0}'", ServiceName); } else { if (!ServiceIsRunning()) { result.AddGood("Stopping Service '{0}', Service Already Stopped", ServiceName); Logging.Coarse("[svc] Stopping service '{0}', service already stopped", ServiceName); } else { var status = dropkick.Wmi.WmiService.Stop(MachineName, ServiceName); switch (status) { case Wmi.ServiceReturnCode.StatusServiceExists: case Wmi.ServiceReturnCode.Success: result.AddGood("Stopped Service '{0}'", ServiceName); Logging.Coarse("[svc] Stopped service '{0}'", ServiceName); break; default: //BAD throw new Exception("Failed to stop service {0}: {1}".FormatWith(ServiceName, status)); } } result.AddGood("Stopped Service '{0}'", ServiceName); Logging.Coarse("[svc] Stopped service '{0}'", ServiceName); } } else { result.AddAlert("Service '{0}' does not exist and could not be stopped", ServiceName); Logging.Coarse("[svc] Service '{0}' does not exist.", ServiceName); } return(result); }
public DeploymentResult VerifyCanRun() { var result = new DeploymentResult(); if (File.Exists(System.IO.Path.GetFileName(_fileName))) { result.AddGood(string.Format("{0} exists and will be deleted.", _fileName)); } else { result.AddGood(string.Format("{0} does not exist, so cannot be deleted.", _fileName)); } return result; }
public DeploymentResult Execute() { var result = new DeploymentResult(); var to = _path.GetFullPath(_to); if (Directory.Exists(to)) result.AddGood("'{0}' already exists.".FormatWith(to)); else { result.AddGood(Name); Directory.CreateDirectory(to); } return result; }
public DeploymentResult VerifyCanRun() { var result = new DeploymentResult(); if (File.Exists(System.IO.Path.GetFileName(_fileName))) { result.AddGood(string.Format("{0} exists and will be deleted.", _fileName)); } else { result.AddGood(string.Format("{0} does not exist, so cannot be deleted.", _fileName)); } return(result); }
public DeploymentResult Execute() { var result = new DeploymentResult(); if (File.Exists(_fileName)) { File.Delete(_fileName); result.AddGood(string.Format("{0} exists and was deleted.", _fileName)); } else { result.AddGood(string.Format("{0} does not exist, so cannot be deleted.", _fileName)); } return(result); }
public DeploymentResult Execute() { var result = new DeploymentResult(); var psi = new ProcessStartInfo(Command, Args); psi.UseShellExecute = false; psi.CreateNoWindow = true; psi.RedirectStandardOutput = true; if (!string.IsNullOrEmpty(WorkingDirectory)) { psi.WorkingDirectory = WorkingDirectory; } string output; using (Process p = Process.Start(psi)) { //what to do here? p.WaitForExit(30.Seconds().Milliseconds); output = p.StandardOutput.ReadToEnd(); } result.AddGood("Command Line Executed"); return(result); }
void BuildApplicationPool(ServerManager mgr, DeploymentResult result) { if (string.IsNullOrEmpty(AppPoolName)) { return; } if (mgr.ApplicationPools.Any(x => x.Name == AppPoolName)) { LogIis("[iis7] Found the AppPool '{0}' skipping work", AppPoolName); return; } var pool = mgr.ApplicationPools.Add(AppPoolName); if (Enable32BitAppOnWin64) { pool.Enable32BitAppOnWin64 = true; } pool.ManagedRuntimeVersion = ManagedRuntimeVersion; if (UseClassicPipeline) { pool.ManagedPipelineMode = ManagedPipelineMode.Classic; } LogIis("[iis7] Created app pool '{0}'", AppPoolName); result.AddGood("Created app pool '{0}'", AppPoolName); }
public DeploymentResult VerifyCanRun() { var result = new DeploymentResult(); try { File.GetAttributes(_target); result.AddGood(string.Format("{0} exists and will be deleted.", _target)); } catch (Exception ex) { result.AddGood(string.Format("{0} does not exist, deletion skipped.", _target)); } return result; }
public override DeploymentResult VerifyCanRun() { var result = new DeploymentResult(); //can I connect to the server? IDbConnection conn = null; try { conn = GetConnection(); conn.Open(); result.AddGood("I can talk to the database"); } catch (Exception) { result.AddAlert("I cannot open the connection"); throw; } finally { if (conn != null) { conn.Close(); conn.Dispose(); } } //can I connect to the database? if (OutputSql != null) result.AddAlert(string.Format("I will run the sql '{0}'", OutputSql)); return result; }
public DeploymentResult Execute() { var result = new DeploymentResult(); ValidatePath(result, _to); ValidatePath(result, _from); _from = Path.GetFullPath(_from); _to = Path.GetFullPath(_to); //todo: verify that from exists if (!Directory.Exists(_to)) { Directory.CreateDirectory(_to); } if (Directory.Exists(_from)) { foreach (string file in Directory.GetFiles(_from)) { //need to support recursion string fileName = Path.GetFileName(file); File.Copy(file, Path.Combine(_to, fileName)); //log file was copied / event? } //what do you want to do if the directory DOESN'T exist? } result.AddGood("Copied stuff"); return result; }
public override DeploymentResult Execute() { var result = new DeploymentResult(); ValidatePath(result, _to); ValidatePath(result, _from); _from = _path.GetFullPath(_from); _to = _path.GetFullPath(_to); if (_clearOptions == DestinationCleanOptions.Delete) { DeleteDestinationFirst(new DirectoryInfo(_to), result); } if (_clearOptions == DestinationCleanOptions.Clear) { CleanDirectoryContents(result, new DirectoryInfo(_to), _clearIgnorePatterns); } CopyDirectory(result, new DirectoryInfo(_from), new DirectoryInfo(_to), _copyIgnorePatterns); result.AddGood(Name); return(result); }
public override DeploymentResult VerifyCanRun() { var result = new DeploymentResult(); ValidateIsFile(result, _filePath); result.AddGood(Name); return result; }
public override DeploymentResult Execute() { var result = new DeploymentResult(); var iisManager = ServerManager.OpenRemote(ServerName); BuildApplicationPool(iisManager, result); if (!DoesSiteExist(result)) CreateWebSite(iisManager, WebsiteName, result); Site site = GetSite(iisManager, WebsiteName); BuildVirtualDirectory(site, iisManager, result); try { iisManager.CommitChanges(); result.AddGood("'{0}' was created/updated successfully.", VirtualDirectoryPath); } catch (COMException ex) { if (ProcessModelIdentityType == ProcessModelIdentityType.SpecificUser) throw new DeploymentException("An exception occurred trying to apply deployment changes. If you are attempting to set the IIS " + "Process Model's identity to a specific user then ensure that you are running DropKick with elevated privileges, or UAC is disabled.", ex); throw; } LogCoarseGrain("[iis7] {0}", Name); return result; }
public override DeploymentResult Execute() { var result = new DeploymentResult(); if (ServiceExists()) { using (var c = new ServiceController(ServiceName, MachineName)) { Logging.Coarse("[svc] Stopping service '{0}'", ServiceName); if (c.CanStop) { int pid = GetProcessId(ServiceName); c.Stop(); c.WaitForStatus(ServiceControllerStatus.Stopped, 30.Seconds()); //WaitForProcessToDie(pid); } } result.AddGood("Stopped Service '{0}'", ServiceName); Logging.Coarse("[svc] Stopped service '{0}'", ServiceName); } else { result.AddAlert("Service '{0}' does not exist and could not be stopped", ServiceName); Logging.Coarse("[svc] Service '{0}' does not exist.", ServiceName); } return result; }
public override DeploymentResult Execute() { var result = new DeploymentResult(); var iisManager = ServerManager.OpenRemote(ServerName); BuildApplicationPool(iisManager, result); if (!DoesSiteExist(result)) { CreateWebSite(iisManager, WebsiteName, result); } Site site = GetSite(iisManager, WebsiteName); if (!DoesVirtualDirectoryExist(site)) { result.AddAlert("'{0}' doesn't exist. creating.", VdirPath); CreateVirtualDirectory(site, iisManager); result.AddGood("'{0}' was created", VdirPath); } iisManager.CommitChanges(); LogCoarseGrain("[iis7] {0}", Name); return(result); }
public override DeploymentResult Execute() { var result = new DeploymentResult(); var iisManager = ServerManager.OpenRemote(ServerName); BuildApplicationPool(iisManager, result); if (!DoesSiteExist(result)) { CreateWebSite(iisManager, WebsiteName, result); } Site site = GetSite(iisManager, WebsiteName); BuildVirtualDirectory(site, iisManager, result); try { iisManager.CommitChanges(); result.AddGood("'{0}' was created/updated successfully.", VirtualDirectoryPath); } catch (COMException ex) { if (ProcessModelIdentityType == ProcessModelIdentityType.SpecificUser) { throw new DeploymentException("An exception occurred trying to apply deployment changes. If you are attempting to set the IIS " + "Process Model's identity to a specific user then ensure that you are running DropKick with elevated privileges, or UAC is disabled.", ex); } throw; } LogCoarseGrain("[iis7] {0}", Name); return(result); }
public override DeploymentResult Execute() { var result = new DeploymentResult(); if (ServiceExists()) { using (var c = new ServiceController(ServiceName, MachineName)) { Logging.Coarse("[svc] Stopping service '{0}'", ServiceName); if (c.CanStop) { int pid = GetProcessId(ServiceName); c.Stop(); c.WaitForStatus(ServiceControllerStatus.Stopped, 30.Seconds()); WaitForProcessToDie(pid); } } result.AddGood("Stopped Service '{0}'", ServiceName); Logging.Coarse("[svc] Stopped service '{0}'", ServiceName); } else { result.AddAlert("Service '{0}' does not exist and could not be stopped", ServiceName); Logging.Coarse("[svc] Service '{0}' does not exist.", ServiceName); } return(result); }
public DeploymentResult Execute() { Thread.Sleep(_waitTime); var result = new DeploymentResult(); result.AddGood("Waited for '{0}' seconds", _waitTime.TotalSeconds.ToString()); return result; }
public DeploymentResult Execute() { var result = new DeploymentResult(); var managementClass = new ManagementClass("Win32_Share"); ManagementBaseObject args = managementClass.GetMethodParameters("Create"); args["Description"] = Description; args["Name"] = ShareName; args["Path"] = PointingTo; args["Type"] = 0x0; // Disk Drive ManagementBaseObject outParams = managementClass.InvokeMethod("Create", args, null); // Check to see if the method invocation was successful if (outParams != null && (uint)(outParams.Properties["ReturnValue"].Value) != 0) { throw new Exception("Unable to share directory '{0}' as '{2}' on '{1}'.".FormatWith(PointingTo, Server, ShareName)); } result.AddGood("Created share"); return(result); }
public DeploymentResult Execute() { var result = new DeploymentResult(); if (File.Exists(_fileName)) { File.Delete(_fileName); result.AddGood(string.Format("{0} exists and was deleted.", _fileName)); } else { result.AddGood(string.Format("{0} does not exist, so cannot be deleted.", _fileName)); } return result; }
public DeploymentResult Execute() { var result = new DeploymentResult(); ValidatePath(result, _to); ValidatePath(result, _from); _from = Path.GetFullPath(_from); _to = Path.GetFullPath(_to); //todo: verify that from exists if (!Directory.Exists(_to)) { Directory.CreateDirectory(_to); } if (Directory.Exists(_from)) { foreach (string file in Directory.GetFiles(_from)) { //need to support recursion string fileName = Path.GetFileName(file); File.Copy(file, Path.Combine(_to, fileName)); //log file was copied / event? } //what do you want to do if the directory DOESN'T exist? } result.AddGood("Copied stuff"); return(result); }
public override DeploymentResult Execute() { var result = new DeploymentResult(); if (UserName.ShouldPrompt()) { UserName = _prompt.Prompt("Win Service '{0}' UserName".FormatWith(ServiceName)); } if (Password.ShouldPrompt()) { Password = _prompt.Prompt("Win Service '{0}' For User '{1}' Password".FormatWith(ServiceName, UserName)); } ServiceReturnCode returnCode = WmiService.Create(MachineName, ServiceName, ServiceDisplayName, ServiceLocation, StartMode, UserName, Password, Dependencies); if (returnCode != ServiceReturnCode.Success) { result.AddAlert("Create service returned {0}".FormatWith(returnCode.ToString())); } else { result.AddGood("Create service succeeded."); } return(result); }
public DeploymentResult Execute() { var result = new DeploymentResult(); var to = _path.GetFullPath(_to); if (Directory.Exists(to)) { result.AddGood("'{0}' already exists.".FormatWith(to)); } else { result.AddGood(Name); Directory.CreateDirectory(to); } return(result); }
public override DeploymentResult VerifyCanRun() { var result = new DeploymentResult(); ValidateIsFile(result, _filePath); result.AddGood(Name); return(result); }
public DeploymentResult VerifyCanRun() { var result = new DeploymentResult(); ValidatePath(result, _to); ValidatePath(result, _from); _from = Path.GetFullPath(_from); _to = Path.GetFullPath(_to); //check can write from _to if (!Directory.Exists(_to)) { result.AddAlert(string.Format("'{0}' doesn't exist and will be created", _to)); } if (Directory.Exists(_from)) { result.AddGood(string.Format("'{0}' exists", _from)); //check can read from _from string[] readFiles = Directory.GetFiles(_from); foreach (string file in readFiles) { Stream fs = new MemoryStream(); try { fs = File.Open(file, FileMode.Open, FileAccess.Read); result.AddGood(string.Format("Going to copy '{0}' to '{1}'", file, _to)); } catch (Exception) { result.AddAlert("CopyTask: Can't read file '{0}'"); } finally { fs.Dispose(); } } } else { result.AddAlert(string.Format("'{0}' doesn't exist", _from)); } return(result); }
public override DeploymentResult Execute() { var result = new DeploymentResult(); if (!MessageQueue.Exists(Address.LocalName)) { result.AddAlert("'{0}' does not exist and will be created.".FormatWith(Address.FormatName)); MessageQueue.Create(Address.LocalName); result.AddGood("Created queue '{0}'".FormatWith(Address.FormatName)); } else { result.AddGood("'{0}' already exists.".FormatWith(Address.FormatName)); } return(result); }
public DeploymentResult VerifyCanRun() { var result = new DeploymentResult(); var to = _path.GetFullPath(_to); //TODO figure out a good verify step... result.AddGood(Directory.Exists(to) ? "'{0}' already exists.".FormatWith(to) : Name); return result; }
public override DeploymentResult Execute() { var result = new DeploymentResult(); if (!MessageQueue.Exists(Address.LocalName)) { result.AddAlert("'{0}' does not exist and will be created.".FormatWith(Address.FormatName)); MessageQueue.Create(Address.LocalName, _transactional); result.AddGood("Created queue '{0}'".FormatWith(Address.FormatName)); } else { result.AddGood("'{0}' already exists.".FormatWith(Address.FormatName)); } return result; }
public DeploymentResult Execute() { Thread.Sleep(_waitTime); var result = new DeploymentResult(); result.AddGood("Waited for '{0}' seconds", _waitTime.TotalSeconds.ToString()); return(result); }
public override DeploymentResult VerifyCanRun() { var result = new DeploymentResult(); ValidatePath(result, _to); ValidatePath(result, _from); _from = _path.GetFullPath(_from); _to = _path.GetFullPath(_to); //check can write from _to if (_path.DirectoryDoesntExist(_to)) { result.AddAlert(string.Format("'{0}' doesn't exist and will be created", _to)); } if (_clearOptions == DestinationCleanOptions.Delete) { result.AddAlert("The files and directories in '{0}' will be deleted before deploying, except for items being ignored.", _to); } if (_clearOptions == DestinationCleanOptions.Clear) { result.AddAlert("The files in '{0}' will be cleared before deploying, except for items being ignored.", _to); } DirectoryInfo fromDirectory = new DirectoryInfo(_from); if (fromDirectory.Exists) { result.AddGood(string.Format("'{0}' exists", fromDirectory.FullName)); //check can read from _from FileInfo[] readFiles = fromDirectory.GetFiles(); foreach (var file in readFiles.Where(f => !IsIgnored(_copyIgnorePatterns, f))) { Stream fs = new MemoryStream(); try { fs = File.Open(file.FullName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); _log.DebugFormat("Going to copy '{0}' to '{1}'", file.FullName, _to); } catch (Exception) { result.AddAlert("CopyDirectoryTask: Can't read file '{0}'"); } finally { fs.Dispose(); } } } else { result.AddAlert(string.Format("'{0}' doesn't exist", _from)); } return(result); }
public DeploymentResult VerifyCanRun() { var result = new DeploymentResult(); var to = _path.GetFullPath(_to); //TODO figure out a good verify step... result.AddGood(Directory.Exists(to) ? "'{0}' already exists.".FormatWith(to) : Name); return(result); }
protected static void DeleteDestinationFirst(DirectoryInfo directory, DeploymentResult result) { if (directory.Exists) { directory.Delete(true); result.AddGood("'{0}' was successfully deleted".FormatWith(directory.FullName)); //TODO: a delete list? } }
void BuildApplicationPool(ServerManager mgr, DeploymentResult result) { if (string.IsNullOrEmpty(AppPoolName)) { return; } ApplicationPool pool = mgr.ApplicationPools.FirstOrDefault(x => x.Name == AppPoolName); if (pool == null) { LogIis("App pool '{0}' does not exist, creating.", AppPoolName); pool = mgr.ApplicationPools.Add(AppPoolName); } else { LogIis("[iis7] Found the AppPool '{0}', updating as necessary.", AppPoolName); } if (Enable32BitAppOnWin64) { pool.Enable32BitAppOnWin64 = true; LogIis("[iis7] Enabling 32bit application on Win64."); } pool.ManagedRuntimeVersion = ManagedRuntimeVersion; LogIis("[iis7] Using managed runtime version '{0}'", ManagedRuntimeVersion); if (UseClassicPipeline) { pool.ManagedPipelineMode = ManagedPipelineMode.Classic; LogIis("[iis7] Using Classic managed pipeline mode."); } result.AddGood("App pool '{0}' created/updated.", AppPoolName); if (SetProcessModelIdentity) { SetApplicationPoolIdentity(pool); result.AddGood("Set process model identity '{0}'", ProcessModelIdentityType); } //pool.Recycle(); }
private void testArchive(DeploymentResult result) { if (!ZipFile.IsZipFile(_zipArchiveFilename)) result.AddError(String.Format("The file '{0}' is not a valid zip archive.", _zipArchiveFilename)); using (var zip = ZipFile.Read(_zipArchiveFilename)) { result.AddGood("{0} items will be extracted from '{1}' to '{2}'", zip.Count, _zipArchiveFilename, _to); } }
public override DeploymentResult VerifyCanRun() { var result = new DeploymentResult(); VerifyRegistryHivePermissions(result); result.AddGood(Name); return(result); }
public override DeploymentResult VerifyCanRun() { var result = new DeploymentResult(); VerifyRegistryHivePermissions(result); result.AddGood(Name); return result; }
public DeploymentResult VerifyCanRun() { //verify admin var result = new DeploymentResult(); if (!Directory.Exists(PointingTo)) result.AddAlert("'{0}' doesn't exist", PointingTo); else result.AddGood("'{0}' exists", PointingTo); return result; }
void VerifyInAdministratorRole(DeploymentResult result) { if (Thread.CurrentPrincipal.IsInRole("Administrator")) { result.AddAlert("You are not in the Administrator role"); } else { result.AddGood("You are in the Administrator role"); } }
private void VerifyInAdministratorRole(DeploymentResult result) { if (Thread.CurrentPrincipal.IsInRole("Administrator")) { result.AddAlert("You are not in the Administrator role"); } else { result.AddGood("You are in the Administrator role"); } }
protected void VerifyInAdministratorRole(DeploymentResult result) { if (Thread.CurrentPrincipal.IsInRole("Administrator")) { result.AddAlert("You are not in the 'Administrator' role. You will not be able to start/stop services"); } else { result.AddGood("You are in the 'Administrator' role"); } }
void ProcessLocalQueue(DeploymentResult result) { Logging.Coarse("[msmq] Setting permissions for '{0}' on local queue '{1}'", _group, _address.ActualUri); var q = new MessageQueue(_address.FormatName); q.SetPermissions(_group, MessageQueueAccessRights.GetQueuePermissions, AccessControlEntryType.Allow); q.SetPermissions(_group, MessageQueueAccessRights.GetQueueProperties, AccessControlEntryType.Allow); q.SetPermissions(_group, MessageQueueAccessRights.WriteMessage, AccessControlEntryType.Allow); result.AddGood("Successfully granted Write permissions to '{0}' for queue '{1}'".FormatWith(_group, _address.ActualUri)); }
public DeploymentResult Execute() { Console.WriteLine(); Console.WriteLine(Name); Console.WriteLine("Press enter to continue."); Console.ReadLine(); var result = new DeploymentResult(); result.AddGood("User pressed enter to continue deployment."); return result; }
protected void DeleteDestinationFirst(DirectoryInfo directory, DeploymentResult result) { if (directory.Exists) { RemoveReadOnlyAttributes(directory, result); directory.Delete(true); result.AddGood("'{0}' was successfully deleted".FormatWith(directory.FullName)); //TODO: a delete list? } }
public override DeploymentResult Execute() { var result = new DeploymentResult(); _filePath = _path.GetFullPath(_filePath); ValidateIsFile(result, _filePath); UpdateXmlFile(result, _filePath, _replacementItems); result.AddGood(Name); return result; }
public DeploymentResult Execute() { Console.WriteLine(); Console.WriteLine(Name); Console.WriteLine("Press enter to continue."); Console.ReadLine(); var result = new DeploymentResult(); result.AddGood("User pressed enter to continue deployment."); return(result); }
public override DeploymentResult VerifyCanRun() { var result = new DeploymentResult(); if (_address.IsLocal) VerifyInAdministratorRole(result); else result.AddAlert("Cannot set permissions for the private remote queue '{0}' while on server '{1}'".FormatWith(_address.ActualUri, Environment.MachineName)); result.AddGood(Name); return result; }
public DeploymentResult VerifyCanRun() { var result = new DeploymentResult(); if (!Directory.Exists(ExecutableIsLocatedAt)) result.AddAlert(string.Format("Can't find the executable '{0}'", Path.Combine(ExecutableIsLocatedAt, Command))); if (IsTheExeInThisDirectory(ExecutableIsLocatedAt, Command)) result.AddGood(string.Format("Found command '{0}' in '{1}'", Command, ExecutableIsLocatedAt)); return result; }
public DeploymentResult Execute() { var result = new DeploymentResult(); ValidateFile(result, _target); RenameFile(new FileInfo(_target), new FileInfo(_newName)); result.AddGood(Name); return result; }
private void testArchive(DeploymentResult result) { if (!ZipFile.IsZipFile(_zipArchiveFilename)) { result.AddError(String.Format("The file '{0}' is not a valid zip archive.", _zipArchiveFilename)); } using (var zip = ZipFile.Read(_zipArchiveFilename)) { result.AddGood("{0} items will be extracted from '{1}' to '{2}'", zip.Count, _zipArchiveFilename, _to); } }
public override DeploymentResult VerifyCanRun() { var result = new DeploymentResult(); _from = _path.GetFullPath(_from); _to = _path.GetFullPath(_to); ValidatePaths(result); result.AddGood(Name); return result; }
public DeploymentResult Execute() { var result = new DeploymentResult(); if ((File.GetAttributes(_target) & FileAttributes.Directory) == FileAttributes.Directory) RenameDirectory(new DirectoryInfo(_target), new DirectoryInfo(_newName)); else RenameFile(new FileInfo(_target), new FileInfo(_newName)); result.AddGood(Name); return result; }
public override DeploymentResult Execute() { var result = new DeploymentResult(); var security = Directory.GetAccessControl(_path); security.SetAccessRuleProtection(true, true); Directory.SetAccessControl(_path, security); LogSecurity("[security][acl] Removed ACL inheritance on '{0}'. Preserved existing security.", _path); result.AddGood("Removed ACL inheritance on '{0}'. Preserved existing security.", _path); return result; }
public override DeploymentResult Execute() { var result = new DeploymentResult(); Logging.Coarse("[msmq] Setting '{0}' access rights for '{1}' on local queue '{2}'", _accessRights, _user, _address.ActualUri); var q = new MessageQueue(_address.FormatName); q.SetPermissions(_user, _accessRights, AccessControlEntryType.Allow); result.AddGood("Successfully granted '{0}' access rights to '{1}' for queue '{2}'".FormatWith(_accessRights, _user, _address.ActualUri)); return result; }