Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command line too long when Busser is trying to upload test files to the guest #11

Open
jhosm opened this issue Nov 5, 2014 · 2 comments
Labels

Comments

@jhosm
Copy link

jhosm commented Nov 5, 2014

Hi,

I'm using ServerSpec with Test Kitchen to validate Windows platforms, altough I believe the problem is with busser and not with ServerSpec.

When my spec files pass a given threshold in size, I get the following error:

D      ---Nested Exception---
D      Class: Kitchen::Transport::TransportFailed
D      Message: Transport WinRM exited (1) using shell [powershell] for command: [$env:BUSSER_ROOT="/tmp/busser"; $env:G
EM_HOME="/tmp/busser/gems"; $env:GEM_PATH="/tmp/busser/gems"; $env:PATH="$env:PATH;$env:GEM_PATH/bin"; try { $env:BUSSER
_SUITE_PATH=@(busser suite path) } catch { $env:BUSSER_SUITE_PATH="" }; $env:GEM_CACHE="/tmp/busser/gems/cache"

busser suite cleanup

echo "Uploading $env:BUSSER_SUITE_PATH/serverspec/default_spec.rb (mode=0644)"
echo "<a big BASE64 string>" | busser deserialize --d
estination=$env:BUSSER_SUITE_PATH/serverspec/default_spec.rb --md5sum=ae128f6996f939cab5d3b3129919bf5f --perms=0644

echo "Uploading $env:BUSSER_SUITE_PATH/serverspec/event_logs_spec.rb (mode=0644)"
echo "<another big BASE64 string>" | bu
sser deserialize --destination=$env:BUSSER_SUITE_PATH/serverspec/event_logs_spec.rb --md5sum=e5bd4859e688b7581c07f97bdbe
b709c --perms=0644

echo "Uploading $env:BUSSER_SUITE_PATH/serverspec/windows_features_spec.rb (mode=0644)"
echo "<yet another big BASE64 string>" | busser deserialize --destination=$env:BUSSER_SUITE_PATH/serverspec/windows_features_spec.rb --md5sum=dc7f436ca8091
fb632d443e7548cf428 --perms=0644

]
REMOTE ERROR:
The command line is too long.

D      ------Backtrace-------
D      C:/opscode/chefdk/embedded/apps/test-kitchen/lib/kitchen/transport/winrm.rb:54:in `execute'
D      C:/opscode/chefdk/embedded/apps/test-kitchen/lib/kitchen/driver/base.rb:95:in `block in verify'
D      C:/opscode/chefdk/embedded/apps/test-kitchen/lib/kitchen/transport/base.rb:73:in `connection'
D      C:/opscode/chefdk/embedded/apps/test-kitchen/lib/kitchen/driver/base.rb:94:in `verify'
D      C:/opscode/chefdk/embedded/lib/ruby/gems/2.0.0/gems/kitchen-vagrant-0.15.0/lib/kitchen/driver/vagrant.rb:92:in `v
erify'
D      C:/opscode/chefdk/embedded/apps/test-kitchen/lib/kitchen/instance.rb:373:in `public_send'
D      C:/opscode/chefdk/embedded/apps/test-kitchen/lib/kitchen/instance.rb:373:in `block in perform_action'
D      C:/opscode/chefdk/embedded/apps/test-kitchen/lib/kitchen/instance.rb:437:in `call'
D      C:/opscode/chefdk/embedded/apps/test-kitchen/lib/kitchen/instance.rb:437:in `synchronize_or_call'
D      C:/opscode/chefdk/embedded/apps/test-kitchen/lib/kitchen/instance.rb:402:in `block in action'
D      C:/opscode/chefdk/embedded/lib/ruby/2.0.0/benchmark.rb:281:in `measure'
D      C:/opscode/chefdk/embedded/apps/test-kitchen/lib/kitchen/instance.rb:401:in `action'
D      C:/opscode/chefdk/embedded/apps/test-kitchen/lib/kitchen/instance.rb:373:in `perform_action'
D      C:/opscode/chefdk/embedded/apps/test-kitchen/lib/kitchen/instance.rb:351:in `verify_action'
D      C:/opscode/chefdk/embedded/apps/test-kitchen/lib/kitchen/instance.rb:313:in `block in transition_to'
D      C:/opscode/chefdk/embedded/apps/test-kitchen/lib/kitchen/instance.rb:312:in `each'
D      C:/opscode/chefdk/embedded/apps/test-kitchen/lib/kitchen/instance.rb:312:in `transition_to'
D      C:/opscode/chefdk/embedded/apps/test-kitchen/lib/kitchen/instance.rb:160:in `verify'
D      C:/opscode/chefdk/embedded/apps/test-kitchen/lib/kitchen/command.rb:176:in `public_send'
D      C:/opscode/chefdk/embedded/apps/test-kitchen/lib/kitchen/command.rb:176:in `block (2 levels) in run_action'
D      C:/Users/jhm/.chefdk/gem/ruby/2.0.0/gems/logging-1.8.2/lib/logging/diagnostic_context.rb:323:in `call'
D      C:/Users/jhm/.chefdk/gem/ruby/2.0.0/gems/logging-1.8.2/lib/logging/diagnostic_context.rb:323:in `block in create_
with_logging_context'

I've digged into it and I believe that the issue is we're telling powershell to execute a command that hits some ceiling.

I made a quick hack on \test-kitchen\lib\kitchen\busser.rb:

  def sync_cmd
      return if local_suite_files.empty?

      cmd = <<-CMD.gsub(/^ {8}/, "")
        #{busser_setup_env}

        #{sudo(config[:busser_bin])} suite cleanup

      CMD

      #if shell == "bourne"
        local_suite_files.each do |f|
          cmd << stream_file(f, remote_file(f, config[:suite_name])).concat("\n")
        end
        helper_files.each do |f|
          cmd << stream_file(f, remote_file(f, "helpers")).concat("\n")
        end
      #end

      Util.wrap_command(cmd, shell)
    end

    def sync_files
      if shell == "powershell"
        suite_files = { local: local_suite_files + helper_files, remote: 'C:\tmp\busser\suites\serverspec' }
        [suite_files]
      else
        []
      end
    end

and \test-kitchen\lib\kitchen\driver\base.rb:

def verify(state)
  transport.connection(state) do |conn|
    conn.execute(busser.sync_cmd)
    files_to_upload = busser.sync_files
    files_to_upload.each do |files|
      conn.upload!(files[:local], files[:remote])
    end
    conn.execute(busser.run_cmd)
  end
end

and the problem when away. This is obviously not the correct solution but I do not know what would the best solution be.

Cheers,
João

@afiune afiune added the bug label Dec 19, 2014
@afiune
Copy link
Owner

afiune commented Dec 19, 2014

@jhosm Apologies for the late response.. I have been very busy for that past days and I couldn't answer sooner. But I want to thank you for using/testing/fixing this fork.

I have many people that report this bug so I will be checking solutions (of course I will consider yours) and let you know the results/findings.

Could you share your serverspec file?
What version of Windows are you runnning on?

Thanks and keep me posted!

@jhosm
Copy link
Author

jhosm commented Jan 1, 2015

I'm running on 2008R2 and 2012R2.

I don't have the serverspec file with me right now, but it's pretty vanilla. The issue is really the size of the serverspec files that get transfered, which has a very low limit. I can't remember exactly right now, but I do believe that the issue is the sum of all the serverspec files sizes. So even if you have really small files but a sufficient number of them, the issue also crops up.

afiune pushed a commit that referenced this issue Oct 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants