Skip to content

Commit

Permalink
command: Add getSetVariable command
Browse files Browse the repository at this point in the history
There are some use cases where we want to read a variable but also
set the variable to the value read, effectively locking in any
expansion of it. This adds such a command.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
  • Loading branch information
rpurdie committed Oct 29, 2015
1 parent 4e0da1e commit 0c0c524
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/bb/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,16 @@ def setVariable(self, command, params):
value = str(params[1])
command.cooker.data.setVar(varname, value)

def getSetVariable(self, command, params):
"""
Read the value of a variable from data and set it into the datastore
which effectively expands and locks the value.
"""
varname = params[0]
result = self.getVariable(command, params)
command.cooker.data.setVar(varname, result)
return result

def setConfig(self, command, params):
"""
Set the value of variable in configuration
Expand Down

0 comments on commit 0c0c524

Please sign in to comment.