Search for environment with hyphen


#1

I’m having some difficulties with a node search not returning any results when matching on an environment with a hyphen in the name.

Example:

$ knife search node 'environment:production-ord’
0 items found

$ knife node show api-n01.ord.example.com
Node Name: api-n01.ord.example.com
Environment: production-ord

I’ve tried escaping the hyphen, which returns invalid search query. I’ve tried surrounding the environment name with double quotes. The search works fine for environments without a hyphen, such as “staging”.

$ knife search node 'environment:staging’
22 items found

I’m using knife from Chef 11.8.2 and the Chef server is 11.0.10.

Any help would be appreciated.


Daniel


#2

Try using an underscore instead.


~~ StormeRider ~~

“Every world needs its heroes […] They inspire us to be better than we
are. And they protect from the darkness that’s just around the corner.”

(from Smallville Season 6x1: “Zod”)

On why I hate the phrase “that’s so lame”… http://bit.ly/Ps3uSS

On Wed, Feb 5, 2014 at 6:49 AM, Daniel Givens
daniel.givens@rackspace.comwrote:

I’m having some difficulties with a node search not returning any results
when matching on an environment with a hyphen in the name.

Example:

$ knife search node 'environment:production-ord’
0 items found

$ knife node show api-n01.ord.example.com
Node Name: api-n01.ord.example.com
Environment: production-ord

I’ve tried escaping the hyphen, which returns invalid search query. I’ve
tried surrounding the environment name with double quotes. The search works
fine for environments without a hyphen, such as “staging”.

$ knife search node 'environment:staging’
22 items found

I’m using knife from Chef 11.8.2 and the Chef server is 11.0.10.

Any help would be appreciated.


Daniel


#3

Hello,

Try this :
knife search node ‘chef_environment:production-ord’

Le 05/02/2014 15:49, Daniel Givens a écrit :

I’m having some difficulties with a node search not returning any results when matching on an environment with a hyphen in the name.

Example:

$ knife search node 'environment:production-ord’
0 items found

$ knife node show api-n01.ord.example.com
Node Name: api-n01.ord.example.com
Environment: production-ord

I’ve tried escaping the hyphen, which returns invalid search query. I’ve tried surrounding the environment name with double quotes. The search works fine for environments without a hyphen, such as “staging”.

$ knife search node 'environment:staging’
22 items found

I’m using knife from Chef 11.8.2 and the Chef server is 11.0.10.

Any help would be appreciated.


Daniel


#4

Tried that as well and still nothing.


Daniel

On Feb 5, 2014, at 8:55 AM, Morgan Blackthorne stormerider@gmail.com
wrote:

Try using an underscore instead.


~~ StormeRider ~~

“Every world needs its heroes […] They inspire us to be better than we are. And they protect from the darkness that’s just around the corner.”

(from Smallville Season 6x1: “Zod”)

On why I hate the phrase “that’s so lame”… http://bit.ly/Ps3uSS

On Wed, Feb 5, 2014 at 6:49 AM, Daniel Givens daniel.givens@rackspace.com wrote:
I’m having some difficulties with a node search not returning any results when matching on an environment with a hyphen in the name.

Example:

$ knife search node 'environment:production-ord’
0 items found

$ knife node show api-n01.ord.example.com
Node Name: api-n01.ord.example.com
Environment: production-ord

I’ve tried escaping the hyphen, which returns invalid search query. I’ve tried surrounding the environment name with double quotes. The search works fine for environments without a hyphen, such as “staging”.

$ knife search node 'environment:staging’
22 items found

I’m using knife from Chef 11.8.2 and the Chef server is 11.0.10.

Any help would be appreciated.


Daniel


#5

Well, a dodgy way to do it is to do production*ord…


~~ StormeRider ~~

“Every world needs its heroes […] They inspire us to be better than we
are. And they protect from the darkness that’s just around the corner.”

(from Smallville Season 6x1: “Zod”)

On why I hate the phrase “that’s so lame”… http://bit.ly/Ps3uSS

On Wed, Feb 5, 2014 at 7:16 AM, Daniel Givens
daniel.givens@rackspace.comwrote:

Tried that as well and still nothing.


Daniel

On Feb 5, 2014, at 8:55 AM, Morgan Blackthorne stormerider@gmail.com
wrote:

Try using an underscore instead.


~~ StormeRider ~~

“Every world needs its heroes […] They inspire us to be better than we
are. And they protect from the darkness that’s just around the corner.”

(from Smallville Season 6x1: “Zod”)

On why I hate the phrase “that’s so lame”… http://bit.ly/Ps3uSS

On Wed, Feb 5, 2014 at 6:49 AM, Daniel Givens <daniel.givens@rackspace.com

wrote:

I’m having some difficulties with a node search not returning any results
when matching on an environment with a hyphen in the name.

Example:

$ knife search node 'environment:production-ord’
0 items found

$ knife node show api-n01.ord.example.com
Node Name: api-n01.ord.example.com
Environment: production-ord

