Roy Golan has uploaded a new change for review.

Change subject: core: storage.py fail pep8 check and fails validation stage
......................................................................

core: storage.py fail pep8 check and fails validation stage

Change-Id: Ic94f641702f451f3b9b0720a981cb560df2592bc
Signed-off-by: Roy Golan <[email protected]>
---
A packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/config/storage.py
1 file changed, 100 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/37/38137/1

diff --git 
a/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/config/storage.py 
b/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/config/storage.py
new file mode 100644
index 0000000..8f78f79
--- /dev/null
+++ b/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/config/storage.py
@@ -0,0 +1,100 @@
+#
+# ovirt-engine-setup -- ovirt engine setup
+# Copyright (C) 2015 Red Hat, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+
+"""storage plugin."""
+
+
+import gettext
+_ = lambda m: gettext.dgettext(message=m, domain='ovirt-engine-setup')
+
+
+from otopi import util
+from otopi import plugin
+
+
+from ovirt_engine_setup import constants as osetupcons
+from ovirt_engine_setup.engine import constants as oenginecons
+from ovirt_engine_setup.engine_common \
+    import constants as oengcommcons
+from ovirt_engine_setup import dialog
+from ovirt_engine_setup.engine import vdcoption
+
+SAN_WIPE_AFTER_DELETE = osetupcons.ConfigEnv.SAN_WIPE_AFTER_DELETE
+
+
[email protected]
+class Plugin(plugin.PluginBase):
+    """storage plugin."""
+
+    @plugin.event(
+        stage=plugin.Stages.STAGE_INIT,
+    )
+    def _init(self):
+        self.environment.setdefault(SAN_WIPE_AFTER_DELETE, None)
+
+    @plugin.event(
+        stage=plugin.Stages.STAGE_CUSTOMIZATION,
+        before=(
+            oengcommcons.Stages.DIALOG_TITLES_E_STORAGE,
+        ),
+        after=(
+            oengcommcons.Stages.DIALOG_TITLES_S_STORAGE,
+        ),
+        condition=lambda self: self._newDatabaseCondition(),
+    )
+    def _configureSANWipeAfterDelete(self):
+        if self.environment[SAN_WIPE_AFTER_DELETE] is None:
+            # Value for SAN_WIPE_AFTER_DELETE is not forced.
+            sanWipeAfterDelete = dialog.queryBoolean(
+                dialog=self.dialog,
+                name='OVESETUP_CONFIG_SAN_WIPE_AFTER_DELETE',
+                note=_(
+                    'Default SAN wipe after delete '
+                    '(@VALUES@) [@DEFAULT@]: '
+                ),
+                prompt=True,
+                default=False,
+            )
+            self.environment[SAN_WIPE_AFTER_DELETE] = sanWipeAfterDelete
+
+    @plugin.event(
+        stage=plugin.Stages.STAGE_MISC,
+        after=(
+            oengcommcons.Stages.DB_CONNECTION_AVAILABLE,
+        ),
+        condition=lambda self: self._newDatabaseCondition(),
+    )
+    def _updateSANWipeAfterDelete(self):
+        option = vdcoption.VdcOption(
+            statement=self.environment[oenginecons.EngineDBEnv.STATEMENT]
+        )
+        options = (
+            {
+                'name': 'SANWipeAfterDelete',
+                'value': self.environment[SAN_WIPE_AFTER_DELETE],
+            },
+        )
+        option.updateVdcOptions(options=options,)
+
+    def _newDatabaseCondition(self):
+        # Returns a condition that validates
+        # we are running the setup on a new database.
+        return self.environment[oenginecons.EngineDBEnv.NEW_DATABASE]
+
+
+# vim: expandtab tabstop=4 shiftwidth=4


-- 
To view, visit https://gerrit.ovirt.org/38137
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic94f641702f451f3b9b0720a981cb560df2592bc
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Roy Golan <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to