-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No output of error messages in the user interface #78
Comments
It's probably far too hard to get this feedback from errors back up to yast. We'd either need to rewrite the whole thing in python and I don't have the time for that. Currently the way yast-auth-server works is a pretty janky hack where yast is basicly running pre-batched commands, which is extraordinarily fragile to say the least. I'd much rather see people stop using this module so we can delete it, and have people use dscreate directly which is a far better user experience, much more robust and offers more options than yast can. |
You can write a yast python module which is called by the ruby code. Then you could catch and return the error. |
Something like this: from yast import Declare, ycpbuiltins, import_module
import_module('PackageSystem')
import_module('Package')
from yast import PackageSystem, Package
if not PackageSystem.Installed('lib389'):
if not Package.InstallAll(['lib389']):
raise ImportError("Failed to install lib389")
import_module('UI')
from lib389 import DirSrv
from lib389.cli_ctl import instance as cli_instance
from lib389.cli_base import setup_script_logger
from lib389.cli_base import format_error_to_dict
def ErrorMessage(msg):
UI.OpenDialog(
VBox(
Label(msg),
PushButton(Opt("default"), "&OK")
)
)
UI.UserInput()
UI.CloseDialog()
@Declare('boolean', 'map')
def InstanceCreate(args):
log = setup_script_logger("dscreate", False)
inst = DirSrv(verbose=False)
result = False
try:
result = cli_instance.instance_create(inst, log, args)
except Exception as e:
msg = format_error_to_dict(e)
ErrorMessage("Error: %s" % " - ".join(str(val) for val in msg.values()))
result = False
return result I haven't tested this at all, but quickly hacked something up. You put this in src/modules/dscreate.py, then you can call this from the ruby code by importing the yast module as usual. You would also have to add yast2-python3-bindings as a dependency in the rpm spec. |
Thanks, I didn't know you could do this. I'll have a better look early next week :) |
When configuring a new directory server in the Yasdt2 auth server module, the input of a password is required. If this password does not meet the hidden requirements, Yast2 simply outputs that the user should lock to a log file to find out the real reasons for the failure.
The mentioned log file show:
It would be nice if such messages would be presented in the yast2 user interface e.g a message box should appear showing
root_password must be at least 8 characters long
in this case.The text was updated successfully, but these errors were encountered: