245. SourceManager

SourceManager settings, input and output functions

245.1. Authors

  • Anas Nashif <nashif@suse.de>

  • Lukas Ocilka <locilka@suse.cz>

  • Martin Vidner <mvidner@suse.cz>

  • Status: Work in Progress

245.2. Summary of Module Globals

List of Global Functions

  • Abort - Abort function

  • AbortFunction - Abort function return boolean return true if abort

  • AddUpdateSources - Used by registration. This is really hairy because we simultaneously add them to zypp and ZENworks, but not if they are not signed. (thus being better than inst_source)

  • AskForCD -

  • CommitSources - Commit changed repositories

  • Export - Dump the repository-manager settings to a single map (For use by autoinstallation.)

  • GetSrcIdByIndex - Get Repository ID by index

  • GetSyncFlag - Return ZMD synchronization flag.

  • Import - Get all repository-manager settings from the first parameter (For use by autoinstallation.)

  • InstInitSourceMoveDownloadArea - Finds the biggest temporary directory and uses it as packager download area.

  • InstallationSourceOnPartition - Function returns the partiton name which is used as a repository for the installation (IF any partition is used as a repository for installation, of course). Otherwise it returns an empty string "". See bugzilla #208222 for more information.

  • Lock - Start a section where other processes (such as ZMD helpers) should not access the repository database. #170113 The calls may be nested.

  • Modified - Prototypes

  • Modified - Data was modified?

  • Overview - Create an overview table with all configured cards

  • Read - Read all source-manager settings

  • ReadSyncFlag - Read ZMD sync flag from the persistent store (/var/lib/YaST2/inst_source_config.ycp)

  • RunCommandWithTimeout - Runs a bash command with timeout.

  • RunDumbTimeout - Run - with a timeout - on dumb terminal to disable colors etc - using 'exit $?' because of buggy behavior '.background vs. ZMD' (FIXME still needed???)

  • SetSyncFlag - Set ZMD synchronization flag.

  • SetUrlByIndex - Set current used repository URL by index

  • SourceData - Gather Repository Metadata

  • Summary - Create a textual summary and a list of unconfigured cards

  • SyncAddedAndDeleted - Sync the changed repositories to ZENworks

  • SyncYaSTInstSourceWithZMD - Checks whether ZMD is running, starts it when isn't. Checks whether a ZYPP repository is listed in the ZMD services, adds one if it is missing. Everything is done via the .process agent with timeout (number in seconds).

  • Unlock - Other processes may access the repository database again

  • Write - Write all repository-manager settings

  • WriteSyncFlag - Write ZMD sync flag to the persistent store

  • createSource - Create a repository from an URL

  • deleteSourceByIndex - Delete Repository by the repository index

  • deleteSourceBySrcId - Delete repository by Repository ID

  • deleteSourceByUrl - Delete Repository by repository URL

  • getSourceId - Get Repository ID when only URL is known

List of Global Variables

245.3. Global Functions

245.3.1. Abort

Abort function

Return value

  • boolean - return true if abort

245.3.2. AbortFunction

Abort function return boolean return true if abort

Return value

  • boolean

245.3.3. AddUpdateSources

Used by registration. This is really hairy because we simultaneously add them to zypp and ZENworks, but not if they are not signed. (thus being better than inst_source)

Function parameters

  • list<string> urls

Return value

  • list<string> - a list of added URLs

245.3.4. AskForCD

Function parameters

  • string message

Return value

  • boolean

245.3.5. CommitSources

Commit changed repositories

Return value

  • boolean

245.3.6. Export

Dump the repository-manager settings to a single map (For use by autoinstallation.)

Return value

  • map - Dumped settings (later acceptable by Import ())

245.3.7. GetSrcIdByIndex

Get Repository ID by index

Function parameters

  • integer idx

Return value

  • integer

245.3.8. GetSyncFlag

Return ZMD synchronization flag.

Return value

  • boolean - true/false = ZMD sync is enabled/disabled, nil = unknown (not configured/read)

245.3.9. Import

Get all repository-manager settings from the first parameter (For use by autoinstallation.)

Function parameters

  • map settings