I’ve tried escaping the hyphen, which returns invalid search query. I’ve
tried surrounding the environment name with double quotes. The search works
fine for environments without a hyphen, such as “staging”.

$ knife search node 'environment:staging’
22 items found

I’m using knife from Chef 11.8.2 and the Chef server is 11.0.10.

Any help would be appreciated.


Daniel


#6

No dice.

$ knife search node 'environment:production*ord’
0 items found

Additionally, something odd is happening when I search for “environment:production*”.

$ knife search node 'environment:production*'
7 items found

Node Name: lb-n01.prod.example.com
Environment: joule-prod

Node Name: heat-ui.example.com
Environment: inova

The environments I have are:

dev <-- works
qa <-- works
staging <-- works
inova
joule-prod
production-dfw
production-ord
production-iad
production-lon
production-syd
production-hkg


Daniel

On Feb 5, 2014, at 9:44 AM, Morgan Blackthorne stormerider@gmail.com wrote:

Well, a dodgy way to do it is to do production*ord…


~~ StormeRider ~~

“Every world needs its heroes […] They inspire us to be better than we are. And they protect from the darkness that’s just around the corner.”

(from Smallville Season 6x1: “Zod”)

On why I hate the phrase “that’s so lame”… http://bit.ly/Ps3uSS

On Wed, Feb 5, 2014 at 7:16 AM, Daniel Givens daniel.givens@rackspace.com wrote:
Tried that as well and still nothing.


Daniel

On Feb 5, 2014, at 8:55 AM, Morgan Blackthorne stormerider@gmail.com
wrote:

Try using an underscore instead.


~~ StormeRider ~~

“Every world needs its heroes […] They inspire us to be better than we are. And they protect from the darkness that’s just around the corner.”

(from Smallville Season 6x1: “Zod”)

On why I hate the phrase “that’s so lame”… http://bit.ly/Ps3uSS

On Wed, Feb 5, 2014 at 6:49 AM, Daniel Givens daniel.givens@rackspace.com wrote:
I’m having some difficulties with a node search not returning any results when matching on an environment with a hyphen in the name.

Example:

$ knife search node 'environment:production-ord’
0 items found

$ knife node show api-n01.ord.example.com
Node Name: api-n01.ord.example.com
Environment: production-ord

I’ve tried escaping the hyphen, which returns invalid search query. I’ve tried surrounding the environment name with double quotes. The search works fine for environments without a hyphen, such as “staging”.

$ knife search node 'environment:staging’
22 items found

I’m using knife from Chef 11.8.2 and the Chef server is 11.0.10.

Any help would be appreciated.


Daniel


#7

It should be chef_environment, not environment.


~~ StormeRider ~~

“Every world needs its heroes […] They inspire us to be better than we
are. And they protect from the darkness that’s just around the corner.”

(from Smallville Season 6x1: “Zod”)

On why I hate the phrase “that’s so lame”… http://bit.ly/Ps3uSS

On Wed, Feb 5, 2014 at 8:38 AM, Daniel Givens
daniel.givens@rackspace.comwrote:

No dice.

$ knife search node 'environment:production*ord’
0 items found

Additionally, something odd is happening when I search for
"environment:production*".

$ knife search node 'environment:production*'
7 items found

Node Name: lb-n01.prod.example.com
Environment: joule-prod

Node Name: heat-ui.example.com
Environment: inova

The environments I have are:

dev <-- works
qa <-- works
staging <-- works
inova
joule-prod
production-dfw
production-ord
production-iad
production-lon
production-syd
production-hkg


Daniel

On Feb 5, 2014, at 9:44 AM, Morgan Blackthorne stormerider@gmail.com
wrote:

Well, a dodgy way to do it is to do production*ord…


~~ StormeRider ~~

“Every world needs its heroes […] They inspire us to be better than we
are. And they protect from the darkness that’s just around the corner.”

(from Smallville Season 6x1: “Zod”)

On why I hate the phrase “that’s so lame”… http://bit.ly/Ps3uSS

On Wed, Feb 5, 2014 at 7:16 AM, Daniel Givens <daniel.givens@rackspace.com

wrote:

Tried that as well and still nothing.


Daniel

On Feb 5, 2014, at 8:55 AM, Morgan Blackthorne stormerider@gmail.com
wrote:

Try using an underscore instead.


~~ StormeRider ~~

“Every world needs its heroes […] They inspire us to be better than we
are. And they protect from the darkness that’s just around the corner.”

(from Smallville Season 6x1: “Zod”)

On why I hate the phrase “that’s so lame”… http://bit.ly/Ps3uSS

On Wed, Feb 5, 2014 at 6:49 AM, Daniel Givens <
daniel.givens@rackspace.com> wrote:

I’m having some difficulties with a node search not returning any
results when matching on an environment with a hyphen in the name.

Example:

$ knife search node 'environment:production-ord’
0 items found

$ knife node show api-n01.ord.example.com
Node Name: api-n01.ord.example.com
Environment: production-ord

