heat.common.password_gen module

class heat.common.password_gen.CharClass(allowed_chars, min_count)

Bases: tuple

allowed_chars

Alias for field number 0

min_count

Alias for field number 1

heat.common.password_gen.generate_openstack_password()[source]

Generate a random password suitable for a Keystone User.

heat.common.password_gen.generate_password(length, char_classes)[source]

Generate a random password.

The password will be of the specified length, and comprised of characters from the specified character classes, which can be generated using the named_char_class() and special_char_class() functions. Where a minimum count is specified in the character class, at least that number of characters in the resulting password are guaranteed to be from that character class.

Parameters:
  • length – The length of the password to generate, in characters

  • char_classes – Iterable over classes of characters from which to generate a password

heat.common.password_gen.named_char_class(char_class, min_count=0)[source]

Return a predefined character class.

The result of this function can be passed to generate_password() as one of the character classes to use in generating a password.

Parameters:
  • char_class – Any of the character classes named in CHARACTER_CLASSES

  • min_count – The minimum number of members of this class to appear in a generated password

heat.common.password_gen.special_char_class(allowed_chars, min_count=0)[source]

Return a character class containing custom characters.

The result of this function can be passed to generate_password() as one of the character classes to use in generating a password.

Parameters:
  • allowed_chars – Iterable of the characters in the character class

  • min_count – The minimum number of members of this class to appear in a generated password