diff options
author | Michal Minar <miminar@redhat.com> | 2012-10-10 17:55:12 +0200 |
---|---|---|
committer | Michal Minar <miminar@redhat.com> | 2012-10-10 17:55:12 +0200 |
commit | 2aa4f8635b13e1849763a1964eb45032ee30948c (patch) | |
tree | 3563082116a1a3464a365668505a4db68d55a20a | |
parent | 167c13bdf07c2a86ff7043b4b874073556858e69 (diff) | |
download | openlmi-providers-2aa4f8635b13e1849763a1964eb45032ee30948c.tar.gz openlmi-providers-2aa4f8635b13e1849763a1964eb45032ee30948c.tar.xz openlmi-providers-2aa4f8635b13e1849763a1964eb45032ee30948c.zip |
renamed yum package providers to software
renamed LMI_Yum* to LMI_Software*
removed attributes GroupString and LicenseString from LMI_SoftwarePackage
modified attributes Group, Architecture and License of
LMI_SoftwarePackage to return string instead of Uints
- because values and valuemaps would need frequent updates
-rw-r--r-- | mof/LMI_Software.mof | 315 | ||||
-rw-r--r-- | mof/LMI_Software.reg | 23 | ||||
-rw-r--r-- | mof/LMI_Yum.mof | 617 | ||||
-rw-r--r-- | mof/LMI_Yum.reg | 23 | ||||
-rw-r--r-- | src/software/TODO (renamed from src/yum/TODO) | 0 | ||||
-rw-r--r-- | src/software/providers/LMI_SoftwareFileCheck.py (renamed from src/yum/providers/LMI_YumFileCheck.py) | 32 | ||||
-rw-r--r-- | src/software/providers/LMI_SoftwareInstalledPackage.py (renamed from src/yum/providers/LMI_YumInstalledPackage.py) | 54 | ||||
-rw-r--r-- | src/software/providers/LMI_SoftwarePackage.py (renamed from src/yum/providers/LMI_YumPackage.py) | 32 | ||||
-rw-r--r-- | src/software/providers/LMI_SoftwarePackageFile.py (renamed from src/yum/providers/LMI_YumPackageFile.py) | 36 | ||||
-rw-r--r-- | src/software/providers/__init__.py (renamed from src/yum/providers/__init__.py) | 0 | ||||
-rw-r--r-- | src/software/providers/util/__init__.py (renamed from src/yum/providers/util/__init__.py) | 0 | ||||
-rw-r--r-- | src/software/providers/util/common.py (renamed from src/yum/providers/util/common.py) | 367 | ||||
-rw-r--r-- | src/software/providers/util/singletonmixin.py (renamed from src/yum/providers/util/singletonmixin.py) | 0 | ||||
-rw-r--r-- | src/software/setup.py (renamed from src/yum/setup.py) | 0 | ||||
-rw-r--r-- | src/software/test/README (renamed from src/yum/test/README) | 0 | ||||
-rw-r--r-- | src/software/test/common.py (renamed from src/yum/test/common.py) | 2 | ||||
-rwxr-xr-x | src/software/test/test_software_file_check.py (renamed from src/yum/test/test_yum_file_check.py) | 4 | ||||
-rwxr-xr-x | src/software/test/test_software_installed_package.py (renamed from src/yum/test/test_yum_installed_package.py) | 6 | ||||
-rwxr-xr-x | src/software/test/test_software_package.py (renamed from src/yum/test/test_yum_package.py) | 4 |
19 files changed, 450 insertions, 1065 deletions
diff --git a/mof/LMI_Software.mof b/mof/LMI_Software.mof new file mode 100644 index 0000000..90c7974 --- /dev/null +++ b/mof/LMI_Software.mof @@ -0,0 +1,315 @@ +/* + * Copyright (C) 2012 Michal Minar <miminar@redhat.com> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see <http://www.gnu.org/licenses/>. + */ + +#pragma locale ("en_US") +//#pragma namespace ("root/cimv2") + +[ Description ( + "RPM package installed on particular computer system with" + " YUM (The Yellowdog Updated, Modified) package manager.") +] +class LMI_SoftwarePackage : CIM_SoftwareElement { + + [ Description ( + "The release number (referred to in some older documentation as a" + " \"vepoch\") is how the maintainer marks build revisions, starting" + " from 1. When a minor change (spec file changed, patch added/removed)" + " occurs, or a package is rebuilt to use newer headers or libraries," + " the release number should be incremented. If a major change" + " (new version of the software being packaged) occurs, the version" + " number should be changed to reflect the new software version," + " and the release number should be reset to 1.") + ] + String Release; + + [ Description ( + "It is important to be careful with the version of post-release" + " scheme, to ensure that package ordering is correct. It may be" + " necessary to use Epoch to ensure that the current package is" + " considered newer than the previous package.") + ] + uint16 Epoch; + + [ Description ( + "Architecture name, that package is compiled for. In case of no" + "architecture dependency, this will contain \"noarch\".") + ] + String Architecture; + + [ Description ( + "A software license is a legal instrument (usually by way of contract" + " law) governing the usage or redistribution of software." + " All software is copyright protected, except material in the public" + " domain. Contractual confidentiality is another way of protecting" + " software. A typical software license grants an end-user permission" + " to use one or more copies of software in ways where such a use would" + " otherwise potentially constitute copyright infringement of the" + " software owner's exclusive rights under copyright law. List of" + " possible values is based on list of licences approved by the" + " Free Software Foundation and OSI. The string is obtained from RPM" + " package." ) + ] + String License; + + [ Description ( + "Denotes the package group, in which the package belongs.") + ] + String Group; + + [ Description ( + "Size of RPM package in Bytes" ) ] + uint64 Size; + + [ Description ( + "Will install available package."), + ValueMap { "0", "1", "2" }, + Values { "Already installed", "Successful installation", "Failed" } ] + uint32 Install( + [ IN(false), OUT, Description ( + "The reference to newly installed package, if installation was" + " successful. Reference to current package if it is already" + " installed and Null otherwise.") ] + LMI_SoftwareInstalledPackage REF Installed + ); + + [ Description ( + "Will uninstall installed package."), + ValueMap { "0", "1", "2" }, + Values { "Not installed", "Successful removal", "Failed" } ] + uint32 Remove(); + +}; + +[ Description ( + "Identifies a file contained by RPM package. It's located" + " in directory identified in FileName. The Invoke methods" + " check for file existence and whether its attributes match" + " those given by RPM package.") +] +class LMI_SoftwareFileCheck : CIM_FileSpecification { + + [ Key, Description ( + "Absolute path of file being checked.") ] + String Name; + + [ Description ( + "Composition of RPM's name and absolute file path." + " It's format is \"rpm_name#path\"") ] + String CheckID; + + [ Override("SoftwareElementID"), Description ( + "RPM's nevra. This means: " + "\"name-[epoch:]version-release.architecture\"." + " If epoch part is missing, a \"0:\" is assumed." ) ] + String SoftwareElementID; + + [ Override("Version"), Description ( + "Version of packaged software as listed by RPM package.") ] + String Version; + + [ Description ( + "True, if file is present in file system.")] + Boolean FileExists; + + [ Override("FileSize"), + Description("Size of installed file in Bytes.") ] + uint64 FileSize; + [ Units("KiloBytes"), + Description("File size in Bytes from RPM database.") ] + uint64 ExpectedFileSize; + + [ Description("File mode of installed file as a number.") ] + uint32 FileMode; + [ Description("File mode as a number given by RPM database.") ] + uint32 ExpectedFileMode; + + [ Description ( + "File mode of installed file as an array of permissions." + " Each value represents a bit position in file mode."), + ValueMap { "0", "1", "2" //XWR Other + , "3", "4", "5" //XWR Group + , "6", "7", "8" //XWR User + , "9","10","11" //Sticky, SGID, SUID + }, + Values { "Execute Other", "Write Other", "Read Other" + , "Execute Group", "Write Group", "Read Group" + , "Execute User" , "Write User" , "Read User" + , "Sticky", "SGID", "SUID" + } ] + Uint8 FileModeFlags[]; + [ Description ( + "File mode as an array of permissions of file from RPM database." + " Each value represents a bit position in file mode."), + ValueMap { "0", "1", "2" //XWR Other + , "3", "4", "5" //XWR Group + , "6", "7", "8" //XWR User + , "9","10","11" //Sticky, SGID, SUID + }, + Values { "Execute Other", "Write Other", "Read Other" + , "Execute Group", "Write Group", "Read Group" + , "Execute User" , "Write User" , "Read User" + , "Sticky", "SGID", "SUID" + } ] + Uint8 ExpectedFileModeFlags[]; + + [ Override("MD5Checksum"), + Description("MD5 checksum of installed file.") ] + String MD5Checksum; + [ Description("Checksum of installed file." + " Hash algorithm used can be obtained with ChecksumType property.") ] + String Checksum; + [ Description("Checksum of file from RPM database." + " Hash algorithm used can be obtained with ChecksumType property.") ] + String ExpectedChecksum; + + [ Description("Number of hash algorithm according to RFC4880." + " This algorithm is used for making checksums of RPM files and" + " packages. This algorithm is same for the whole RPM database."), + ValueMap { "0", "1", "2", "3" + , "8", "9","10","11" }, + Values { "UNKNOWN", "MD5", "SHA-1", "RIPE-MD/160" + , "SHA256", "SHA384", "SHA512", "SHA224" } ] + uint16 ChecksumType; + + [ Description("User ID of installed file.") ] + uint32 FileUserID; + [ Description("User ID of file from RPM database.") ] + uint32 ExpectedFileUserID; + + [ Description("Group ID of installed file.") ] + uint32 FileGroupID; + [ Description("Group ID of file from RPM database.") ] + uint32 ExpectedFileGroupID; + + [ Description("Time of last modification of installed file as number a" + " of secodns since the Epoch, 1970-01-01 00:00:00 +0000 (UTC).") ] + uint64 LastModificationTime; + [ Description("Time of last modification of file from RPM database as" + " a number of secodns since the Epoch," + " 1970-01-01 00:00:00 +0000 (UTC).") ] + uint64 ExpectedLastModificationTime; + + [ Description("Target destination of symbolic link as returned by" + " readline. If file is not a symbolic link, NULL is returned.") ] + String LinkTarget; + [ Description("Target destination of symbolic link from RPM database" + " as returned by readline. If file is not a symbolic link," + " NULL is returned.") ] + String ExpectedLinkTarget; + + [ Description("File type."), + ValueMap { "0", "1", "2", "3" + , "4", "5", "6" }, + Values { "Unknown", "File", "Directory", "Symlink" + , "FIFO", "Character Device", "Block Device" } ] + uint16 FileType; + [ Description("File type of file in RPM database."), + ValueMap { "0", "1", "2", "3" + , "4", "5", "6" }, + Values { "Unknown", "File", "Directory", "Symlink" + , "FIFO", "Character Device", "Block Device" } ] + uint16 ExpectedFileType; + + [ Description ( + "Returns array of booleans for verification checks. Each value" + " is either true or false, whether file passed the check or not." + " True is present also if the check does not apply to the file" + " (file implicitly passes the check, if check can not be" + " performed)." + " PassedFlagsDescriptions returns a description for each field in" + " this array saying, what it means.") ] + Boolean PassedFlags[]; + + [ Description ( + "Returns array of descriptions of checks corresponding to PassedFlags" + " array.")] + String PassedFlagsDescriptions[]; + +}; + +// =================================================================== +// Associations +// =================================================================== +[ Association ] +class LMI_SoftwareInstalledPackage : CIM_InstalledSoftwareElement { + + [ Override("Software"), Weak, Description ( + "Reference to the installed RPM package.")] + LMI_SoftwarePackage REF Software; + + [ Override("System"), Min(1), Description ( + "Reference to the ComputerSystem hosting a particular" + " RPM package.")] + CIM_ComputerSystem REF System; + + [ Description ( + "Updates the package to latest version." + " When any of \"epoch\", \"version\" or \"release\" argument is given" + ", install only matching available package. Otherwise try" + " to update to newest package available." + " If the \"epoch\", \"version\" and \"release\" of package is" + " already installed, or no newer package is available," + " \"Already newest\" value is returned."), + ValueMap { "0", "1", "2" }, + Values { "Already newest", "Successful installation", "Failed" } ] + uint16 Update( + [ IN(true), Description ( + "Specify particular epoch of package to update to." + " Update to newest, when empty.") ] + String Epoch, + [ IN(true), Description ( + "Specify particular version of package to update to." + " Update to newest, when empty") ] + String Version, + [ IN(true), Description ( + "Specify particular release of package to update to." + " Update to newest, when empty.") ] + String Release, + [ IN(false), OUT, Description ( + "The reference to newly installed package, if installation was" + " successful. Otherwise reference to current package.") ] + LMI_SoftwareInstalledPackage REF Installed + ); + + [ Description ( + "Verify existence and attributes of files installed from" + " RPM package. If all files installed exist and their attributes" + " matches, method returns \"Pass\". \"Not passed\" is returned when" + " arbitrary file differs in its attributes. And \"Error\" if" + " verification could not be done."), + ValueMap { "0", "1", "2" }, + Values { "Pass", "Not passed", "Error" } ] + uint32 CheckIntegrity( + [ IN(false), OUT, Description ( + "Array of references to LMI_SoftwareFileCheck, that did not pass" + " verification.") ] + LMI_SoftwareFileCheck REF Failed[] + ); + +}; + +[ Association, Aggregation ] +class LMI_SoftwarePackageChecks : CIM_SoftwareElementChecks { + + [ Override("Element"), Description("The RPM package being checked") ] + LMI_SoftwarePackage REF Element; + + [ Override("Check"), Description("The Check for the element.") ] + LMI_SoftwareFileCheck REF Check; + +}; + diff --git a/mof/LMI_Software.reg b/mof/LMI_Software.reg new file mode 100644 index 0000000..c75e69e --- /dev/null +++ b/mof/LMI_Software.reg @@ -0,0 +1,23 @@ +[LMI_SoftwarePackage] + provider: /usr/lib/python2.7/site-packages/cura/software/LMI_SoftwarePackage.py + location: pyCmpiProvider + type: instance method + namespace: root/cimv2 + +[LMI_SoftwareInstalledPackage] + provider: /usr/lib/python2.7/site-packages/cura/software/LMI_SoftwareInstalledPackage.py + location: pyCmpiProvider + type: instance association method + namespace: root/cimv2 + +[LMI_SoftwareFileCheck] + provider: /usr/lib/python2.7/site-packages/cura/software/LMI_SoftwareFileCheck.py + location: pyCmpiProvider + type: instance method + namespace: root/cimv2 + +[LMI_SoftwarePackageFile] + provider: /usr/lib/python2.7/site-packages/cura/software/LMI_SoftwarePackageFile.py + location: pyCmpiProvider + type: instance association + namespace: root/cimv2 diff --git a/mof/LMI_Yum.mof b/mof/LMI_Yum.mof deleted file mode 100644 index 892c1fb..0000000 --- a/mof/LMI_Yum.mof +++ /dev/null @@ -1,617 +0,0 @@ -/* - * Copyright (C) 2012 Michal Minar <miminar@redhat.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see <http://www.gnu.org/licenses/>. - */ - -#pragma locale ("en_US") -//#pragma namespace ("root/cimv2") - -[ Description ( - "RPM package installed on particular computer system with" - " YUM (The Yellowdog Updated, Modified) package manager.") -] -class LMI_YumPackage : CIM_SoftwareElement { - - [ Description ( - "The release number (referred to in some older documentation as a" - " \"vepoch\") is how the maintainer marks build revisions, starting" - " from 1. When a minor change (spec file changed, patch added/removed)" - " occurs, or a package is rebuilt to use newer headers or libraries," - " the release number should be incremented. If a major change" - " (new version of the software being packaged) occurs, the version" - " number should be changed to reflect the new software version," - " and the release number should be reset to 1.") - ] - String Release; - - [ Description ( - "It is important to be careful with the version of post-release" - " scheme, to ensure that package ordering is correct. It may be" - " necessary to use Epoch to ensure that the current package is" - " considered newer than the previous package.") - ] - uint16 Epoch; - - [ Description ( - "Architecture name, that package is compiled for. In case of no" - "architecture dependency, this will contain \"noarch\"."), - ValueMap { "0" , "1" , "2" , "3" , "4" , - "5" , "6" , "7" , "8" , - "10", "11", "12", "13", - "15", "16", "17", - "20", "21", "22", "23", "24", - "30", "31", - "35", "36", - "40", "41", "42", - "45", "46", - "50", "51", - "55", - "60", "61", "62", "63", "64", - "70", "71", "72", "73", "74" }, - Values { // 0 - "noarch", "other", "unknown", "x86", "i386", - // 5 - "i586", "i686", "x86_64", "Athlon", - // 10 - "IA32e", "IA64", "PowerPC", "PowerPC 64", - // 15 - "SPARC", "SPARC V9", "SPARC 64", - // 20 - "ARM", "ARMv6", "ARMv7", "ARMv8", "ARMv9", - // 30 - "StrongARM", "XScale", - // 35 - "PA-RISC", "PA-RISC 11", - // 40 - "MIPS", "MIPS 32", "MIPS 64", - // 45 - "MIPS NEC VR 4xxx", "MIPS RM7000", - // 50 - "MIPS TX 39", "MIPS TX 49", - // 55 - "V850", - // 60 - "Alpha", "Alpha EV6", "Alpha EV7", "Alpha EV8", "Alpha EV9", - // 70 - "SuperH", "SuperH 2", "SuperH 3", "SuperH 4", "SuperH 5" } - ] - uint16 Architecture; - - [ Description ( - "A software license is a legal instrument (usually by way of contract" - " law) governing the usage or redistribution of software." - " All software is copyright protected, except material in the public" - " domain. Contractual confidentiality is another way of protecting" - " software. A typical software license grants an end-user permission" - " to use one or more copies of software in ways where such a use would" - " otherwise potentially constitute copyright infringement of the" - " software owner's exclusive rights under copyright law. List of" - " possible values is based on list of licences approved by the" - " Free Software Foundation and OSI. Values contain only most common" - " Licences, so not every package's license will match. Moreover" - " lot of software is distributed under more licenses. In these cases" - " property will hold \"Other\" and LicenseString will contain precise" - " value." ), - ValueMap { "0" , "1" , "2" , - "5" , "6" , "7" , - "10" , "11" , - "15" , "16" , "17" , "18" , "19", - "25" , "26" , - "30" , "31" , "32" , "33" , - "35" , "36" , - "40" , "41" , "42" , "43" , "44", - "45" , "46" , "47" , "48" , - "50" , "51" , "52" , "53" , - "55" , "56" , "57" , - "65" , "66" , "67" , "68" , - "70" , "71" , "72" , "73" , - "75" , "76" , "77" , - "80" , "81" , "82" , "83" , "84", - "85" , "86" , "87" , "88" , "89", - "90" , "91", - "100", "101", "102", - "110", "111", "112", "113", "114", - "115", "116", "117", "118", "119", - "125", "126", "127", - "130", "131", "132", "133", - "135", "136", "137", "138", "139", - "140", "141", "142", - "145", "146", - "150", "151", "152", "153", "154", - "155", "156", "157", "158", "159", - "160", "161", "162", "163", "164", - "165", "166", "167", "168", "169", - "170", "171", "172", "173", "174", - "175", "176", "177", "178", "179", - "180", "181", "182", "183", "184", - "185", "186", "187", "188", "189", - "190", "191", "192", "193", "194", - "195", "196", "197", "198", - "200", "201", "202", "203", "204", - "205", "206", "207", "208", "209", - "215", "216", "217", - "220", "221", "222", "223", "224", - "225", "226", "227", "228", "229", - "230", "231", "232", "233", - "235", "236", "237", "238", "239", - "240", "241", "242", "243", "244", - "245", "246", "247", "248", "249", - "250", "251", "252", "253", "254", - "255", "256", "257", "258", "259", - "260", "261", "262", "263", "264", - "265", "266", - "270", "271", - "275", "276", "277", - "280", "281", - "400", "401", "402", "403", "404", - "405", "406", "407", "408", "409", - "410", "411", "412", "413", "414", - "415", "416", "417", "418", "419" - "420", "421", "422", "423", "424", - "425", "426", "427", "428", "429", - "430", "431", "432", "433", "434", - "435", "436", "437", "438", "439", - "440" }, - Values { // 0 - "Other", "Unknown", - "Freely redistributable without restriction", - // 5 - "Glide", "AFL", "Adobe", - // 10 - "MIT", "MIT with advertising", - // 15 - "AGPL", "AGPLv1", "AGPLv3", "AGPLv3+", "AGPLv3 with exceptions", - // 25 - "ADSL", "AMDPLPA", - // 30 - "ASL", "ASL 1.0", "ASL 1.1", "ASL 2.0", - // 35 - "Artistic clarified", "Artistic 2.0", - // 40 - "ARL", "AAL", "Bahyph", "Barr", "Beerware", - // 45 - "BeOpen", "Bibtex", "Boost", "Borceux", - // 50 - "BSD", "BSD with advertising", "BSD with attribution", - "BSD Protection", - // 55 - "AMPAS BSD", "LBNL BSD", "RiceBSD", - // 65 - "CATOSL", "CeCILL", "CeCILL-B", "CeCILL-C", - // 70 - "Netscape", "CNRI", "CDDL", "CPL", - // 75 - "Condor", "Copyright only", "CPAL", - // 80 - "GPL", "GPL+", "GPL+ with exceptions", "GPLv1", "GPLv2", - // 85 - "GPLv2 with exceptions", "GPLv2+", "GPLv2+ with exceptions", - "GPLv3", "GPLv3 with exceptions", - // 90 - "GPLv3+", "GPLv3+ with exceptions", - // 100 - "GPL+ or Artistic", "GPLv2 or Artistic", "GPLv2+ or Artistic", - // 110 - "LGPL", "LGPLV2", "LGPLv2 with exceptions", "LGPLV2+", - "LGPLV2+ with exceptions", - // 115 - "LGPLv3", "LGPLv3 with exceptions", "LGPLv3+", - "LGPLv3+ with exceptions", "LLGPL", - // 125 - "CC0", "Crossword", "Crystal Stacker", - // 130 - "MPL", "MPLv1.0", "MPLv1.1", "MPLv2.0", - // 135 - "diffmark", "WTFPL", "DOC", "Dotseqn", "DSDP", - // 140 - "dvipdfm", "EPL", "eCos", - // 145 - "ECL 1.0", "ECL 2.0", - // 150 - "eGenix", "EFL 2.0", "Entessa", "ERPL", "EU Datagrid", - // 155 - "EUPL 1.1", "Eurosym", "Fair", "FTL", "Gitware", - // 160 - "GL2PS", "Glulxe", "gnuplot", "HaskellReport", "IBM", - // 165 - "iMatrix", "ImageMagick", "Imlib2", "IJG", "Intel ACPI", - // 170 - "Interbase", "ISC", "Jabber", "JasPer", "JPython", - // 175 - "Julius", "Knuth", "LPPL", "Latex2e", "Leptonica", - // 180 - "Lhcyr", "libtiff", "Logica", "MakeIndex", "mecab-ipadic", - // 185 - "MS-PL", "MS-RL", "midnight", "MirOS", "mod_macro", - // 190 - "Motosoto", "Naumen", "NCSA", "NetCDF", "NGPL", - // 195 - "NOSL", "Newmat", "Newsletr", "Nokia", - // 200 - "NLPL", "Noweb", "OpenLDAP", "OML", "OpenPBS", - // 205 - "OSL 1.0", "OSL 1.1", "OSL 2.0", "OSL 2.1", "OSL 3.0", - // 215 - "OpenSSL", "OReilly", "Par", - // 220 - "Phorum", "PHP", "PlainTeX", "Plexus", "PostgreSQL", - // 225 - "psfrag", "psutils", "Public Domain", "Python", "Qhull", - // 230 - "QPL", "Rdisc", "RPSL", "Romio", - // 235 - "Rsfs", "Ruby", "Saxpath", "SCEA", "SCRIP", - // 240 - "Sendmail", "Sleepycat", "SLIB", "SNIA", "SISSL", - // 245 - "SPL", "TCL", "Teeworlds", "TPL", "Threeparttable", - // 250 - "TMate", "TORQUEv1.1", "TOSL", "UCD", "Vim", - // 255 - "VNLSL", "VOSTROM", "VSL", "W3C", "Webmin", - // 260 - "Wsuipa", "wxWidgets", "xinetd", "Xerox", "xpp", - // 265 - "XSkat", "YPLv1.1", - // 270 - "Zed", "Zend", - // 275 - "ZPLv1.0", "ZPLv2.0", "ZPLv2.1", - // 280 - "zlib", "zlib with acknowledgement", - - // 400 (Good documentation/content/font licenses) - "CDL", "CC-BY", "CC-BY-SA", "CC-BY-ND", - // 405 - "DSL", "DMTF", "OAL", "FBSDDL", "GFDL", - // 410 - "IEEE", "LDPL", "OFSFDL", "Open Publication", "Public Use", - // 415 - "EFML", "Free Art", "GeoTratis", "Green OpenMusic", "OFL", - // 420 - "Utopia", "AMS", "Arphic", "Baekmuk", "Bitstream Vera", - // 425 - "Charter", "DoubleStroke", "ec", "elvish", "LPPL", - // 430 - "Hershey", "IPA", "Liberation", "Lucida", "MgOpen", - // 435 - "mplus", "PTFL", "Punknova", "STIX", "Wadalab", - // 440 - "XANO" - } - ] - uint16 License; - - [ Description ( - "Provides the same information as License property, but" - " contains the exact string obtained from RPM package.")] - String LicenseString; - - [ Description ( - "Denotes the package group, in which the package belongs. Values" - " contain only the most common groups. That means, that not every" - " package belongs to any of them. In such case value \"Other\" is" - " returned. For precise value contained in RPM package, check out" - " GroupString property."), - ValueMap { "0", "1", "2", "3", "4", - "5", "6", "7", "8", "9", - "10","11","12","13","14", - "15","16","17","18","19", - "20","21","22","23","24", - "25","26","27","28","29", - "30","31","32","33","34", - "35","36","37","38","39", - "40" }, - Values { - // 0 - "Other", "Unknown", "Unspecified", - "Amusements/Games", "Amusements/Graphics", - // 5 - "Applications/Archiving", - "Applications/Communications", - "Applications/Databases", - "Applications/Editors", - "Applications/Emulators", - // 10 - "Applications/Engineering", - "Applications/File", - "Applications/Internet", - "Applications/Multimedia", - "Applications/Productivity", - // 15 - "Applications/Publishing", - "Applications/System", - "Applications/Text", - "Development/Build Tools", - "Development/Debug", - // 20 - "Development/Debuggers", - "Development/Documentation", - "Development/Java", - "Development/Languages", - "Development/Libraries", - // 25 - "Development/Libraries/Java", - "Development/System", - "Development/Tools", - "Documentation", - "Internet/WWW/Dynamic Content", - // 30 - "System/Libraries", - "System Environment/Base", - "System Environment/Daemons", - "System Environment/Kernel", - "System Environment/Libraries", - // 35 - "System Environment/Shells", - "Text Processing/Markup/XML", - "User Interface/Desktops", - "User Interface/X", - "User Interface/X Hardware Support", - // 40 - "Utilities" } - ] - uint16 Group; - - [ Description ( - "Provides the same information as Group, but contains precise string" - " contained in package. Lot of packages define their own custom" - " group name, which results in \"Other\" value returned by Group" - " property.") ] - String GroupString; - - [ Description ( - "Size of RPM package in Bytes" ) ] - uint64 Size; - - [ Description ( - "Will install available package."), - ValueMap { "0", "1", "2" }, - Values { "Already installed", "Successful installation", "Failed" } ] - uint32 Install( - [ IN(false), OUT, Description ( - "The reference to newly installed package, if installation was" - " successful. Reference to current package if it is already" - " installed and Null otherwise.") ] - LMI_YumInstalledPackage REF Installed - ); - - [ Description ( - "Will uninstall installed package."), - ValueMap { "0", "1", "2" }, - Values { "Not installed", "Successful removal", "Failed" } ] - uint32 Remove(); - -}; - -[ Description ( - "Identifies a file contained by RPM package. It's located" - " in directory identified in FileName. The Invoke methods" - " check for file existence and whether its attributes match" - " those given by RPM package.") -] -class LMI_YumFileCheck : CIM_FileSpecification { - - [ Key, Description ( - "Absolute path of file being checked.") ] - String Name; - - [ Description ( - "Composition of RPM's name and absolute file path." - " It's format is \"rpm_name#path\"") ] - String CheckID; - - [ Override("SoftwareElementID"), Description ( - "RPM's nevra. This means: " - "\"name-[epoch:]version-release.architecture\"." - " If epoch part is missing, a \"0:\" is assumed." ) ] - String SoftwareElementID; - - [ Override("Version"), Description ( - "Version of packaged software as listed by RPM package.") ] - String Version; - - [ Description ( - "True, if file is present in file system.")] - Boolean FileExists; - - [ Override("FileSize"), - Description("Size of installed file in Bytes.") ] - uint64 FileSize; - [ Units("KiloBytes"), - Description("File size in Bytes from RPM database.") ] - uint64 ExpectedFileSize; - - [ Description("File mode of installed file as a number.") ] - uint32 FileMode; - [ Description("File mode as a number given by RPM database.") ] - uint32 ExpectedFileMode; - - [ Description ( - "File mode of installed file as an array of permissions." - " Each value represents a bit position in file mode."), - ValueMap { "0", "1", "2" //XWR Other - , "3", "4", "5" //XWR Group - , "6", "7", "8" //XWR User - , "9","10","11" //Sticky, SGID, SUID - }, - Values { "Execute Other", "Write Other", "Read Other" - , "Execute Group", "Write Group", "Read Group" - , "Execute User" , "Write User" , "Read User" - , "Sticky", "SGID", "SUID" - } ] - Uint8 FileModeFlags[]; - [ Description ( - "File mode as an array of permissions of file from RPM database." - " Each value represents a bit position in file mode."), - ValueMap { "0", "1", "2" //XWR Other - , "3", "4", "5" //XWR Group - , "6", "7", "8" //XWR User - , "9","10","11" //Sticky, SGID, SUID - }, - Values { "Execute Other", "Write Other", "Read Other" - , "Execute Group", "Write Group", "Read Group" - , "Execute User" , "Write User" , "Read User" - , "Sticky", "SGID", "SUID" - } ] - Uint8 ExpectedFileModeFlags[]; - - [ Override("MD5Checksum"), - Description("MD5 checksum of installed file.") ] - String MD5Checksum; - [ Description("Checksum of installed file." - " Hash algorithm used can be obtained with ChecksumType property.") ] - String Checksum; - [ Description("Checksum of file from RPM database." - " Hash algorithm used can be obtained with ChecksumType property.") ] - String ExpectedChecksum; - - [ Description("Number of hash algorithm according to RFC4880." - " This algorithm is used for making checksums of RPM files and" - " packages. This algorithm is same for the whole RPM database."), - ValueMap { "0", "1", "2", "3" - , "8", "9","10","11" }, - Values { "UNKNOWN", "MD5", "SHA-1", "RIPE-MD/160" - , "SHA256", "SHA384", "SHA512", "SHA224" } ] - uint16 ChecksumType; - - [ Description("User ID of installed file.") ] - uint32 FileUserID; - [ Description("User ID of file from RPM database.") ] - uint32 ExpectedFileUserID; - - [ Description("Group ID of installed file.") ] - uint32 FileGroupID; - [ Description("Group ID of file from RPM database.") ] - uint32 ExpectedFileGroupID; - - [ Description("Time of last modification of installed file as number a" - " of secodns since the Epoch, 1970-01-01 00:00:00 +0000 (UTC).") ] - uint64 LastModificationTime; - [ Description("Time of last modification of file from RPM database as" - " a number of secodns since the Epoch," - " 1970-01-01 00:00:00 +0000 (UTC).") ] - uint64 ExpectedLastModificationTime; - - [ Description("Target destination of symbolic link as returned by" - " readline. If file is not a symbolic link, NULL is returned.") ] - String LinkTarget; - [ Description("Target destination of symbolic link from RPM database" - " as returned by readline. If file is not a symbolic link," - " NULL is returned.") ] - String ExpectedLinkTarget; - - [ Description("File type."), - ValueMap { "0", "1", "2", "3" - , "4", "5", "6" }, - Values { "Unknown", "File", "Directory", "Symlink" - , "FIFO", "Character Device", "Block Device" } ] - uint16 FileType; - [ Description("File type of file in RPM database."), - ValueMap { "0", "1", "2", "3" - , "4", "5", "6" }, - Values { "Unknown", "File", "Directory", "Symlink" - , "FIFO", "Character Device", "Block Device" } ] - uint16 ExpectedFileType; - - [ Description ( - "Returns array of booleans for verification checks. Each value" - " is either true or false, whether file passed the check or not." - " True is present also if the check does not apply to the file" - " (file implicitly passes the check, if check can not be" - " performed)." - " PassedFlagsDescriptions returns a description for each field in" - " this array saying, what it means.") ] - Boolean PassedFlags[]; - - [ Description ( - "Returns array of descriptions of checks corresponding to PassedFlags" - " array.")] - String PassedFlagsDescriptions[]; - -}; - -// =================================================================== -// Associations -// =================================================================== -[ Association ] -class LMI_YumInstalledPackage : CIM_InstalledSoftwareElement { - - [ Override("Software"), Weak, Description ( - "Reference to the installed RPM package.")] - LMI_YumPackage REF Software; - - [ Override("System"), Min(1), Description ( - "Reference to the ComputerSystem hosting a particular" - " RPM package.")] - CIM_ComputerSystem REF System; - - [ Description ( - "Updates the package to latest version." - " When any of \"epoch\", \"version\" or \"release\" argument is given" - ", install only matching available package. Otherwise try" - " to update to newest package available." - " If the \"epoch\", \"version\" and \"release\" of package is" - " already installed, or no newer package is available," - " \"Already newest\" value is returned."), - ValueMap { "0", "1", "2" }, - Values { "Already newest", "Successful installation", "Failed" } ] - uint16 Update( - [ IN(true), Description ( - "Specify particular epoch of package to update to." - " Update to newest, when empty.") ] - String Epoch, - [ IN(true), Description ( - "Specify particular version of package to update to." - " Update to newest, when empty") ] - String Version, - [ IN(true), Description ( - "Specify particular release of package to update to." - " Update to newest, when empty.") ] - String Release, - [ IN(false), OUT, Description ( - "The reference to newly installed package, if installation was" - " successful. Otherwise reference to current package.") ] - LMI_YumInstalledPackage REF Installed - ); - - [ Description ( - "Verify existence and attributes of files installed from" - " RPM package. If all files installed exist and their attributes" - " matches, method returns \"Pass\". \"Not passed\" is returned when" - " arbitrary file differs in its attributes. And \"Error\" if" - " verification could not be done."), - ValueMap { "0", "1", "2" }, - Values { "Pass", "Not passed", "Error" } ] - uint32 CheckIntegrity( - [ IN(false), OUT, Description ( - "Array of references to LMI_YumFileCheck, that did not pass" - " verification.") ] - LMI_YumFileCheck REF Failed[] - ); - -}; - -[ Association, Aggregation ] -class LMI_YumPackageFile : CIM_SoftwareElementChecks { - - [ Override("Element"), Description("The RPM package being checked") ] - LMI_YumPackage REF Element; - - [ Override("Check"), Description("The Check for the element.") ] - LMI_YumFileCheck REF Check; - -}; - diff --git a/mof/LMI_Yum.reg b/mof/LMI_Yum.reg deleted file mode 100644 index 7ada5df..0000000 --- a/mof/LMI_Yum.reg +++ /dev/null @@ -1,23 +0,0 @@ -[LMI_YumPackage] - provider: /usr/lib/python2.7/site-packages/cura/yum/LMI_YumPackage.py - location: pyCmpiProvider - type: instance method - namespace: root/cimv2 - -[LMI_YumInstalledPackage] - provider: /usr/lib/python2.7/site-packages/cura/yum/LMI_YumInstalledPackage.py - location: pyCmpiProvider - type: instance association method - namespace: root/cimv2 - -[LMI_YumFileCheck] - provider: /usr/lib/python2.7/site-packages/cura/yum/LMI_YumFileCheck.py - location: pyCmpiProvider - type: instance method - namespace: root/cimv2 - -[LMI_YumPackageFile] - provider: /usr/lib/python2.7/site-packages/cura/yum/LMI_YumPackageFile.py - location: pyCmpiProvider - type: instance association - namespace: root/cimv2 diff --git a/src/yum/TODO b/src/software/TODO index 18c155b..18c155b 100644 --- a/src/yum/TODO +++ b/src/software/TODO diff --git a/src/yum/providers/LMI_YumFileCheck.py b/src/software/providers/LMI_SoftwareFileCheck.py index 9e6e8d1..0058f78 100644 --- a/src/yum/providers/LMI_YumFileCheck.py +++ b/src/software/providers/LMI_SoftwareFileCheck.py @@ -15,9 +15,9 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -"""Python Provider for LMI_YumFileCheck +"""Python Provider for LMI_SoftwareFileCheck -Instruments the CIM class LMI_YumFileCheck +Instruments the CIM class LMI_SoftwareFileCheck """ @@ -25,11 +25,11 @@ import pywbem from pywbem.cim_provider2 import CIMProvider2 from util.common import * -filecheck2model = YumFileCheck.filecheck_wrapper( - 'root/cimv2', 'LMI_YumFileCheck') +filecheck2model = SoftwareFileCheck.filecheck_wrapper( + 'root/cimv2', 'LMI_SoftwareFileCheck') -class LMI_YumFileCheck(CIMProvider2): - """Instrument the CIM class LMI_YumFileCheck +class LMI_SoftwareFileCheck(CIMProvider2): + """Instrument the CIM class LMI_SoftwareFileCheck Identifies a file contained by RPM package. It's located in directory identified in FileName. The Invoke methods check for file existence @@ -70,7 +70,7 @@ class LMI_YumFileCheck(CIMProvider2): logger.log_debug('Entering %s.get_instance()' \ % self.__class__.__name__) - vpkg = YumFileCheck.object_path2yumcheck(env, model.path) + vpkg = SoftwareFileCheck.object_path2yumcheck(env, model.path) pkg = vpkg.po fi = pkg.hdr.fiFromHeader() return filecheck2model(vpkg, model['Name'], env, False) @@ -168,7 +168,7 @@ class LMI_YumFileCheck(CIMProvider2): raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED) # Remove to implement def cim_method_invoke(self, env, object_name): - """Implements LMI_YumFileCheck.Invoke() + """Implements LMI_SoftwareFileCheck.Invoke() The Invoke method evaluates this Check. The details of the evaluation are described by the specific subclasses of CIM_Check. @@ -210,17 +210,17 @@ class LMI_YumFileCheck(CIMProvider2): % self.__class__.__name__) with YumDB.getInstance(env) as yb: - vpkg = YumFileCheck.object_path2yumcheck(env, object_name) - fc = YumFileCheck.test_file(env, - YumFileCheck.pkg_checksum_type(vpkg.po), + vpkg = SoftwareFileCheck.object_path2yumcheck(env, object_name) + fc = SoftwareFileCheck.test_file(env, + SoftwareFileCheck.pkg_checksum_type(vpkg.po), vpkg._files[object_name["Name"]]) out_params = [] - ret = 0 if YumFileCheck.filecheck_passed(fc) else 2 + ret = 0 if SoftwareFileCheck.filecheck_passed(fc) else 2 return (pywbem.Uint32(ret), out_params) def cim_method_invokeonsystem(self, env, object_name, param_targetsystem=None): - """Implements LMI_YumFileCheck.InvokeOnSystem() + """Implements LMI_SoftwareFileCheck.InvokeOnSystem() The InvokeOnSystem method evaluates this Check. The details of the evaluation are described by the specific subclasses of CIM_Check. @@ -399,10 +399,10 @@ class LMI_YumFileCheck(CIMProvider2): Character_Device = pywbem.Uint16(5) Block_Device = pywbem.Uint16(6) -## end of class LMI_YumFileCheckProvider +## end of class LMI_SoftwareFileCheckProvider ## get_providers() for associating CIM Class Name to python provider class name def get_providers(env): - lmi_yumfilecheck_prov = LMI_YumFileCheck(env) - return {'LMI_YumFileCheck': lmi_yumfilecheck_prov} + lmi_softwarefilecheck_prov = LMI_SoftwareFileCheck(env) + return {'LMI_SoftwareFileCheck': lmi_softwarefilecheck_prov} diff --git a/src/yum/providers/LMI_YumInstalledPackage.py b/src/software/providers/LMI_SoftwareInstalledPackage.py index 915ff2b..008a47b 100644 --- a/src/yum/providers/LMI_YumInstalledPackage.py +++ b/src/software/providers/LMI_SoftwareInstalledPackage.py @@ -16,21 +16,21 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -"""Python Provider for LMI_YumInstalledPackage +"""Python Provider for LMI_SoftwareInstalledPackage -Instruments the CIM class LMI_YumInstalledPackage +Instruments the CIM class LMI_SoftwareInstalledPackage """ import itertools import pywbem from pywbem.cim_provider2 import CIMProvider2 -from LMI_YumPackage import pkg2model, LMI_YumPackage -from LMI_YumFileCheck import filecheck2model +from LMI_SoftwarePackage import pkg2model, LMI_SoftwarePackage +from LMI_SoftwareFileCheck import filecheck2model from util.common import * -class LMI_YumInstalledPackage(CIMProvider2): - """Instrument the CIM class LMI_YumInstalledPackage +class LMI_SoftwareInstalledPackage(CIMProvider2): + """Instrument the CIM class LMI_SoftwareInstalledPackage The InstalledSoftwareElement association allows the identification of the ComputerSystem on which a particular SoftwareElement is installed. @@ -71,7 +71,7 @@ class LMI_YumInstalledPackage(CIMProvider2): check_computer_system_op(env, model['System']) with YumDB.getInstance(env): - pkg = YumPackage.object_path2pkg(env, model['Software']) + pkg = SoftwarePackage.object_path2pkg(env, model['Software']) model['Software'] = pkg2model(env, pkg, True) return model @@ -107,7 +107,7 @@ class LMI_YumInstalledPackage(CIMProvider2): # we set property values on the model. model.path.update({'System': None, 'Software': None}) - yum_package_path = pywbem.CIMInstanceName("LMI_YumPackage", + yum_package_path = pywbem.CIMInstanceName("LMI_SoftwarePackage", namespace=model.path.namespace, host=model.path.host) model['System'] = get_computer_system_op() @@ -164,7 +164,7 @@ class LMI_YumInstalledPackage(CIMProvider2): check_computer_system_op(env, instance['System']) with YumDB.getInstance(env) as yb: - pkg = YumPackage.object_path2pkg_search(env, instance['Software']) + pkg = SoftwarePackage.object_path2pkg_search(env, instance['Software']) if isinstance(pkg, yum.rpmsack.RPMInstalledPackage): raise pywbem.CIMError(pywbem.CIM_ERR_ALREADY_EXISTS, "Package is already installed.") @@ -179,9 +179,9 @@ class LMI_YumInstalledPackage(CIMProvider2): # return instance pkg_iname = pkg2model(env, pkg, True) pkg_iname["SoftwareElementState"] = \ - LMI_YumPackage.Values.SoftwareElementState.Executable + LMI_SoftwarePackage.Values.SoftwareElementState.Executable instance["Software"] = pkg_iname - return LMI_YumInstalledPackage(env).get_instance(env, instance) + return LMI_SoftwareInstalledPackage(env).get_instance(env, instance) def delete_instance(self, env, instance_name): """Delete an instance. @@ -211,7 +211,7 @@ class LMI_YumInstalledPackage(CIMProvider2): check_computer_system_op(env, instance_name['System']) with YumDB.getInstance(env) as yb: - pkg = YumPackage.object_path2pkg(env, instance_name["Software"]) + pkg = SoftwarePackage.object_path2pkg(env, instance_name["Software"]) logger.log_info('removing package "%s"' % pkg.nevra) yb.remove(pkg) yb.buildTransaction() @@ -289,12 +289,12 @@ class LMI_YumInstalledPackage(CIMProvider2): super='CIM_ComputerSystem') or \ ch.is_subclass(object_name.namespace, sub=object_name.classname, - super='LMI_YumPackage'): + super='LMI_SoftwarePackage'): return self.simple_refs(env, object_name, model, result_class_name, role, result_role, keys_only) def cim_method_checkintegrity(self, env, object_name): - """Implements LMI_YumPackage.CheckIntegrity() + """Implements LMI_SoftwarePackage.CheckIntegrity() Verify existence and attributes of files installed from RPM package. If all files installed exist and their attributes @@ -314,8 +314,8 @@ class LMI_YumInstalledPackage(CIMProvider2): Output parameters: Failed -- (type REF (pywbem.CIMInstanceName( - classname='LMI_YumFileCheck', ...)) - Array of references to LMI_YumFileCheck, that did not pass + classname='LMI_SoftwareFileCheck', ...)) + Array of references to LMI_SoftwareFileCheck, that did not pass verification. Possible Errors: @@ -336,13 +336,13 @@ class LMI_YumInstalledPackage(CIMProvider2): failed = [] with YumDB.getInstance(env) as yb: - pkg = YumPackage.object_path2pkg(env, object_name['Software']) - csum = YumFileCheck.pkg_checksum_type(pkg) + pkg = SoftwarePackage.object_path2pkg(env, object_name['Software']) + csum = SoftwareFileCheck.pkg_checksum_type(pkg) vpkg = yum.packages._RPMVerifyPackage( pkg, pkg.hdr.fiFromHeader(), csum, [], True) for vpf in vpkg: - fc = YumFileCheck.test_file(env, csum, vpf) - if YumFileCheck.filecheck_passed(fc): continue + fc = SoftwareFileCheck.test_file(env, csum, vpf) + if SoftwareFileCheck.filecheck_passed(fc): continue failed.append(filecheck2model( vpkg, vpf.filename, env, keys_only=True, fc=fc)) out_params = [ pywbem.CIMParameter('Failed', type='reference', @@ -355,7 +355,7 @@ class LMI_YumInstalledPackage(CIMProvider2): param_epoch=None, param_release=None, param_version=None): - """Implements LMI_YumInstalledPackage.Update() + """Implements LMI_SoftwareInstalledPackage.Update() Updates the package to latest version. When any of "version" or "release" argument is given, install only matching available @@ -379,7 +379,7 @@ class LMI_YumInstalledPackage(CIMProvider2): Output parameters: Installed -- (type REF (pywbem.CIMInstanceName( - classname='LMI_YumInstalledPackage', ...)) + classname='LMI_SoftwareInstalledPackage', ...)) The reference to newly installed package, if installation was successful. Otherwise reference to current package. @@ -402,7 +402,7 @@ class LMI_YumInstalledPackage(CIMProvider2): check_computer_system_op(env, object_name['System']) with YumDB.getInstance(env) as yb: - orig = YumPackage.object_path2pkg(env, object_name['Software']) + orig = SoftwarePackage.object_path2pkg(env, object_name['Software']) evr_str = [] for name, param in ( @@ -451,7 +451,7 @@ class LMI_YumInstalledPackage(CIMProvider2): orig.name, pkg.evra)) out_params[0].value["SoftwareElementState"] = \ - LMI_YumPackage.Values.SoftwareElementState.Executable + LMI_SoftwarePackage.Values.SoftwareElementState.Executable return (self.Values.Update.Successful_installation, out_params) @@ -466,10 +466,10 @@ class LMI_YumInstalledPackage(CIMProvider2): Not_passed = pywbem.Uint32(1) Error = pywbem.Uint32(2) -## end of class LMI_YumInstalledPackage +## end of class LMI_SoftwareInstalledPackage ## get_providers() for associating CIM Class Name to python provider class name def get_providers(env): - lmi_yuminstalledpackage_prov = LMI_YumInstalledPackage(env) - return {'LMI_YumInstalledPackage': lmi_yuminstalledpackage_prov} + lmi_softwareinstalledpackage_prov = LMI_SoftwareInstalledPackage(env) + return {'LMI_SoftwareInstalledPackage': lmi_softwareinstalledpackage_prov} diff --git a/src/yum/providers/LMI_YumPackage.py b/src/software/providers/LMI_SoftwarePackage.py index 3b93c86..9ef3266 100644 --- a/src/yum/providers/LMI_YumPackage.py +++ b/src/software/providers/LMI_SoftwarePackage.py @@ -16,23 +16,22 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -"""Python Provider for LMI_YumPackage +"""Python Provider for LMI_SoftwarePackage -Instruments the CIM class LMI_YumPackage +Instruments the CIM class LMI_SoftwarePackage """ import itertools import datetime -#import yum import pywbem from pywbem.cim_provider2 import CIMProvider2 from util.common import * -pkg2model = YumPackage.pkg2model_wrapper('root/cimv2', "LMI_YumPackage") +pkg2model = SoftwarePackage.pkg2model_wrapper('root/cimv2', "LMI_SoftwarePackage") -class LMI_YumPackage(CIMProvider2): - """Instrument the CIM class LMI_YumPackage +class LMI_SoftwarePackage(CIMProvider2): + """Instrument the CIM class LMI_SoftwarePackage RPM package installed on particular computer system with YUM (The Yellowdog Updated, Modified) package manager. @@ -72,7 +71,7 @@ class LMI_YumPackage(CIMProvider2): % self.__class__.__name__) with YumDB.getInstance(env): - pkg = YumPackage.object_path2pkg(env, model.path, 'all') + pkg = SoftwarePackage.object_path2pkg(env, model.path, 'all') return pkg2model(env, pkg, keys_only=False, model=model) def enum_instances(self, env, model, keys_only): @@ -182,7 +181,7 @@ class LMI_YumPackage(CIMProvider2): raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED) def cim_method_install(self, env, object_name): - """Implements LMI_YumPackage.Install() + """Implements LMI_SoftwarePackage.Install() Will install available package. @@ -197,7 +196,7 @@ class LMI_YumPackage(CIMProvider2): Output parameters: Installed -- (type REF (pywbem.CIMInstanceName( - classname='LMI_YumInstalledPackage', ...)) + classname='LMI_SoftwareInstalledPackage', ...)) The reference to newly installed package, if installation was successful. Null otherwise. @@ -218,7 +217,7 @@ class LMI_YumPackage(CIMProvider2): with YumDB.getInstance(env) as yb: # get available packages - pkg = YumPackage.object_path2pkg_search(env, object_name) + pkg = SoftwarePackage.object_path2pkg_search(env, object_name) out_params = [ pywbem.CIMParameter('Installed', type='reference') ] if isinstance(pkg, yum.rpmsack.RPMInstalledPackage): out_params[0].value = pkg2model(env, pkg, True) @@ -231,16 +230,13 @@ class LMI_YumPackage(CIMProvider2): yb.processTransaction() logger.log_info('package installed'.format(pkg.nevra)) - # return object_name out_params[0].value = pkg2model(env, pkg, True, object_name) - # pkg's class is YumAvailablePackage and pkg2model thinks it's - # not installed out_params[0].value['SoftwareElementState'] = \ self.Values.SoftwareElementState.Executable return (self.Values.Install.Successful_installation, out_params) def cim_method_remove(self, env, object_name): - """Implements LMI_YumPackage.Remove() + """Implements LMI_SoftwarePackage.Remove() Will uninstall installed package. @@ -272,7 +268,7 @@ class LMI_YumPackage(CIMProvider2): % self.__class__.__name__) with YumDB.getInstance(env) as yb: - pkg = YumPackage.object_path2pkg(env, object_name, 'all') + pkg = SoftwarePackage.object_path2pkg(env, object_name, 'all') if isinstance(pkg, yum.rpmsack.RPMInstalledPackage): logger.log_info('removing package "%s"' % pkg.nevra) yb.remove(pkg) @@ -513,10 +509,10 @@ class LMI_YumPackage(CIMProvider2): Successful_installation = pywbem.Uint32(1) Failed = pywbem.Uint32(2) -## end of class LMI_YumPackage +## end of class LMI_SoftwarePackage ## get_providers() for associating CIM Class Name to python provider class name def get_providers(env): - lmi_yumpackage_prov = LMI_YumPackage(env) - return {'LMI_YumPackage': lmi_yumpackage_prov} + lmi_softwarepackage_prov = LMI_SoftwarePackage(env) + return {'LMI_SoftwarePackage': lmi_softwarepackage_prov} diff --git a/src/yum/providers/LMI_YumPackageFile.py b/src/software/providers/LMI_SoftwarePackageFile.py index 45df4c3..389dbbf 100644 --- a/src/yum/providers/LMI_YumPackageFile.py +++ b/src/software/providers/LMI_SoftwarePackageFile.py @@ -15,20 +15,20 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -"""Python Provider for LMI_YumPackageFile +"""Python Provider for LMI_SoftwarePackageFile -Instruments the CIM class LMI_YumPackageFile +Instruments the CIM class LMI_SoftwarePackageFile """ import pywbem from pywbem.cim_provider2 import CIMProvider2 -from LMI_YumFileCheck import filecheck2model -from LMI_YumPackage import pkg2model +from LMI_SoftwareFileCheck import filecheck2model +from LMI_SoftwarePackage import pkg2model from util.common import * -class LMI_YumPackageFile(CIMProvider2): - """Instrument the CIM class LMI_YumPackageFile +class LMI_SoftwarePackageFile(CIMProvider2): + """Instrument the CIM class LMI_SoftwarePackageFile This association ties a SoftwareElement to a specific Check to validate its state or its movement to the next state. Note that @@ -70,7 +70,7 @@ class LMI_YumPackageFile(CIMProvider2): logger.log_debug('Entering %s.get_instance()' \ % self.__class__.__name__) - vpkg = YumCheckFile.object_path2yumcheck(env, model['Check']) + vpkg = SoftwareFileCheck.object_path2yumcheck(env, model['Check']) model['Check'] = filecheck2model(vpkg, model['Check']['Name'], env, keys_only=True) model['Element'] = pkg2model(env, vpkg.po, keys_only=True) @@ -111,8 +111,8 @@ class LMI_YumPackageFile(CIMProvider2): while False: # TODO more instances? # TODO fetch system resource # Key properties - #model['Check'] = pywbem.CIMInstanceName(classname='LMI_YumFileCheck', ...) # TODO (type = REF (pywbem.CIMInstanceName(classname='LMI_YumFileCheck', ...)) - #model['Element'] = pywbem.CIMInstanceName(classname='LMI_YumPackage', ...) # TODO (type = REF (pywbem.CIMInstanceName(classname='LMI_YumPackage', ...)) + #model['Check'] = pywbem.CIMInstanceName(classname='LMI_SoftwareFileCheck', ...) # TODO (type = REF (pywbem.CIMInstanceName(classname='LMI_SoftwareFileCheck', ...)) + #model['Element'] = pywbem.CIMInstanceName(classname='LMI_SoftwarePackage', ...) # TODO (type = REF (pywbem.CIMInstanceName(classname='LMI_SoftwarePackage', ...)) if keys_only: yield model else: @@ -259,17 +259,17 @@ class LMI_YumPackageFile(CIMProvider2): if ( (not role or role.lower() == 'element') and ch.is_subclass(object_name.namespace, sub=object_name.classname, - super='LMI_YumPackage')): + super='LMI_SoftwarePackage')): filecheck_model = pywbem.CIMInstanceName( - classname='LMI_YumFileCheck', + classname='LMI_SoftwareFileCheck', namespace="root/cimv2", host=model.path.host) model['Element'] = object_name - pkg = YumPackage.object_path2pkg(env, object_name) + pkg = SoftwarePackage.object_path2pkg(env, object_name) vpkg = yum.packages._RPMVerifyPackage( pkg, pkg.hdr.fiFromHeader(), - YumFileCheck.pkg_checksum_type(pkg), [], True) + SoftwareFileCheck.pkg_checksum_type(pkg), [], True) for fc in vpkg: model['Check'] = filecheck2model( vpkg, fc.filename, env, keys_only=True, @@ -279,10 +279,10 @@ class LMI_YumPackageFile(CIMProvider2): if ( (not role or role.lower() == 'check') and ch.is_subclass(object_name.namespace, sub=object_name.classname, - super='LMI_YumFileCheck')): + super='LMI_SoftwareFileCheck')): model['Check'] = object_name - vpkg = YumFileCheck.object_path2yumcheck(env, object_name) + vpkg = SoftwareFileCheck.object_path2yumcheck(env, object_name) model['Element'] = pkg2model( env, vpkg.po, keys_only=True) yield model @@ -292,10 +292,10 @@ class LMI_YumPackageFile(CIMProvider2): In_State = pywbem.Uint16(0) Next_State = pywbem.Uint16(1) -## end of class LMI_YumPackageFileProvider +## end of class LMI_SoftwarePackageFileProvider ## get_providers() for associating CIM Class Name to python provider class name def get_providers(env): - lmi_yumpackagefile_prov = LMI_YumPackageFile(env) - return {'LMI_YumPackageFile': lmi_yumpackagefile_prov} + lmi_softwarepackagefile_prov = LMI_SoftwarePackageFile(env) + return {'LMI_SoftwarePackageFile': lmi_softwarepackagefile_prov} diff --git a/src/yum/providers/__init__.py b/src/software/providers/__init__.py index 452bf25..452bf25 100644 --- a/src/yum/providers/__init__.py +++ b/src/software/providers/__init__.py diff --git a/src/yum/providers/util/__init__.py b/src/software/providers/util/__init__.py index fddeea6..fddeea6 100644 --- a/src/yum/providers/util/__init__.py +++ b/src/software/providers/util/__init__.py diff --git a/src/yum/providers/util/common.py b/src/software/providers/util/common.py index ba0d16d..4190d41 100644 --- a/src/yum/providers/util/common.py +++ b/src/software/providers/util/common.py @@ -16,7 +16,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -"""Common utilities for LMI_Yum* providers +"""Common utilities for LMI_Software* providers """ import collections @@ -206,316 +206,12 @@ def match_pkg(pkg, **kwargs): return False return True -class YumPackage: +class SoftwarePackage: """ - Just a namespace for common function related to YumPackage provider. + Just a namespace for common function related to SoftwarePackage provider. """ @staticmethod - def parse_arch(arch, env): - try: - res = \ - { "noarch" : 0 - , "i386" : 4 - , "i586" : 5 - , "i686" : 6 - , "x86_64" : 7 - , "athlon" : 8 - , "ia32e" : 10 - , "ia64" : 11 - , "powerpc" : 12 - , "ppc" : 12 - , "ppc64" : 13 - , "sparc" : 15 - , "sparcv9" : 16 - , "sparc64" : 17 - , "arm" : 20 - , "arm6" : 21 - , "arm7" : 22 - , "arm8" : 23 - , "arm9" : 24 - , "strongarm" : 30 - , "xscale" : 31 - , "parisc" : 35 - , "parisc11" : 36 - , "mips" : 40 - , "mips32" : 41 - , "mips64" : 42 - , "mipsnecvr4xxx" : 45 - , "mipsrm7000" : 46 - , "mipstx39" : 50 - , "mipstx49" : 51 - , "v850" : 55 - , "alpha" : 60 - , "alphaev6" : 61 - , "alphaev7" : 62 - , "alphaev8" : 63 - , "alphaev9" : 64 - , "sh" : 70 - , "sh2" : 71 - , "sh3" : 72 - , "sh4" : 73 - , "sh5" : 74 - }[arch.lower()] - except KeyError: - logger = env.get_logger() - logger.log_error("failed to parse architecture '{}'".format(arch)) - res = 2 - return pywbem.Uint16(res) - - @staticmethod - def parse_license(lic, env): - try: - res = \ - { "freely redistributable without restriction" : 2 - , "glide" : 5 - , "afl" : 6 - , "adobe" : 7 - , "mit" : 10 - , "mit with advertising" : 11 - , "agpl" : 15 - , "agplv1" : 16 - , "agplv3" : 17 - , "agplv3+" : 18 - , "agplv3 with exceptions" : 19 - , "adsl" : 25 - , "amdplpa" : 26 - , "asl" : 30 - , "asl 1.0" : 31 - , "asl 1.1" : 32 - , "asl 2.0" : 33 - , "artistic clarified" : 35 - , "artistic 2.0" : 36 - , "arl" : 40 - , "aal" : 41 - , "bahyph" : 42 - , "barr" : 43 - , "beerware" : 44 - , "beopen" : 45 - , "bibtex" : 46 - , "boost" : 47 - , "borceux" : 48 - , "bsd" : 50 - , "bsd with advertising" : 51 - , "bsd with attribution" : 52 - , "bsd protection" : 53 - , "ampas bsd" : 55 - , "lbnl bsd" : 56 - , "ricebsd" : 57 - , "catosl" : 65 - , "cecill" : 66 - , "cecill-b" : 67 - , "cecill-c" : 68 - , "netscape" : 70 - , "cnri" : 71 - , "cddl" : 72 - , "cpl" : 73 - , "condor" : 75 - , "copyright only" : 76 - , "cpal" : 77 - , "gpl" : 80 - , "gpl+" : 81 - , "gpl+ with exceptions" : 82 - , "gplv1" : 83 - , "gplv2" : 84 - , "gplv2 with exceptions" : 85 - , "gplv2+" : 86 - , "gplv2+ with exceptions" : 87 - , "gplv3" : 88 - , "gplv3 with exceptions" : 89 - , "gplv3+" : 90 - , "gplv3+ with exceptions" : 91 - , "gpl+ or artistic" : 100 - , "gplv2 or artistic" : 101 - , "gplv2+ or artistic" : 102 - , "lgpl" : 110 - , "lgplv2" : 111 - , "lgplv2 with exceptions" : 112 - , "lgplv2+" : 113 - , "lgplv3" : 115 - , "lgplv3 with exceptions" : 116 - , "lgplv3+" : 117 - , "cc0" : 125 - , "crossword" : 126 - , "crystal stacker" : 127 - , "mpl" : 130 - , "mplv1.0" : 131 - , "mplv1.1" : 132 - , "mplv2.0" : 133 - , "diffmark" : 135 - , "wtfpl" : 136 - , "doc" : 137 - , "dotseqn" : 138 - , "dsdp" : 139 - , "dvipdfm" : 140 - , "epl" : 141 - , "ecos" : 142 - , "ecl 1.0" : 145 - , "ecl 2.0" : 146 - , "egenix" : 150 - , "efl 2.0" : 151 - , "entessa" : 152 - , "erpl" : 153 - , "eu datagrid" : 154 - , "eupl 1.1" : 155 - , "eurosym" : 156 - , "fair" : 157 - , "ftl" : 158 - , "gitware" : 159 - , "gl2ps" : 160 - , "glulxe" : 161 - , "gnuplot" : 162 - , "haskellreport" : 163 - , "ibm" : 164 - , "imatrix" : 165 - , "imagemagick" : 166 - , "imlib2" : 167 - , "ijg" : 168 - , "intel acpi" : 169 - , "interbase" : 170 - , "isc" : 171 - , "jabber" : 172 - , "jasper" : 173 - , "jpython" : 174 - , "julius" : 175 - , "knuth" : 176 - , "lppl" : 177 - , "latex2e" : 178 - , "leptonica" : 179 - , "lhcyr" : 180 - , "libtiff" : 181 - , "logica" : 182 - , "makeindex" : 183 - , "mecab-ipadic" : 184 - , "ms-pl" : 185 - , "ms-rl" : 186 - , "midnight" : 187 - , "miros" : 188 - , "mod_macro" : 189 - , "motosoto" : 190 - , "naumen" : 191 - , "ncsa" : 192 - , "netcdf" : 193 - , "ngpl" : 194 - , "nosl" : 195 - , "newmat" : 196 - , "newsletr" : 197 - , "nokia" : 198 - , "nlpl" : 200 - , "noweb" : 201 - , "openldap" : 202 - , "oml" : 203 - , "openpbs" : 204 - , "osl 1.0" : 205 - , "osl 1.1" : 206 - , "osl 2.0" : 207 - , "osl 2.1" : 208 - , "osl 3.0" : 209 - , "openssl" : 215 - , "oreilly" : 216 - , "par" : 217 - , "phorum" : 220 - , "php" : 221 - , "plaintex" : 222 - , "plexus" : 223 - , "postgresql" : 224 - , "psfrag" : 225 - , "psutils" : 226 - , "public domain" : 227 - , "python" : 228 - , "qhull" : 229 - , "qpl" : 230 - , "rdisc" : 231 - , "rpsl" : 232 - , "romio" : 233 - , "rsfs" : 235 - , "ruby" : 236 - , "saxpath" : 237 - , "scea" : 238 - , "scrip" : 239 - , "sendmail" : 240 - , "sleepycat" : 241 - , "slib" : 242 - , "snia" : 243 - , "sissl" : 244 - , "spl" : 245 - , "tcl" : 246 - , "teeworlds" : 247 - , "tpl" : 248 - , "threeparttable" : 249 - , "tmate" : 250 - , "torquev1.1" : 251 - , "tosl" : 252 - , "ucd" : 253 - , "vim" : 254 - , "vnlsl" : 255 - , "vostrom" : 256 - , "vsl" : 257 - , "w3c" : 258 - , "webmin" : 259 - , "wsuipa" : 260 - , "wxwidgets" : 261 - , "xinetd" : 262 - , "xerox" : 263 - , "xpp" : 264 - , "xskat" : 265 - , "yplv1.1" : 266 - , "zed" : 270 - , "zend" : 271 - , "zplv1.0" : 275 - , "zplv2.0" : 276 - , "zplv2.1" : 277 - , "zlib" : 280 - , "zlib with acknowledgement" : 281 - - , "cdl" : 400 - , "cc-by" : 401 - , "cc-by-sa" : 402 - , "cc-by-nd" : 403 - , "dsl" : 405 - , "dmtf" : 406 - , "oal" : 407 - , "fbsddl" : 408 - , "gfdl" : 409 - , "ieee" : 410 - , "ldpl" : 411 - , "ofsfdl" : 412 - , "open publication" : 413 - , "public use" : 414 - , "efml" : 415 - , "free art" : 416 - , "geotratis" : 417 - , "green openmusic" : 418 - , "ofl" : 419 - , "utopia" : 420 - , "ams" : 421 - , "arphic" : 422 - , "baekmuk" : 423 - , "bitstream vera" : 424 - , "charter" : 425 - , "doublestroke" : 426 - , "ec" : 427 - , "elvish" : 428 - , "lppl" : 429 - , "hershey" : 430 - , "ipa" : 431 - , "liberation" : 432 - , "lucida" : 433 - , "mgopen" : 434 - , "mplus" : 435 - , "ptfl" : 436 - , "punknova" : 437 - , "stix" : 438 - , "wadalab" : 439 - , "xano" : 440 - }[lic.lower()] - except KeyError: - logger = env.get_logger() - logger.log_error("failed to parse license '{}'".format(lic)) - res = 1 - return pywbem.Uint16(res) - - @staticmethod def parse_group(group, env): try: res = \ @@ -746,20 +442,15 @@ class YumPackage: model['Manufacturer'] = pkg.vendor model['Release'] = pkg.release model['Epoch'] = pywbem.Uint16(pkg.epoch) - model["Architecture"] = YumPackage.parse_arch( - pkg.arch, env) - model['License'] = YumPackage.parse_license( - pkg.license, env) - model['LicenseString']= pkg.license - model['Group'] = YumPackage.parse_group( - pkg.group, env) - model['GroupString'] = pkg.group + model["Architecture"] = pkg.arch + model['License'] = pkg.license + model['Group'] = pkg.group model['Size'] = pywbem.Uint64(pkg.size) return model return pkg2model -class YumFileCheck: +class SoftwareFileCheck: """ Just a namespace for functions related to FileCheck provider. """ @@ -788,7 +479,7 @@ class YumFileCheck: if isinstance(pkg, yum.rpmsack.RPMInstalledPackage): return pkg.hdr[rpm.RPMTAG_FILEDIGESTALGO] with self: # ensure, that _yum is inited - return YumFileCheck.checksumtype_str2pywbem( + return SoftwareFileCheck.checksumtype_str2pywbem( pkg.yumdb_info.checksum_type) @staticmethod @@ -798,7 +489,7 @@ class YumFileCheck: @staticmethod def checksumtype_str2pywbem(alg): try: - res = YumFileCheck.checksumtype_str2num[alg.lower()] + res = SoftwareFileCheck.checksumtype_str2num[alg.lower()] except KeyError: res = 0 return pywbem.Uint16(res) @@ -875,14 +566,14 @@ class YumFileCheck: if file does not exists, (None, None) is returned """ hashers = [hashlib.md5()] - if checksum_type != YumFileCheck.checksumtype_str2num["md5"]: - hashers.append(YumFileCheck.checksumtype_num2hash(checksum_type)()) - if file_type != YumFileCheck.filetype_str2pywbem('file'): + if checksum_type != SoftwareFileCheck.checksumtype_str2num["md5"]: + hashers.append(SoftwareFileCheck.checksumtype_num2hash(checksum_type)()) + if file_type != SoftwareFileCheck.filetype_str2pywbem('file'): rslts = ['0'*len(h.hexdigest()) for h in hashers] else: try: with open(file_path, 'rb') as f: - rslts = YumFileCheck.hashfile(f, hashers) + rslts = SoftwareFileCheck.hashfile(f, hashers) except (OSError, IOError) as e: env.get_logger().log_error("could not open file \"%s\"" " for reading: %s" % (file_path, e)) @@ -893,7 +584,7 @@ class YumFileCheck: def object_path2yumcheck(env, op): """ @return instance of yum.packages._RPMVerifyPackage - this object holds YumInstalledPackage under its po attribute + this object holds RPMInstalledPackage under its po attribute """ if not isinstance(op, pywbem.CIMInstanceName): raise TypeError("op must be instance of CIMInstanceName, " @@ -940,7 +631,7 @@ class YumFileCheck: fi = pkg.hdr.fiFromHeader() vpkg = yum.packages._RPMVerifyPackage(pkg, fi, - YumFileCheck.pkg_checksum_type(pkg), [], True) + SoftwareFileCheck.pkg_checksum_type(pkg), [], True) if not op['Name'] in vpkg: raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND, "File not found in RPM package.") @@ -976,7 +667,7 @@ class YumFileCheck: exists = os.path.lexists(vpf.filename) md5_checksum = None expected = { - "file_type" : YumFileCheck.filetype_str2pywbem(vpf.ftype), + "file_type" : SoftwareFileCheck.filetype_str2pywbem(vpf.ftype), "user_id" : pywbem.Uint32(pwd.getpwnam(vpf.user).pw_uid), "group_id" : pywbem.Uint32(grp.getgrnam(vpf.group).gr_gid), "file_mode" : pywbem.Uint32(vpf.mode), @@ -992,7 +683,7 @@ class YumFileCheck: else: fstat = os.lstat(vpf.filename) reality = { - "file_type" : YumFileCheck.filetype_mode2pywbem(fstat.st_mode), + "file_type" : SoftwareFileCheck.filetype_mode2pywbem(fstat.st_mode), "user_id" : pywbem.Uint32(fstat.st_uid), "group_id" : pywbem.Uint32(fstat.st_gid), "file_mode" : pywbem.Uint32(fstat.st_mode), @@ -1000,20 +691,20 @@ class YumFileCheck: "last_modification_time" : pywbem.Uint64(fstat.st_mtime) } reality["device"] = (pywbem.Uint64(fstat.st_dev) - if reality['file_type'] == YumFileCheck.filetype_str2pywbem( + if reality['file_type'] == SoftwareFileCheck.filetype_str2pywbem( "device") else None) reality["link_target"] = (os.readlink(vpf.filename) if os.path.islink(vpf.filename) else None) - md5_checksum, checksum = YumFileCheck.compute_checksums( + md5_checksum, checksum = SoftwareFileCheck.compute_checksums( env, checksum_type, reality["file_type"], vpf.filename) reality["checksum"] = checksum kwargs = dict(exists=exists, md5_checksum=md5_checksum, **dict((k, (expected[k], reality[k])) for k in expected)) - return YumFileCheck.FileCheck(**kwargs) + return SoftwareFileCheck.FileCheck(**kwargs) @staticmethod def filecheck_passed(fc): - if not isinstance(fc, YumFileCheck.FileCheck): + if not isinstance(fc, SoftwareFileCheck.FileCheck): raise TypeError("fc must be an instance of FileCheck") return ( fc.exists and all( v[0] == v[1] @@ -1021,7 +712,7 @@ class YumFileCheck: isinstance(v, tuple) and ( k != "last_modification_time" or fc.file_type[0] == \ - YumFileCheck.filetype_str2pywbem("file") + SoftwareFileCheck.filetype_str2pywbem("file") )))) @staticmethod @@ -1032,7 +723,7 @@ class YumFileCheck: for k, v in fc._asdict().items(): if isinstance(v, tuple): if ( k != "last_modification_time" - or fc.file_type[0] == YumFileCheck.filetype_str2pywbem( + or fc.file_type[0] == SoftwareFileCheck.filetype_str2pywbem( 'file')): # last_modification_time check is valid only for # regular files @@ -1057,7 +748,7 @@ class YumFileCheck: if not keys_only: model = pywbem.CIMInstance(classname, path=model) if fc is not None: - if not isinstance(fc, YumFileCheck.FileCheck): + if not isinstance(fc, SoftwareFileCheck.FileCheck): raise TypeError("fc must be an instance of FileCheck") pkg = vpkg.po vpf = vpkg._files[fn] @@ -1079,9 +770,9 @@ class YumFileCheck: #model['InstanceID'] = '' # TODO model['FileName'] = os.path.basename(vpf.filename) model['ChecksumType'] = csumt = \ - pywbem.Uint16(YumFileCheck.pkg_checksum_type(pkg)) + pywbem.Uint16(SoftwareFileCheck.pkg_checksum_type(pkg)) if fc is None: - fc = YumFileCheck.test_file(env, csumt, vpf) + fc = SoftwareFileCheck.test_file(env, csumt, vpf) for mattr, fattr in ( ('FileType', 'file_type'), ('FileUserID', 'user_id'), @@ -1097,16 +788,16 @@ class YumFileCheck: if rea is not None: model[mattr] = rea model['ExpectedFileModeFlags'] = \ - YumFileCheck.mode2pywbem_flags(fc.file_mode[0]) + SoftwareFileCheck.mode2pywbem_flags(fc.file_mode[0]) if fc.exists: - model['FileModeFlags'] = YumFileCheck.mode2pywbem_flags( + model['FileModeFlags'] = SoftwareFileCheck.mode2pywbem_flags( fc.file_mode[1]) model['FileExists'] = fc.exists if fc.md5_checksum is not None: model['MD5Checksum'] = fc.md5_checksum model['PassedFlags'] = _filecheck2model_flags(fc) model['PassedFlagsDescriptions'] = list( - YumFileCheck.passed_flags_descriptions) + SoftwareFileCheck.passed_flags_descriptions) return model return filecheck2model diff --git a/src/yum/providers/util/singletonmixin.py b/src/software/providers/util/singletonmixin.py index 8051695..8051695 100644 --- a/src/yum/providers/util/singletonmixin.py +++ b/src/software/providers/util/singletonmixin.py diff --git a/src/yum/setup.py b/src/software/setup.py index 4823b59..4823b59 100644 --- a/src/yum/setup.py +++ b/src/software/setup.py diff --git a/src/yum/test/README b/src/software/test/README index d60d1e8..d60d1e8 100644 --- a/src/yum/test/README +++ b/src/software/test/README diff --git a/src/yum/test/common.py b/src/software/test/common.py index 0da5695..d88b2bb 100644 --- a/src/yum/test/common.py +++ b/src/software/test/common.py @@ -87,7 +87,7 @@ def is_installed(*args, **kwargs): def verify_pkg(name): return subprocess.call(["rpm", "--quiet", "-Va", name]) == 0 -class YumBaseTestCase(unittest.TestCase): +class SoftwareBaseTestCase(unittest.TestCase): def setUp(self): unittest.TestCase.setUp(self) diff --git a/src/yum/test/test_yum_file_check.py b/src/software/test/test_software_file_check.py index 82c8650..66b2452 100755 --- a/src/yum/test/test_yum_file_check.py +++ b/src/software/test/test_software_file_check.py @@ -11,9 +11,9 @@ re_checksum = re.compile(r'^([0-9a-fA-F]+)\s+.*') PassedFlags = namedtuple("PassedFlags", "exists, type, size, mode, checksum, dev, ltarget, uid, gid, mtime") -class TestYumInstalledPackage(YumBaseTestCase): +class TestSoftwareInstalledPackage(SoftwareBaseTestCase): - CLASS_NAME = "LMI_YumFileCheck" + CLASS_NAME = "LMI_SoftwareFileCheck" KEYS = ( "CheckID", "Name", "SoftwareElementID", "SoftwareElementState" , "TargetOperatingSystem", "Version") diff --git a/src/yum/test/test_yum_installed_package.py b/src/software/test/test_software_installed_package.py index e78aaaa..5bcb9d2 100755 --- a/src/yum/test/test_yum_installed_package.py +++ b/src/software/test/test_software_installed_package.py @@ -5,15 +5,15 @@ import shutil import socket import stat -class TestYumInstalledPackage(YumBaseTestCase): +class TestSoftwareInstalledPackage(SoftwareBaseTestCase): - CLASS_NAME = "LMI_YumInstalledPackage" + CLASS_NAME = "LMI_SoftwareInstalledPackage" KEYS = ( "Software", "System") def make_op(self, name, epoch, ver, rel, arch, ses=2): op = self.op.copy() pkg_op = pywbem.CIMInstanceName( - classname="LMI_YumPackage", namespace="root/cimv2", + classname="LMI_SoftwarePackage", namespace="root/cimv2", keybindings={ "Name" : name, "SoftwareElementID" : make_nevra( diff --git a/src/yum/test/test_yum_package.py b/src/software/test/test_software_package.py index b631e21..cdaf04d 100755 --- a/src/yum/test/test_yum_package.py +++ b/src/software/test/test_software_package.py @@ -2,9 +2,9 @@ from common import * -class TestYumPackage(YumBaseTestCase): +class TestSoftwarePackage(SoftwareBaseTestCase): - CLASS_NAME = "LMI_YumPackage" + CLASS_NAME = "LMI_SoftwarePackage" KEYS = ( "Name", "SoftwareElementID", "SoftwareElementState" , "TargetOperatingSystem", "Version") |