ahenk pulseaudio issue solved

This commit is contained in:
agahhulusi 2021-03-13 23:50:48 +03:00
parent 5e865e1afe
commit 063dbc04ac
4 changed files with 58 additions and 7 deletions

View file

@ -51,7 +51,6 @@ class DefaultPolicy:
else: else:
self.logger.info(".config/autostart folder exists.") self.logger.info(".config/autostart folder exists.")
self.logger.info("Checking if {0}-autostart-for-profile.desktop autorun file exists.".format(exec_command)) self.logger.info("Checking if {0}-autostart-for-profile.desktop autorun file exists.".format(exec_command))
if not Util.is_exist("{0}/.config/autostart/{1}-autostart-for-profile.desktop".format(homedir, exec_command)): if not Util.is_exist("{0}/.config/autostart/{1}-autostart-for-profile.desktop".format(homedir, exec_command)):
self.logger.info("{0}-autostart-for-profile.desktop autorun file does not exists. Creating file.".format(exec_command)) self.logger.info("{0}-autostart-for-profile.desktop autorun file does not exists. Creating file.".format(exec_command))
Util.create_file("{0}/.config/autostart/{1}-autostart-for-profile.desktop".format(homedir, exec_command)) Util.create_file("{0}/.config/autostart/{1}-autostart-for-profile.desktop".format(homedir, exec_command))
@ -60,6 +59,10 @@ class DefaultPolicy:
"Exec={0}{1} www.liderahenk.org".format(firefox_path, exec_command) "Exec={0}{1} www.liderahenk.org".format(firefox_path, exec_command)
Util.write_file("{0}/.config/autostart/{1}-autostart-for-profile.desktop".format(homedir, exec_command), content) Util.write_file("{0}/.config/autostart/{1}-autostart-for-profile.desktop".format(homedir, exec_command), content)
self.logger.info("Autorun config is written to {0}-autostart-for-profile.desktop.".format(exec_command)) self.logger.info("Autorun config is written to {0}-autostart-for-profile.desktop.".format(exec_command))
gid = self.util.file_group(homedir)
cmd = "chown -R {0}:{1} {2}/.config/autostart".format(username, gid, homedir)
self.util.execute(cmd)
self.logger.info("Set permissons for {0}/.config/autostart directory".format(homedir))
else: else:
self.logger.info("{0}-autostart-for-profile.desktop exists".format(exec_command)) self.logger.info("{0}-autostart-for-profile.desktop exists".format(exec_command))
else: else:
@ -131,4 +134,4 @@ class DefaultPolicy:
new_element.attrib["value"] = app_name_for_blocking new_element.attrib["value"] = app_name_for_blocking
tree.write(fileName) tree.write(fileName)
else: else:
self.logger.info("'" + app_name_for_blocking + "' is already added to muted_applications tag.") self.logger.info("'" + app_name_for_blocking + "' is already added to muted_applications tag.")

View file

@ -0,0 +1,13 @@
[Desktop Entry]
Version=1.0
Name=PulseAudio Sound System
Name[tr]=PulseAudio Ses Sistemi
Comment=Start the PulseAudio Sound System
Comment[tr]=PulseAudio Ses Sistemini Başlat
Exec=pulseaudio --start
Terminal=false
Type=Application
Categories=
GenericName=
X-GNOME-Autostart-Phase=Initialization
X-KDE-autostart-phase=1

View file

@ -4,6 +4,7 @@
from base.scope import Scope from base.scope import Scope
from base.util.util import Util from base.util.util import Util
import time
class ExecuteSSSDAdAuthentication: class ExecuteSSSDAdAuthentication:
def __init__(self): def __init__(self):
@ -144,11 +145,20 @@ class ExecuteSSSDAdAuthentication:
else: else:
self.logger.error("Realm Discover komutu başarısız : " + str(p_err)) self.logger.error("Realm Discover komutu başarısız : " + str(p_err))
(result_code, p_out, p_err) = self.util.execute("echo \"{0}\" | realm join --user={1} {2}".format(password, ad_username, domain_name.upper())) self.domain_try_counter = 0
if (result_code == 0):
self.logger.info("Realm Join komutu başarılı") while (True):
else: self.domain_try_counter = self.domain_try_counter + 1
self.logger.error("Realm Join komutu başarısız : " + str(p_err)) if (self.domain_try_counter == 10):
break
else:
(result_code, p_out, p_err) = self.util.execute("echo \"{0}\" | realm join --user={1} {2}".format(password, ad_username, domain_name.upper()))
if (result_code == 0):
self.logger.info("Realm Join komutu başarılı")
break
else:
self.logger.error("Realm Join komutu başarısız : " + str(p_err))
time.sleep(2)
# Configure sssd template # Configure sssd template
sssd_config_template_path = "/usr/share/ahenk/base/registration/config-files/sssd_ad.conf" sssd_config_template_path = "/usr/share/ahenk/base/registration/config-files/sssd_ad.conf"

View file

@ -151,6 +151,8 @@ class Registration:
self.install_and_config_ad(reg_reply) self.install_and_config_ad(reg_reply)
self.change_permissions_for_local_users() self.change_permissions_for_local_users()
self.create_ahenk_pulseaudio_desktop_file()
except Exception as e: except Exception as e:
self.logger.error('Registration error. Error Message: {0}.'.format(str(e))) self.logger.error('Registration error. Error Message: {0}.'.format(str(e)))
print(e) print(e)
@ -377,6 +379,9 @@ class Registration:
writing_file.close() writing_file.close()
self.logger.info("gdm.conf has been configured.") self.logger.info("gdm.conf has been configured.")
self.logger.info('GNOME conf file deleted') self.logger.info('GNOME conf file deleted')
self.delete_ahenk_pulseaudio_desktop_file()
Util.shutdown() Util.shutdown()
except Exception as e: except Exception as e:
self.logger.error("Error while running purge_and_unregister process.. Error Message " + str(e)) self.logger.error("Error while running purge_and_unregister process.. Error Message " + str(e))
@ -599,3 +604,23 @@ class Registration:
writing_file.close() writing_file.close()
self.logger.info("gdm.conf has been configured.") self.logger.info("gdm.conf has been configured.")
def create_ahenk_pulseaudio_desktop_file(self):
ahenkpulseaudio = "/etc/xdg/autostart/ahenk.pulseaudio.desktop"
ahenkpulseaudio_template = "/usr/share/ahenk/base/registration/config-files/ahenk.pulseaudio.desktop"
if not self.util.is_exist(ahenkpulseaudio):
self.logger.info("ahenk.pulseaudio.desktop autostart file doesn't exist")
self.util.create_file(ahenkpulseaudio)
file_ahenkpulseaudio = open(ahenkpulseaudio, 'a')
self.util.copy_file(ahenkpulseaudio_template, ahenkpulseaudio)
file_ahenkpulseaudio.close()
self.logger.info("ahenk.pulseaudio.desktop has been configured.")
else:
self.logger.info("ahenk.pulseaudio.desktop autostart file exist")
def delete_ahenk_pulseaudio_desktop_file(self):
ahenkpulseaudio = "/etc/xdg/autostart/ahenk.pulseaudio.desktop"
if self.util.is_exist(ahenkpulseaudio):
self.util.delete_file(ahenkpulseaudio)
self.logger.info("ahenk.pulseaudio.desktop autostart file deleted")
else:
self.logger.info("ahenk.pulseaudio.desktop autostart file doesn't exist")