Skip to content

Commit 23e18e2

Browse files
author
Seth Falcon
committed
Make update of a node save chef_environment
Note: we should consider refactoring so that the logic for updating an existing node from another node lives in the node class. Then the addition of chef_environment would not have had to touch the nodes controller at all.
1 parent 0fc95bf commit 23e18e2

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

chef-server-api/app/controllers/nodes.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ def update
6868
@node.normal_attrs = updated.normal_attrs
6969
@node.override_attrs = updated.override_attrs
7070
@node.default_attrs = updated.default_attrs
71+
@node.chef_environment(updated.chef_environment)
7172
@node.cdb_save
7273
@node.couchdb_rev = nil
7374
display(@node)

features/api/nodes/update_node_api.feature

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ Feature: Update a node
1414
Then the inflated response should respond to '<method>' with '<updated_value>'
1515

1616
Examples:
17-
| method | updated_value |
18-
| run_list | [ "recipe[one]", "recipe[two]" ] |
19-
| snakes | really arent so bad |
17+
| method | updated_value |
18+
| run_list | [ "recipe[one]", "recipe[two]" ] |
19+
| snakes | really arent so bad |
20+
| chef_environment | prod |
2021

2122
@PL-493
2223
Scenario: Update a node to include a role which includes another role

0 commit comments

Comments
 (0)