Module: Yast::SmtComplexInclude
- Defined in:
- ../../src/include/smt/complex.rb
Instance Method Summary (collapse)
-
- (Object) CredentialsTest(log_view)
Gets the current credentials and use them to download a /repo/repoindex.xml from the NUUrl.
- - (Object) initialize_smt_complex(include_target)
-
- (Object) LogThis(text)
Function for logging in the LogView widget.
Instance Method Details
- (Object) CredentialsTest(log_view)
Gets the current credentials and use them to download a /repo/repoindex.xml from the NUUrl. Progress is written to the LogView identified by ID got as a function parameter.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
# File '../../src/include/smt/complex.rb', line 39 def CredentialsTest(log_view) log_view = deep_copy(log_view) @log_view_ID = deep_copy(log_view) user = SMTData.GetCredentials("NU", "NUUser") pass = SMTData.GetCredentials("NU", "NUPass") url = SMTData.GetCredentials("NU", "NURegUrl") api = SMTData.GetCredentials("NU", "ApiType") user = "" if user == nil pass = "" if pass == nil if url == nil || url == "" # TRANSLATORS: error message Report.Error(_("No URL has been defined. Test cannot proceed.")) return false end # File for writing the credentials test_file = Ops.add(Directory.tmpdir, "/curl_input_file") # File for downloading the /repo/repoindex.xml out_file = Ops.add(Directory.tmpdir, "/curl_output_file") # At first, credentials need to be written to a temporary file # because of security reasons. If used on a commandline, `ps` # could reveal them. # TRANSLATORS: LogView line LogThis(_("Creating a temporary file...")) cmd_exit = Convert.to_integer( SCR.Execute( path(".target.bash"), Builtins.sformat( "echo \"[GLOBAL]\n" + "# URL for downloading repos/patches\n" + "url=%1?command=regdata&lang=en-US&version=1.0\n" + "# user/pass to be used for downloading\n" + "user=%2\n" + "pass=%3\n" + "apitype=%4\n" + "\" > '%5'", url, user, pass, api, String.Quote(test_file) ) ) ) if cmd_exit != 0 # TRANSLATORS: LogView line LogThis( Builtins.sformat(_("Cannot create a temporary file %1."), test_file) ) return false end # TRANSLATORS: LogView line LogThis(_("Check credentials...")) cmd = Convert.to_map( SCR.Execute( path(".target.bash_output"), Builtins.sformat( "/usr/lib/YaST2/bin/regsrv-check-creds '%1'", String.Quote(test_file) ) ) ) if Ops.get_integer(cmd, "exit", -1) != 0 # TRANSLATORS: LogView line LogThis(_("Invalid credentials.")) return false end # TRANSLATORS: LogView line LogThis(_("Success.")) true end |
- (Object) initialize_smt_complex(include_target)
11 12 13 14 15 16 17 18 19 20 21 |
# File '../../src/include/smt/complex.rb', line 11 def initialize_smt_complex(include_target) Yast.import "UI" textdomain "smt" Yast.import "SMTData" Yast.import "Directory" Yast.import "String" Yast.import "Report" @log_view_ID = nil end |
- (Object) LogThis(text)
Function for logging in the LogView widget.
26 27 28 29 30 31 32 |
# File '../../src/include/smt/complex.rb', line 26 def LogThis(text) if UI.WidgetExists(Id(@log_view_ID)) UI.ChangeWidget(Id(@log_view_ID), :LastLine, Ops.add(text, "\n")) end nil end |