Package Products :: Package ZenUtils :: Module ZenPackCmd |
[hide private]
[frames] | no frames]

# Module ZenPackCmd

source code

Classes | [hide private]
| NonCriticalInstallError
| ZenPackCmd Utilities for creating, installing, removing ZenPacks.

Functions | [hide private]
CreateZenPack(zpId, prevZenPackName='') Create the zenpack in the filesystem. | source code
WriteSetup(setupPath, values) | source code
CanCreateZenPack(dmd, zpId) Return tuple (bool, string) where first element is true if a new zenpack can be created with the given info and false if not. | source code
ScrubZenPackId(name) If the given name conforms to ZenPack naming rules, or can easily be modified to do so, then return (True, scrubbedName) where scrubbedName is either name or a slightly modified name. | source code
InstallEggAndZenPack(dmd, eggPath, link=False, filesOnly=False, sendEvent=True, previousVersion=None) Installs the given egg, instantiates the ZenPack, installs in dmd.ZenPackManager.packs, and runs the zenpacks's install method. | source code
InstallEgg(dmd, eggPath, link=False) Install the given egg and add to the current working set. | source code
InstallDistAsZenPack(dmd, dist, eggPath, link=False, filesOnly=False, previousVersion=None) Given an installed dist, install it into Zenoss as a ZenPack. | source code
DiscoverEggs(dmd, zenPackId) Find installed eggs that provide a zenoss.zenpacks entry point. | source code
AddDistToWorkingSet(distPath) Given the path to a dist (an egg) add it to the current working set. | source code
ReadZenPackInfo(dist) Return a dictionary containing the egg metadata | source code
CopyMetaDataToZenPackObject(dist, pack) Copy metadata type stuff from the distribution to the zp object. | source code
CreateZenPacksDir() Make sure $ZENHOME/ZenPacks exists | source code
DoEasyInstall(eggPath) Use easy_install to install an egg from the filesystem. | source code
FetchAndInstallZenPack(dmd, zenPackName, zenPackVersion='', sendEvent=True) Fetch the named zenpack and all its dependencies and install them. | source code
FetchZenPack(zenPackName, zenPackVersion='') Use easy_install to retrieve the given zenpack and any dependencies. | source code
UploadZenPack(dmd, packName, project, description, znetUser, znetPass) Upload the specified zenpack to the given project. | source code
RemoveZenPack(dmd, packName, filesOnly=False, skipDepsCheck=False, leaveObjects=False, sendEvent=True, forceNoFileDeletion=False, uninstallEgg=True) Remove the given ZenPack from Zenoss. | source code
DoEasyUninstall(name) Execute the easy_install command to unlink the given egg. | source code
CanRemoveZenPacks(dmd, packNames) Returns a tuple of (canRemove, otherDependents) canRemove is True if the listed zenPacks have no dependents not also listed in packNames, False otherwise. | source code
GetDependents(dmd, packName) Return a list of installed ZenPack ids that list packName as a dependency | source code
ZPEvent(dmd, severity, summary, message=None) Send an event to Zenoss. | source code

Variables | [hide private]
| __doc__ = `"Manage ZenPacks"`
| log = `logging.getLogger('zen.ZenPackCMD')`
| FQDN = `socket.getfqdn()`
| ZEN_PACK_INDEX_URL = `''`
| ZENPACK_ENTRY_POINT = `'zenoss.zenpacks'`

Function Details | [hide private]

### CreateZenPack(zpId, prevZenPackName='') | source code
Create the zenpack in the filesystem. The zenpack is not installed in Zenoss, it is simply created in the $ZENHOME/ZenPacks directory. Usually this should be followed with a "zenpack install" call. zpId should already be valid, scrubbed value. prevZenPackName is written to PREV_ZENPACK_NAME in setup.py.

### CanCreateZenPack(dmd, zpId) | source code
Return tuple (bool, string) where first element is true if a new zenpack can be created with the given info and false if not. If first element is True then the second part of the tuple contains the scrubbed ZenPack id. If the first part is False then the second contains an explanatory message.

### ScrubZenPackId(name) | source code
If the given name conforms to ZenPack naming rules, or can easily be modified to do so, then return (True, scrubbedName) where scrubbedName is either name or a slightly modified name. If the given name does not conform to naming rules and we can't easily modify it to do so then return (False, errorMsg) where errorMsg describes why name is unacceptable.

### InstallEggAndZenPack(dmd, eggPath, link=False, filesOnly=False, sendEvent=True, previousVersion=None) | source code
Installs the given egg, instantiates the ZenPack, installs in dmd.ZenPackManager.packs, and runs the zenpacks's install method. Returns a list of ZenPacks that were installed.

### InstallEgg(dmd, eggPath, link=False) | source code
Install the given egg and add to the current working set. This does not install the egg as a ZenPack. Return a list of distributions that should be installed as ZenPacks.

### InstallDistAsZenPack(dmd, dist, eggPath, link=False, filesOnly=False, previousVersion=None) | source code
Given an installed dist, install it into Zenoss as a ZenPack. Return the ZenPack instance.

### DiscoverEggs(dmd, zenPackId) | source code
Find installed eggs that provide a zenoss.zenpacks entry point. Return a list of distributions whose ZenPacks need to be installed or upgraded. The list is sorted into the order in which this needs to happen.

### AddDistToWorkingSet(distPath) | source code
Given the path to a dist (an egg) add it to the current working set. This is basically a pkg_resources-friendly way of adding it to sys.path. Return a list of all distributions on distPath that appear to be ZenPacks.

### DoEasyInstall(eggPath) | source code
Use easy_install to install an egg from the filesystem. easy_install will install the egg, but does not install it into Zenoss as ZenPacks. Returns a list of distributions that were installed that appear to be ZenPacks.

### FetchAndInstallZenPack(dmd, zenPackName, zenPackVersion='', sendEvent=True) | source code
Fetch the named zenpack and all its dependencies and install them. Return a list of the ZenPacks that were installed.

### FetchZenPack(zenPackName, zenPackVersion='') | source code
Use easy_install to retrieve the given zenpack and any dependencies. easy_install will install the eggs, but does not install them into Zenoss as ZenPacks. Return a list of distributions just installed that appear to be ZenPacks. NB: This should be refactored. It shares most of its code with DoEasyInstall()

### UploadZenPack(dmd, packName, project, description, znetUser, znetPass) | source code
Upload the specified zenpack to the given project. Project is a string of the form 'enterprise/myproject' or 'community/otherproject'.

### RemoveZenPack(dmd, packName, filesOnly=False, skipDepsCheck=False, leaveObjects=False, sendEvent=True, forceNoFileDeletion=False, uninstallEgg=True) | source code
Remove the given ZenPack from Zenoss. Whether the ZenPack will be removed from the filesystem or not depends on the result of the ZenPack's shouldDeleteFilesOnRemoval method.

### DoEasyUninstall(name) | source code
Execute the easy_install command to unlink the given egg. What this is really doing is switching the egg to be in multiple-version mode, however this is the first step in deleting an egg as described here: http://peak.telecommunity.com/DevCenter/EasyInstall#uninstalling-packages

### CanRemoveZenPacks(dmd, packNames) | source code
Returns a tuple of (canRemove, otherDependents) canRemove is True if the listed zenPacks have no dependents not also listed in packNames, False otherwise. otherDependents is a list of zenpack names not in packNames that depend on one or more of the packs in packNames.