I’ve tried escaping the hyphen, which returns invalid search query. I’ve
tried surrounding the environment name with double quotes. The search works
fine for environments without a hyphen, such as “staging”.

$ knife search node 'environment:staging’
22 items found

I’m using knife from Chef 11.8.2 and the Chef server is 11.0.10.

Any help would be appreciated.


Daniel


#8
  • means NOT in lucene/solr search syntax.

i think it just needs to be escaped to -

see:

http://lucene.apache.org/core/3_6_0/queryparsersyntax.html#Escaping%20Special%20Characters

On 2/5/14 7:44 AM, Morgan Blackthorne wrote:

Well, a dodgy way to do it is to do production*ord…


~~ StormeRider ~~

“Every world needs its heroes […] They inspire us to be better than
we are. And they protect from the darkness that’s just around the corner.”

(from Smallville Season 6x1: “Zod”)

On why I hate the phrase “that’s so lame”… http://bit.ly/Ps3uSS

On Wed, Feb 5, 2014 at 7:16 AM, Daniel Givens
<daniel.givens@rackspace.com mailto:daniel.givens@rackspace.com> wrote:

Tried that as well and still nothing.

--
Daniel


On Feb 5, 2014, at 8:55 AM, Morgan Blackthorne
<stormerider@gmail.com <mailto:stormerider@gmail.com>>
 wrote:
Try using an underscore instead.

-- 
~*~ StormeRider ~*~

"Every world needs its heroes [...] They inspire us to be better
than we are. And they protect from the darkness that's just
around the corner."

(from Smallville Season 6x1: "Zod")

On why I hate the phrase "that's so lame"... http://bit.ly/Ps3uSS


On Wed, Feb 5, 2014 at 6:49 AM, Daniel Givens
<daniel.givens@rackspace.com
<mailto:daniel.givens@rackspace.com>> wrote:

    I'm having some difficulties with a node search not returning
    any results when matching on an environment with a hyphen in
    the name.

    Example:

    $ knife search node 'environment:production-ord'
    0 items found

    $ knife node show api-n01.ord.example.com
    <http://api-n01.ord.example.com/>
    Node Name: api-n01.ord.example.com
    <http://api-n01.ord.example.com/>
    Environment: production-ord


    I've tried escaping the hyphen, which returns invalid search
    query. I've tried surrounding the environment name with
    double quotes. The search works fine for environments without
    a hyphen, such as "staging".

    $ knife search node 'environment:staging'
    22 items found
    ...

    I'm using knife from Chef 11.8.2 and the Chef server is 11.0.10.

    Any help would be appreciated.

    --
    Daniel

#9

Which may possibly need to be double-escaped by the shell; ie: \-


~~ StormeRider ~~

“Every world needs its heroes […] They inspire us to be better than we
are. And they protect from the darkness that’s just around the corner.”

(from Smallville Season 6x1: “Zod”)

On why I hate the phrase “that’s so lame”… http://bit.ly/Ps3uSS

On Thu, Feb 6, 2014 at 11:31 AM, Lamont Granquist lamont@opscode.comwrote:

  • means NOT in lucene/solr search syntax.

i think it just needs to be escaped to -

see:

http://lucene.apache.org/core/3_6_0/queryparsersyntax.html#Escaping%20Special%20Characters

On 2/5/14 7:44 AM, Morgan Blackthorne wrote:

Well, a dodgy way to do it is to do production*ord…


~~ StormeRider ~~

“Every world needs its heroes […] They inspire us to be better than we
are. And they protect from the darkness that’s just around the corner.”

(from Smallville Season 6x1: “Zod”)

On why I hate the phrase “that’s so lame”… http://bit.ly/Ps3uSS

On Wed, Feb 5, 2014 at 7:16 AM, Daniel Givens <daniel.givens@rackspace.com

wrote:

Tried that as well and still nothing.


Daniel

On Feb 5, 2014, at 8:55 AM, Morgan Blackthorne stormerider@gmail.com
wrote:

Try using an underscore instead.


~~ StormeRider ~~

“Every world needs its heroes […] They inspire us to be better than we
are. And they protect from the darkness that’s just around the corner.”

(from Smallville Season 6x1: “Zod”)

On why I hate the phrase “that’s so lame”… http://bit.ly/Ps3uSS

On Wed, Feb 5, 2014 at 6:49 AM, Daniel Givens <
daniel.givens@rackspace.com> wrote:

I’m having some difficulties with a node search not returning any
results when matching on an environment with a hyphen in the name.

Example:

$ knife search node 'environment:production-ord’
0 items found

$ knife node show api-n01.ord.example.com
Node Name: api-n01.ord.example.com
Environment: production-ord

I’ve tried escaping the hyphen, which returns invalid search query. I’ve
tried surrounding the environment name with double quotes. The search works
fine for environments without a hyphen, such as “staging”.

$ knife search node 'environment:staging’
22 items found

I’m using knife from Chef 11.8.2 and the Chef server is 11.0.10.

Any help would be appreciated.


Daniel