Cannot copy files to remote share

36 views
Skip to first unread message

simp...@googlemail.com

unread,
Nov 19, 2014, 8:00:55 AM11/19/14
to chucknorri...@googlegroups.com
OK, so I just posted this and xacn't locate it anywhere so posting again...

I'm attempting to use roundhouse to deploy a db to a remote share however I keep getting an error that makes no sense to me.  Everytime I run it I get the following woefully unhelpful message:

Can you please explain what it means?

System.Management.ManagementException: Invalid parameter 
   at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode)
   at System.Management.ManagementPath.SetWbemPath(IWbemPath wbemPath, String path)
   at System.Management.ManagementPath.CreateWbemPath(String path)
   at dropkick.Wmi.WmiProcess.Run(String machineName, String commandLine, String args, String currentDirectory) in c:\Solutions\dk-fc\product\dropkick\Wmi\WmiProcess.cs:line 18
   at dropkick.Tasks.CommandLine.RemoteCommandLineTask.Execute() in c:\Solutions\dk-fc\product\dropkick\Tasks\CommandLine\RemoteCommandLineTask.cs:line 72
   at dropkick.DeploymentModel.DeploymentDetail.Execute() in c:\Solutions\dk-fc\product\dropkick\DeploymentModel\DeploymentDetail.cs:line 32
   at dropkick.DeploymentModel.DeploymentPlan.<>c__DisplayClass7.<Execute>b__6(DeploymentDetail d) in c:\Solutions\dk-fc\product\dropkick\DeploymentModel\DeploymentPlan.cs:line 72
   at dropkick.DeploymentModel.DeploymentPlan.<>c__DisplayClassc.<Ex>b__a(DeploymentDetail d) in c:\Solutions\dk-fc\product\dropkick\DeploymentModel\DeploymentPlan.cs:line 93
   at dropkick.DeploymentModel.DeploymentServer.ForEachDetail(Action`1 detailAction) in c:\Solutions\dk-fc\product\dropkick\DeploymentModel\DeploymentServer.cs:line 82
   at dropkick.DeploymentModel.DeploymentPlan.<>c__DisplayClassc.<Ex>b__9(DeploymentServer s) in c:\Solutions\dk-fc\product\dropkick\DeploymentModel\DeploymentPlan.cs:line 90
   at dropkick.DeploymentModel.DeploymentRole.ForEachServerMapped(Action`1 detailAction) in c:\Solutions\dk-fc\product\dropkick\DeploymentModel\DeploymentRole.cs:line 42
   at dropkick.DeploymentModel.DeploymentPlan.Ex(Action`1 action) in c:\Solutions\dk-fc\product\dropkick\DeploymentModel\DeploymentPlan.cs:line 87
   at dropkick.DeploymentModel.DeploymentPlan.Execute() in c:\Solutions\dk-fc\product\dropkick\DeploymentModel\DeploymentPlan.cs:line 60
   at dropkick.Engine.DeploymentPlanDispatcher.<.cctor>b__0(DeploymentPlan d) in c:\Solutions\dk-fc\product\dropkick\Engine\DeploymentPlanDispatcher.cs:line 30
   at dropkick.Engine.DeploymentPlanDispatcher.KickItOutThereAlready(Deployment deployment, DeploymentArguments args) in c:\Solutions\dk-fc\product\dropkick\Engine\DeploymentPlanDispatcher.cs:line 45
   at dropkick.Engine.Runner.Deploy(String commandLine) in c:\Solutions\dk-fc\product\dropkick\Engine\Runner.cs:line 131

Do I need to use access credentials as this is specified anywhere in the documentation.  If so, how is this achieved?

Here is my implementation:

public Restore()
        {
            Define(settings =>
            {

                DeploymentStepsFor(Baseline,
                    s =>
                    {
                        VerifyDeploymentIsSafe(this);

                        //prepare for copying
                        var copyFromPath = System.IO.Path.Combine(settings.DbRestoreRemoteArchive, settings.DbRestoreFile);
                        bool copyToLocalPath = string.IsNullOrWhiteSpace(settings.DbServerBaselineFolderUnc);
                        var copyToFolder = copyToLocalPath ? settings.DbServerBaselineFolder : settings.DbServerBaselineFolderUnc;
                        var copyToPath = System.IO.Path.Combine(copyToFolder, settings.DbRestoreFile);

                        System.Console.WriteLine("CopyFromPath: {0}", copyFromPath);
                        System.Console.WriteLine("CopyToLocalPath: {0}", copyToLocalPath);
                        System.Console.WriteLine("CopyToFolder: {0}", copyToFolder);
                        System.Console.WriteLine("username: {0}", WindowsIdentity.GetCurrent());
                        //System.Console.WriteLine("CopyToPath: {0}", copyToPath);

                        //System.Console.WriteLine("Copying baseline from {0} to {1}", copyFromPath, copyToPath);

                        s.CopyFile(copyFromPath).ToDirectory(copyToFolder);

                    });

                DeploymentStepsFor(Db,
                    s =>
                    {
                        VerifyDeploymentIsSafe(this);

                        //prepare for restoring
                        var restoreFromPath = System.IO.Path.Combine(settings.DbServerBaselineFolder, settings.DbRestoreFile);

                        //System.Console.WriteLine("Running roundhouse restore and update against {0}...", restoreFromPath);

                        s.CommandLine("rh.exe")
                            .Args(
                                string.Format(
                                    "--db={0} --server={1} --env={2} --files=Scripts --restore --restorefrom=\"{3}\" --restoreoptions=\"{4}\" --noninteractive --simpleoutput --ct={5}",
                                    settings.DbName, settings.DbServer, settings.Environment, restoreFromPath,
                                    settings.DbRestoreOptions, settings.CommandTimeout))
                            .ExecutableIsLocatedAt(".");

                    });
            });
        }

Rob Reynolds

unread,
Nov 19, 2014, 11:28:53 AM11/19/14
to chucknorri...@googlegroups.com
On Wed, Nov 19, 2014 at 7:00 AM, <simp...@googlemail.com> wrote:
OK, so I just posted this and xacn't locate it anywhere so posting again...

I'm attempting to use roundhouse to deploy a db to a remote share however I keep getting an error that makes no sense to me.  Everytime I run it I get the following woefully unhelpful message:

Can you please explain what it means?

System.Management.ManagementException: Invalid parameter 
   at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode)
   at System.Management.ManagementPath.SetWbemPath(IWbemPath wbemPath, String path)
   at System.Management.ManagementPath.CreateWbemPath(String path)
   at dropkick.Wmi.WmiProcess.Run(String machineName, String commandLine, String args, String currentDirectory) in c:\Solutions\dk-fc\product\dropkick\Wmi\WmiProcess.cs:line 18


This error looks to be an error with WMI process. Something in authenticating to the server when you are trying to copy the backup I imagine?
This part loses me. Is there something in the RoundhousE task that is limiting you and sending you back to calling the executable instead?
 

                    });
            });
        }

--
You received this message because you are subscribed to the Google Groups "chucknorris" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chucknorrisframe...@googlegroups.com.
To post to this group, send email to chucknorri...@googlegroups.com.
Visit this group at http://groups.google.com/group/chucknorrisframework.
For more options, visit https://groups.google.com/d/optout.



--

Mike Mooney

unread,
Nov 20, 2014, 6:05:23 AM11/20/14
to chucknorri...@googlegroups.com
Hi,

The machine it is trying to copy the files do, is it on the same network, or is it out to another data center (like Amazon or Rackspace)?  Does the account you are running under have the necessary account access to copy to that machine?

Dropkick (which is being used here to copy the files to target machine), generally works best on the same network where machines can talk to each other and have WMI enabled.  If that is not the case (like an Amazon EC2 situation), you may need to open some firewall holes to let WMI function.  I wrote a post about those steps specifically Amazon, although most of it should apply in other situations too: http://mooneyblog.mmdbsolutions.com/index.php/2013/11/01/accessing-an-amazon-vm-through-wmi/

The issue could also be if your deploy process is running under an account that does not have access to the target machine.  This could be if you are using local system accounts, or again if your target machine is on another network and there are no shared network accounts.  I have been working on a PR to enable this, which has gone through a fair amount of testing, but we're still working on getting incorporated into the Dropkick core.  If  you're interested, the PR is here https://github.com/chucknorris/dropkick/pull/58 and the branch is here: https://github.com/mmooney/dropkick/tree/remoteuser
Reply all
Reply to author
Forward
0 new messages