Skip to content

Commit

Permalink
implemented 'nodes_with_tag' command
Browse files Browse the repository at this point in the history
  • Loading branch information
Markus Korn committed Nov 5, 2012
1 parent 2a679ec commit 417992e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions littlechef/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,17 @@ def nodes_with_role(rolename):
return node(*nodes_in_env)


@hosts('setup')
def nodes_with_tag(tag):
"""Sets a list of nodes that have the given tag assigned and calls node()"""
nodes = lib.get_nodes_with_tag(tag, env.chef_environment, env.include_guests)
nodes = [n['name'] for n in nodes]
if not len(nodes):
print("No nodes found with tag '{0}'".format(tag))
sys.exit(0)
return node(*nodes)


@hosts('setup')
def node(*nodes):
"""Selects and configures a list of nodes. 'all' configures all nodes"""
Expand Down

0 comments on commit 417992e

Please sign in to comment.