Knife node from URL?


#1

This post started about one thing which is included below for context and the
original questions are still interesting, but as I thought through solutions I
came across one that seems appealing. It would be ideal if knife could read a
role from a URL instead of a file. We have Jenkins put build artifacts into an
Artifactory repository, and the problem below could be solved if Jenkins built
a role as an artifact and we could just knife it right out of Artifactory.

Is it possible to make a knife plugin that can do this?

Original post:

I’ve been reading through the wiki, the list and google and can’t seem to find
the answer to my question. I think it is a basic question but I’m missing the
answer.

We currently use a buildstamp as a node attribute to drive a lot of recipes.
What are others doing so that upon every build, Chef gets set/told of the new
buildstamp so that a set of servers uses that buildstamp on the next
chef-client run?

We’re currently storing the buildsamp in a role file and loading it every time,
but that is too cumbersome and want/need a solution that doesn’t involve an
intermediate file. Simply knife in a chunk of JSON attributes?

Is there a way to set a node attribute without an intermediate file? Is there
another way to accomplish this that I just don’t see?

We are using Jenkins to perform the builds.

Thanks,
Dan


#2

I have encountered similar scenarios in multiple projects. In one of them
the cookbook polls S3 for a version.txt file (using http request inside a
ruby block resource) and checks if it has changed , and triggers deployment
based on that, once deployed it sets an attribute same as the version.txt
content so that it can be checked in next run. I dont see any particular
need of a knife feature to poll a url for a role, where we can do this using
ruby blocks any way. In some other projects I have used scm revisions or db
migration numbers (rails prjects typically) to trigger the same things,

On Thu, Sep 22, 2011 at 12:31 AM, dan@nemecfamily.com wrote:

This post started about one thing which is included below for context and
the
original questions are still interesting, but as I thought through
solutions I
came across one that seems appealing. It would be ideal if knife could read
a
role from a URL instead of a file. We have Jenkins put build artifacts into
an
Artifactory repository, and the problem below could be solved if Jenkins
built
a role as an artifact and we could just knife it right out of Artifactory.

Is it possible to make a knife plugin that can do this?

Original post:

I’ve been reading through the wiki, the list and google and can’t seem to
find
the answer to my question. I think it is a basic question but I’m missing
the
answer.

We currently use a buildstamp as a node attribute to drive a lot of
recipes.
What are others doing so that upon every build, Chef gets set/told of the
new
buildstamp so that a set of servers uses that buildstamp on the next
chef-client run?

We’re currently storing the buildsamp in a role file and loading it every
time,
but that is too cumbersome and want/need a solution that doesn’t involve an
intermediate file. Simply knife in a chunk of JSON attributes?

Is there a way to set a node attribute without an intermediate file? Is
there
another way to accomplish this that I just don’t see?

We are using Jenkins to perform the builds.

Thanks,
Dan


#3

knife X from file could be made to work for URL’s pretty easil yby modifying
chef/knife/core/object_loader (maybe to use open-uri). Failing that,
writing your own knife plugin is pretty easy to do; there’s not much to e.g.
chef/knife/role_from_file, even if you replace some of the helpers from
knife/core with inline code.

On Wednesday, September 21, 2011, Ranjib Dey ranjibd@thoughtworks.com
wrote:

I have encountered similar scenarios in multiple projects. In one of them
the cookbook polls S3 for a version.txt file (using http request inside a
ruby block resource) and checks if it has changed , and triggers deployment
based on that, once deployed it sets an attribute same as the version.txt
content so that it can be checked in next run. I dont see any particular
need of a knife feature to poll a url for a role, where we can do this using
ruby blocks any way. In some other projects I have used scm revisions or db
migration numbers (rails prjects typically) to trigger the same things,

On Thu, Sep 22, 2011 at 12:31 AM, dan@nemecfamily.com wrote:

This post started about one thing which is included below for context and
the

original questions are still interesting, but as I thought through
solutions I

came across one that seems appealing. It would be ideal if knife could
read a

role from a URL instead of a file. We have Jenkins put build artifacts
into an

Artifactory repository, and the problem below could be solved if Jenkins
built

a role as an artifact and we could just knife it right out of
Artifactory.

Is it possible to make a knife plugin that can do this?

Original post:

I’ve been reading through the wiki, the list and google and can’t seem to
find

the answer to my question. I think it is a basic question but I’m missing
the

answer.

We currently use a buildstamp as a node attribute to drive a lot of
recipes.

What are others doing so that upon every build, Chef gets set/told of the
new

buildstamp so that a set of servers uses that buildstamp on the next
chef-client run?

We’re currently storing the buildsamp in a role file and loading it every
time,

but that is too cumbersome and want/need a solution that doesn’t involve
an

intermediate file. Simply knife in a chunk of JSON attributes?

Is there a way to set a node attribute without an intermediate file? Is
there

another way to accomplish this that I just don’t see?

We are using Jenkins to perform the builds.

Thanks,
Dan


Mark J. Reed markjreed@gmail.com