Public Member Functions | |
SCPM (int options=0, std::ostream &info_out=cout, std::ostream &hash_out=cout, std::string root="") | |
~SCPM () | |
Destructor. | |
bool | Enable (bool force=false) |
Makes SCPM ready for use. | |
bool | Disable () |
Completely disables SCPM. | |
bool | Active (std::string &profile) |
bool | List (std::vector< std::string > &profiles) |
bool | Add (std::string profile, bool auto_switch=true) |
bool | Copy (std::string source_profile, std::string profile) |
bool | Create (std::string profile, std::string source_profile) |
bool | Delete (std::string profile) |
bool | Rename (std::string profile, std::string newprofile) |
bool | Reload () |
Reloads the current profile. | |
bool | PrepareSwitch (std::string profile, switch_info_t &switch_info) |
bool | Switch (switch_info_t &switch_info) |
Perform prepared switch. | |
bool | Save (switch_info_t &switch_info) |
Save modified resources. | |
bool | Modify (std::string profile, std::string action) |
bool | Set (std::string command, std::string argument, std::string profile="") |
bool | Get (std::string command, std::string &result, std::string profile="") |
bool | Status (scpm_status_t &status) |
Query some status information. | |
bool | ShowChanges (std::ostream &output, std::string resource_type, std::string resource_name, bool backup=false) |
bool | SetResourceSet (std::string set) |
bool | GetResourceSet (std::string &set) |
bool | ListResourceSets (std::vector< std::string > &predefined, std::vector< std::string > &individual) |
bool | CopyResourceSet (std::string set, std::string newset) |
bool | DeleteResourceSet (std::string set) |
bool | ListResourceGroups (std::vector< resource_group_t > &groups) |
bool | GetResourceGroup (const std::string &name, std::vector< resource_entry_t > &group, bool nouser=false) |
bool | GetResourceGroup (const std::string &name, std::vector< resource_entry_t > &group, std::string &description, bool nouser=false) |
bool | SetResourceGroup (const std::string &name, const std::vector< resource_entry_t > &group, const std::string &description) |
bool | DeleteResourceGroup (const std::string &group) |
bool | RenameResourceGroup (const std::string &group, const std::string &newgroup) |
bool | SetActiveResourceGroups (const std::vector< std::string > &groups) |
bool | GetActiveResourceGroups (std::vector< std::string > &groups) |
bool | ActivateResourceGroup (const std::string &group, bool auto_add=false) |
bool | DeactivateResourceGroup (const std::string &group, bool auto_remove=false) |
bool | ResetResourceGroup (const std::string &group) |
bool | ResetAllGroups () |
Resets all resource groups. | |
bool | RebuildDB (rebuild_mode_t mode=REBUILD_MODE_QUICK) |
Performs a rebuild of the database. | |
bool | SetConfigOption (const std::string &option, const std::string &value) |
bool | GetConfigOption (const std::string &option, std::string &value) |
bool | Update (const std::string &scriptname, std::vector< pair< std::string, std::string > > resources) |
bool | UpdateResources () |
bool | Backup (const std::string &command, const std::vector< pair< std::string, std::string > > &resources, const std::string &profile, std::vector< backup_info_t > *reslist=NULL) |
bool | Recover (bool rollback=false) |
bool | Commit () |
Most of the member functions return a bool
variable. This indicates the success of the operation. In case anything went wrong you get back false. The global variable scpm_error
holds the apropriate error message.
|
Destructor, it saves the SCDB and cleans up stuff. Make sure you don't suppress calling it (e.g. by using |
|
Sets SCPM into enabled status. In case you call SCPM::Enable() the first time (that means, no database is there) the SCPM system gets initialized. This can take a while. You can force re-enabling by setting force to |
|
Disables SCPM, that means, you can not use it anymore. Nothing gets deleted by calling this function. |
|
Does a reload of the active profile. This function is an alias for Switch( active_profile ). FIXME: This is actually broken. The cli frontend implements this actually by calling SCPM::PrepareSwitch and afterwards SCPM::Switch with the current profile as argument. This is basically the same. |
|
Performs the prepared switch to the new profile. That means, it stops services, restores resources from the new profile, and starts resources accordingly. |
|
Saves all modified resource listed in the switch_info_t struct that have the save flag set. In case the save_mode element of the struct is set to |
|
The Status function collects some status information and writes them in the passed scpm_status_t object. Look at the struct members for details. |
|
Resets all resource groups to its defaults, removes user defined resource groups, and restores original active groups list. |
|
This brings your SCDB up to date. More detailed that means all resources, that do not exist in your system but in the database get removed, and new resources which are not listed in the database get added. The current state of all new resources get saved to all profiles. You may want to call this function after a resource set change, otherwise you will get a quite long list of modified resources on the next switch. Please note: this may daramtically modify your existing database! It may even remove data! |