def __init__(self, pgp_site = 'pgp.mit.edu', key = 0xA59047B9): self.__pgp_site = pgp_site self.__key = key self.__gpg = utils.which('gpg',True) sts, self.__hplipdir = os_utils.getHPLIPDir() self.__gpg_dir = os.path.join(self.__hplipdir, ".gnupg") if not os.path.exists(self.__gpg_dir): try: os.mkdir(self.__gpg_dir, 0755) except OSError: log.error("Failed to create %s" % self.__gpg_dir) self.__change_owner()
def __init__(self, pgp_site = 'pgp.mit.edu', key = 0x4ABA2F66DBD5A95894910E0673D770CDA59047B9): self.__pgp_site = pgp_site self.__key = key self.__gpg = utils.which('gpg',True) sts, self.__hplipdir = os_utils.getHPLIPDir() self.__gpg_dir = os.path.join(self.__hplipdir, ".gnupg") #Make sure gpg directory is present. GPG keys will be retrieved here from the key server if not os.path.exists(self.__gpg_dir): try: os.mkdir(self.__gpg_dir, 0o755) except OSError: log.error("Failed to create %s" % self.__gpg_dir) self.__change_owner()
def __init__(self, pgp_site='pgp.mit.edu', key=0x4ABA2F66DBD5A95894910E0673D770CDA59047B9): self.__pgp_site = pgp_site self.__key = key self.__gpg = utils.which('gpg', True) sts, self.__hplipdir = os_utils.getHPLIPDir() self.__gpg_dir = os.path.join(self.__hplipdir, ".gnupg") #Make sure gpg directory is present. GPG keys will be retrieved here from the key server if not os.path.exists(self.__gpg_dir): try: os.mkdir(self.__gpg_dir, 0o755) except OSError: log.error("Failed to create %s" % self.__gpg_dir) self.__change_owner()
def __init__(self): sts, prop.user_dir = os_utils.getHPLIPDir() if not os.geteuid() == 0: prop.user_config_file = os.path.join(prop.user_dir, 'hplip.conf') if not os.path.exists(prop.user_config_file): try: file(prop.user_config_file, 'w').close() s = os.stat(os.path.dirname(prop.user_config_file)) os.chown(prop.user_config_file, s[stat.ST_UID], s[stat.ST_GID]) except IOError: pass ConfigBase.__init__(self, prop.user_config_file) else: # If running as root, conf file is None prop.user_config_file = None ConfigBase.__init__(self, None)