Package schrodinger :: Package application :: Package licensing :: Module flexlm :: Class License
[hide private]
[frames] | no frames]

Class License

object --+
         |
        License


A License object represents a single FLEXlm license file.

It is composed of objects representing the components of the file,
including

1. One or three SERVER lines [optional]
2. A VENDOR line  [optional]
3. A USE_SERVER line [optional]
3. Any number of FEATURE, INCREMENT, and PACKAGE lines. [reqd]

License objects are initialized by reading a license file.
The contents of that file kept as a list of Server, Vendor, Feature
and Package objects, each representing a single line in the license
file.

Instance Methods [hide private]
 
__init__(self, text='')
x.__init__(...) initializes x; see help(type(x)) for signature
 
__str__(self)
str(x)
 
write(self, outfile, dryrun=False, backup=True)
Write the license file to a file named 'outfile'
 
log_deleted_lines(self, newlic)
Report in the logfile any lines that exist in this license, but not in newlic.
 
canonical_filename(self)
Return the filename for this license file, according to the our conventions for naming licenses in license directories.
 
license_class(self)
Returns the name of the license-file class for this file, based on the contents of the license file.
 
license_description(self)
Returns a user-friendly description of the license-file class for this file, based on the contents of the license file.
 
is_permanent_nodelocked(self)
Returns true if the license file contains uncounted, node-locked, permanent licenses, and no short-term uncounted, node-locked licenses.
 
is_permanent_counted(self)
Returns true if the license file contains permanent counted licenses, and no short-term counted licenses.
 
is_permanent_library(self)
Returns true if the license file contains a permanent token library, and no short-term token library.
 
is_library(self)
Returns true if the license file contains a token library.
 
is_counted(self)
Returns true if this license file includes any counted licenses, which requires a license server.
 
is_stub(self)
Returns true if this license file is a stub license, that merely opints to a server but doesn't include FEATURE/INCREMENT lines.
 
is_open(self)
Returns true if this license file can be installed and used on any machine and allows unlimited use of all tokens.
 
last_issued(self)
Return the most recent issued date among the licenses in this file.
 
empty(self)
Return True if this license contains no features and no SERVER lines.
 
need_server(self)
Return True if this license file includes any counted features.
 
server_hostport(self)
Return the port@host address for the license server, if this license is for a license server.
 
server_host(self)
Return the hostname for the license server, if this license is for a license server.
 
redundant_server(self)
Return True if this license specifies a three-machine redundant license server.
 
sort(self)
Returns a new License object, sorted in the standard order.
 
add_signatures(self, signatures)
Add the given vendor_info signatures to the license.
 
unsign(self)
Strip signatures from the lines of this License object.
 
cleanup(self)
Remove expired and superseded elements from this license.
 
_cleanup_packages(self, valid_features)
Remove superseded and redundant PACKAGE lines.
 
_cleanup_features(self)
Remove expired and superseded FEATURE and INCREMENT lines from this license.
 
merge(self, oldlic)
Merge this license with an older license.
 
_merge_servers(self, oldlic)
Merge the SERVER lines for this license with those of an older license.
 
_merge_vendors(self, oldlic)
Merge the VENDOR lines for this license with those of an older license.
 
_merge_packages(self, oldlic)
Merge the PACKAGE lines for this license with those of an older license.
 
_merge_features(self, oldlic)
Merge the FEATURE/INCREMENT lines for this license with those of an older license.
 
_set_suite_sort_index(self)
General SUITE tokens should be given an explicit sort index to make sure they're not used unless more restricted license have already been exhausted.
 
validate(self)
Check that the lines in this license file are all valid, and report any errors found to stdput.
 
_validate_servers(self)
 
_validate_vendors(self)
 
_validate_features(self)
 
_validate_feature(self, name)
 
_validate_packages(self)
 
_validate_package(self, name)
 
_init_from_string(self, text)
Parse the text of a license file.
 
_add_element(self, elem)
Add the given "element" (LicenseLine object) to this License object.

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, text='')
(Constructor)

 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

__str__(self)
(Informal representation operator)

 

str(x)

Overrides: object.__str__
(inherited documentation)

canonical_filename(self)

 

Return the filename for this license file, according to the our
conventions for naming licenses in license directories.  License
filenames should have the following form:

<index>_<classname>_<datestamp>_<optional identifier>.lic

where the classname and index are

Description                         Classname             Index
Wide-open (Free Maestro)            open                    10
Permanent node-locked               nodelocked_perm         20
Node-locked                         nodelocked              30
Permanent server-based non-library  server_perm             40
Permanent library                   library_perm            50
Server-based non-library            server                  60
Short-term library                  library                 70
Stub for remote server              client                  80

* An "open" license file is one that contains no node-locked or
  counted features.
* A "permanent" license file is one that contains only permanent
  (non-expiring or 10-year) features.
* A "node-locked" license file (as the term is used above)
  contains only uncounted, node-locked licenses.

add_signatures(self, signatures)

 

Add the given vendor_info signatures to the license. This change is made in place.

A LicfileError is raised if each signature cannot be assigned to a unique license line.

unsign(self)

 

Strip signatures from the lines of this License object. This change is made in place.

cleanup(self)

 

Remove expired and superseded elements from this license.

SERVER and VENDOR lines are unaffected by this.

Returns a new License object, with the invalid lines removed, and the remaining lines sorted in the standard order.

_cleanup_packages(self, valid_features)

 

Remove superseded and redundant PACKAGE lines.

Remove PACKAGE lines with no valid enabling feature. This uses the list of valid feature names passed in as "valid_features".

Note that PACKAGE lines don't have expiration dates.

Also, only one PACKAGE line for a given package name is used. Currently, only the most recent valid PACKAGE line is kept. ?? Is this right, or should selection be by the order in ?? the original file, instead.

Returns a list of the valid Package elements.

_cleanup_features(self)

 

Remove expired and superseded FEATURE and INCREMENT lines from this license.

Note that superseded lines must be removed before expiration dates are checked.

Returns a list of the valid Feature elements.

merge(self, oldlic)

 

Merge this license with an older license. User-modifiable settings from the older license will be retained.

Returns a new License object with the merged lines sorted in the standard order.

_merge_servers(self, oldlic)

 

Merge the SERVER lines for this license with those of an older license.

Returns the list of Server objects for the merged file.

_merge_vendors(self, oldlic)

 

Merge the VENDOR lines for this license with those of an older license.

Returns the merged list of Vendor objects.

_merge_packages(self, oldlic)

 

Merge the PACKAGE lines for this license with those of an older license.

Returns the merged list of Package objects.

_merge_features(self, oldlic)

 

Merge the FEATURE/INCREMENT lines for this license with those of an older license.

Returns the merged list of Feature objects.

_set_suite_sort_index(self)

 

General SUITE tokens should be given an explicit sort index to make sure they're not used unless more restricted license have already been exhausted.

TODO: this should be a cleanup method; it can be used on the merged License object resulting from a merge.

validate(self)

 

Check that the lines in this license file are all valid, and report any errors found to stdput.

WARNING: The validation done here is not comprehensive. There are at least a few errors we could be checking for, but aren't.

_add_element(self, elem)

 

Add the given "element" (LicenseLine object) to this License object. Duplicate lines are rejected.

Each element is also added to the appropriate dict for its type. These are used to find features and packages by name.

Return true if the element was added to the License; Return false if it was rejected as a duplicate line.