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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Carlos Ramos Carreño
slapos
Commits
b9a16442
Commit
b9a16442
authored
Jun 25, 2021
by
Lisa Casino
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
recipe/switch_softwaretype: catch possible errors
parent
c4b66eb1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
5 deletions
+17
-5
slapos/recipe/switch_softwaretype.py
slapos/recipe/switch_softwaretype.py
+17
-5
No files found.
slapos/recipe/switch_softwaretype.py
View file @
b9a16442
...
...
@@ -25,9 +25,8 @@
#
##############################################################################
from
zc.buildout.buildout
import
Buildout
from
zc.buildout.buildout
import
Buildout
,
MissingOption
,
MissingSection
from
zc.buildout
import
UserError
class
SubBuildout
(
Buildout
):
"""Run buildout in buildout, partially copied from infrae.buildout
...
...
@@ -71,8 +70,21 @@ class Recipe:
self
.
buildout
=
buildout
self
.
options
=
options
self
.
name
=
name
self
.
software_type
=
buildout
[
"slap-configuration"
][
"slap-software-type"
]
section
,
key
=
self
.
options
[
self
.
software_type
].
split
(
":"
)
try
:
self
.
software_type
=
buildout
[
"slap-configuration"
][
"slap-software-type"
]
except
(
MissingSection
,
MissingOption
):
raise
UserError
(
"The section to retrieve slap partition parameters "
"(with slapos.cookbook:slapconfiguration recipe or a derived one) "
"must be named [slap-configuration]."
)
try
:
section
,
key
=
self
.
options
[
self
.
software_type
].
split
(
":"
)
except
MissingOption
:
raise
MissingOption
(
"This software type (%s) isn't mapped. RootSoftwareInstance "
"is the default software type."
%
self
.
software_type
)
except
ValueError
:
raise
UserError
(
"The software types in the section [%s] must be separated "
"by a colon such as: 'section:key', where key is usually 'rendered'. "
"Don't use: ${section:key}"
%
self
.
name
)
self
.
base
=
self
.
buildout
[
section
][
key
]
def
install
(
self
):
...
...
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