Windows knife troubles, ATTN: adamed

Hello,

I have troubles with running knife on windows. A simple task of adding
a role fails. Here http://pastebin.com/P4cFwH6u you can see that role
"role[_123456789-qwerqvasfrqetftwgrsygahbafd]" cannot be assigned to
the box, recipe[roles] assigned instead.

irc#chef @coderanger guy suggested to ask adamed for help.

I used that strange long role name because I can easily reproduce the
problem. Sometimes it fails with pretty small and human readable role
names like ‘foo-bar’. But the problem is hard to reproduce every time.
The same command works very well on linux.

One more issue windows knife command runs 4.25 times slower than linux
knife command:
linux$ time knife search node ‘name:BBX032-VA-1’

real 0m1.916s

windows> Measure-Command {knife search node ‘name:BBX032-VA-1’}

TotalSeconds : 8.1286333.

I.e. it’s x4.25 slower

We’re evaluating enterprise chef as a solution to manage 4k boxes.
Mostly windows boxes managed by mostly windows sysadmins. So we need a
good windows support for workstation and for nodes.
That first issue is a showstopper for us. The second issue isn’t so
critical but still it’s a pain.

Thanks.

Hello – your first issue sounds like a quoting / globbing issue we’ve seen
before caused by the mingw layer’s command line parsing. If you have a
directory / file that starts with “role” in the cwd, that can trigger this.
That’s often the case in a “chef-repo” directory – here are some tickets
that track this:

https://tickets.opscode.com/browse/CHEF-2486
https://tickets.opscode.com/browse/KNIFE-1

Have you tried changing your cwd, and using the -c option to specify
knife.rb so you can run it without the globbing?

I do have one other question: are you running this from PowerShell or
cmd.exe?

There aren’t great workarounds here other than the one I mentioned above,
though in the case of knife-1 it looks like some quoting magic helped. MinGw
is the right place for a fix, but there is apparently disagreement as to the
fix: http://sourceforge.net/p/mingw/bugs/1621/.

A fix on our side could simply be to add a “role” subcommand or "–role"
option so that the role can be specified without “role[x]” and globbing can
be avoided.

Thanks.

-Adam

-----Original Message-----
From: romanovsky@gmail.com [mailto:romanovsky@gmail.com] On Behalf Of Sergey
Romanovsky
Sent: Wednesday, April 23, 2014 5:57 PM
To: chef@lists.opscode.com
Subject: [chef] windows knife troubles, ATTN: adamed

Hello,

I have troubles with running knife on windows. A simple task of adding a
role fails. Here http://pastebin.com/P4cFwH6u you can see that role
"role[_123456789-qwerqvasfrqetftwgrsygahbafd]" cannot be assigned to the
box, recipe[roles] assigned instead.

irc#chef @coderanger guy suggested to ask adamed for help.

I used that strange long role name because I can easily reproduce the
problem. Sometimes it fails with pretty small and human readable role names
like ‘foo-bar’. But the problem is hard to reproduce every time.
The same command works very well on linux.

One more issue windows knife command runs 4.25 times slower than linux knife
command:
linux$ time knife search node ‘name:BBX032-VA-1’

real 0m1.916s

windows> Measure-Command {knife search node ‘name:BBX032-VA-1’}

TotalSeconds : 8.1286333.

I.e. it’s x4.25 slower

We’re evaluating enterprise chef as a solution to manage 4k boxes.
Mostly windows boxes managed by mostly windows sysadmins. So we need a good
windows support for workstation and for nodes.
That first issue is a showstopper for us. The second issue isn’t so critical
but still it’s a pain.

Thanks.

Adam,

Thanks for the links. Workaround of adding a comma after a role name works fine.

I do have one other question: are you running this from PowerShell or cmd.exe?

I've tried 3 shells with the same result: cmd, ps and sh

On Thu, Apr 24, 2014 at 9:05 AM, Adam Edwards adamed@getchef.com wrote:

Hello -- your first issue sounds like a quoting / globbing issue we've seen
before caused by the mingw layer's command line parsing. If you have a
directory / file that starts with "role" in the cwd, that can trigger this.
That's often the case in a "chef-repo" directory -- here are some tickets
that track this:

https://tickets.opscode.com/browse/CHEF-2486
https://tickets.opscode.com/browse/KNIFE-1

Have you tried changing your cwd, and using the -c option to specify
knife.rb so you can run it without the globbing?

I do have one other question: are you running this from PowerShell or
cmd.exe?

There aren't great workarounds here other than the one I mentioned above,
though in the case of knife-1 it looks like some quoting magic helped. MinGw
is the right place for a fix, but there is apparently disagreement as to the
fix: MinGW - Minimalist GNU for Windows / Issues / #1621 MSYS bash: quoting does not prevent globbing.

A fix on our side could simply be to add a "role" subcommand or "--role"
option so that the role can be specified without "role" and globbing can
be avoided.

Thanks.

-Adam

-----Original Message-----
From: romanovsky@gmail.com [mailto:romanovsky@gmail.com] On Behalf Of Sergey
Romanovsky
Sent: Wednesday, April 23, 2014 5:57 PM
To: chef@lists.opscode.com
Subject: [chef] windows knife troubles, ATTN: adamed

Hello,

I have troubles with running knife on windows. A simple task of adding a
role fails. Here sh.EXE"-3.1$ knife node show 'BBX032-VA-1'Node Name: BBX032-VA-1Environmen - Pastebin.com you can see that role
"role[_123456789-qwerqvasfrqetftwgrsygahbafd]" cannot be assigned to the
box, recipe[roles] assigned instead.

irc#chef @coderanger guy suggested to ask adamed for help.

I used that strange long role name because I can easily reproduce the
problem. Sometimes it fails with pretty small and human readable role names
like 'foo-bar'. But the problem is hard to reproduce every time.
The same command works very well on linux.

One more issue windows knife command runs 4.25 times slower than linux knife
command:
linux$ time knife search node 'name:BBX032-VA-1'
...
real 0m1.916s

windows> Measure-Command {knife search node 'name:BBX032-VA-1'}
...
TotalSeconds : 8.1286333.

I.e. it's x4.25 slower

We're evaluating enterprise chef as a solution to manage 4k boxes.
Mostly windows boxes managed by mostly windows sysadmins. So we need a good
windows support for workstation and for nodes.
That first issue is a showstopper for us. The second issue isn't so critical
but still it's a pain.

Thanks.