Return value

  • boolean - True on success

245.3.10. InstInitSourceMoveDownloadArea

Finds the biggest temporary directory and uses it as packager download area.

Return value

  • void

245.3.11. InstallationSourceOnPartition

Function returns the partiton name which is used as a repository for the installation (IF any partition is used as a repository for installation, of course). Otherwise it returns an empty string "". See bugzilla #208222 for more information.

Return value

  • string - partition name

245.3.12. Lock

Start a section where other processes (such as ZMD helpers) should not access the repository database. #170113 The calls may be nested.

Return value

  • void

245.3.13. Modified

Prototypes

Return value

  • boolean

245.3.14. Modified

Data was modified?

Return value

  • boolean - true if modified

245.3.15. Overview

Create an overview table with all configured cards

Return value

  • list - table items

245.3.16. Read

Read all source-manager settings

Return value

  • boolean - true on success

245.3.17. ReadSyncFlag

Read ZMD sync flag from the persistent store (/var/lib/YaST2/inst_source_config.ycp)

Return value

  • boolean - true = success, false = read/parse error or the file doesn't exist

245.3.18. RunCommandWithTimeout

Runs a bash command with timeout.

Function parameters

  • string run_command

  • string log_command

  • integer script_time_out

Return value

  • map - with out, err and ret_code

Returns map $[
     "exit" : int_return_code,
     "stdout"  : [ "script", "stdout", "lines" ],
     "stderr"  : [ "script", "stderr", "lines" ],
 ]

245.3.19. RunDumbTimeout

Run - with a timeout - on dumb terminal to disable colors etc - using 'exit $?' because of buggy behavior '.background vs. ZMD' (FIXME still needed???)

Function parameters

  • string command

  • string log_command

  • integer seconds

Return value

  • map - with out, err and ret_code

245.3.20. SetSyncFlag

Set ZMD synchronization flag.

Function parameters

  • boolean sync_enabled

Return value

  • void

245.3.21. SetUrlByIndex

Set current used repository URL by index

Function parameters

  • integer idx

Return value

  • void

245.3.22. SourceData

Gather Repository Metadata

Function parameters

  • integer source

Return value

  • map

245.3.23. Summary

Create a textual summary and a list of unconfigured cards

Return value

  • list - summary of the current configuration

245.3.24. SyncAddedAndDeleted

Sync the changed repositories to ZENworks

Function parameters

  • list<integer> added_src_ids

  • list<integer> deleted_src_ids

Return value

  • boolean - success

245.3.25. SyncYaSTInstSourceWithZMD

Checks whether ZMD is running, starts it when isn't. Checks whether a ZYPP repository is listed in the ZMD services, adds one if it is missing. Everything is done via the .process agent with timeout (number in seconds).

Return value

  • boolean - whether the syncing succeeds

245.3.26. Unlock

Other processes may access the repository database again

Return value

  • void

245.3.27. Write

Write all repository-manager settings

Return value

  • boolean - true on success

245.3.28. WriteSyncFlag

Write ZMD sync flag to the persistent store

Return value

  • boolean - true = success

245.3.29. createSource

Create a repository from an URL

Function parameters

  • string url

Return value

  • symbol

245.3.30. deleteSourceByIndex

Delete Repository by the repository index

Function parameters

  • integer idx

Return value

  • void

245.3.31. deleteSourceBySrcId

Delete repository by Repository ID

Function parameters

  • integer SrcId

Return value

  • void

245.3.32. deleteSourceByUrl

Delete Repository by repository URL

Function parameters

  • string url

Return value

  • void

245.3.33. getSourceId

Get Repository ID when only URL is known

Function parameters

  • string url

Return value

  • integer

245.4. Global Variables

245.4.1. modified

Data was modified?

245.4.2. proposal_valid

245.5. Module Requirements

245.5.1. Module Imports

  • Arch
  • FileUtils
  • HTML
  • InstURL
  • Installation
  • Label
  • Linuxrc
  • Message
  • Mode
  • Popup
  • Progress
  • Report
  • Stage
  • String
  • String
  • SuSEFirewall
  • Summary
  • URL

245.5.2. Module Includes