Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kwabena Antwi-Boasiako
slapos
Commits
8787716d
Commit
8787716d
authored
Oct 20, 2016
by
Nicolas Wavrant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
librecipe: new function in GenericBaseRecipe to get value from previous buildout run
parent
203ffbfa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
0 deletions
+16
-0
slapos/recipe/librecipe/generic.py
slapos/recipe/librecipe/generic.py
+16
-0
No files found.
slapos/recipe/librecipe/generic.py
View file @
8787716d
...
...
@@ -26,6 +26,7 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
import
ConfigParser
import
io
import
logging
import
os
...
...
@@ -280,3 +281,18 @@ class GenericBaseRecipe(object):
except
:
shutil
.
rmtree
(
destination
)
raise
def
getValueFromPreviousRun
(
self
,
section
,
parameter
):
"""
Returns the value of a parameter from a previous run, if it exists.
Otherwise, returns None
"""
if
os
.
path
.
exists
(
self
.
buildout
[
'buildout'
][
'installed'
]):
with
open
(
self
.
buildout
[
'buildout'
][
'installed'
])
as
config_file
:
try
:
parser
=
ConfigParser
.
RawConfigParser
()
parser
.
readfp
(
config_file
)
return
parser
.
get
(
section
,
parameter
)
except
:
pass
return
None
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment