def next_page(self, load_page_callback): if self.unlink_ldap == True or self.unlink_ad == True: messages = [] # TODO Implements unlink from ldap or ad into serverconf class if self.unlink_ldap: messages += serverconf.unlink_from_sssd() else: messages += serverconf.unlink_from_sssd() result = len(messages) == 0 if result: server_conf = serverconf.get_server_conf(None) auth_conf = server_conf.get_auth_conf() content = serverconf.get_json_content() if content != None: auth_conf_cached = AuthConf.AuthConf() auth_conf_cached.load_data(content['auth']) server_conf.set_auth_conf(auth_conf_cached) else: server_conf.set_auth_conf(AuthConf.AuthConf()) if self.unlink_ldap: auth_conf.set_auth_type('ldap') #os.remove(__LDAP_FLAG__) else: auth_conf.set_auth_type('ad') #os.remove(__AD_FLAG__) auth_conf.set_auth_link(False) load_page_callback(LinkToServerResultsPage, { 'result': True, 'messages': None }) return if self.ui.radioNone.get_active() or (self.ldap_is_configured or self.ad_is_configured): if self.ui.radioNone.get_active(): server_conf = serverconf.get_server_conf(None) server_conf.set_auth_conf(AuthConf.AuthConf()) self.emit('status-changed', 'linkToServer', True) load_page_callback(firstboot.pages.localUsers) return self.show_status() try: server_conf = serverconf.get_server_conf(None) load_page_callback( LinkToServerConfEditorPage, { 'ldap_is_configured': self.ldap_is_configured, 'auth_method': self.get_auth_method(), 'ad_is_configured': self.ad_is_configured, }) except serverconf.ServerConfException as e: self.show_status(__STATUS_ERROR__, e) except Exception as e: self.show_status(__STATUS_ERROR__, e)
def next_page(self, load_page_callback): if self.unlink_ldap == True or self.unlink_ad == True: messages = [] # TODO Implements unlink from ldap or ad into serverconf class if self.unlink_ldap: messages += serverconf.unlink_from_sssd() else: messages += serverconf.unlink_from_sssd() result = len(messages) == 0 if result: server_conf = serverconf.get_server_conf(None) auth_conf = server_conf.get_auth_conf() content = serverconf.get_json_content() if content != None: auth_conf_cached = AuthConf.AuthConf() auth_conf_cached.load_data(content['auth']) server_conf.set_auth_conf(auth_conf_cached) else: server_conf.set_auth_conf(AuthConf.AuthConf()) if self.unlink_ldap: auth_conf.set_auth_type('ldap') #os.remove(__LDAP_FLAG__) else: auth_conf.set_auth_type('ad') #os.remove(__AD_FLAG__) auth_conf.set_auth_link(False) load_page_callback(LinkToServerResultsPage, { 'result': True, 'messages': None }) return if self.ui.radioNone.get_active() or (self.ldap_is_configured or self.ad_is_configured): if self.ui.radioNone.get_active(): server_conf = serverconf.get_server_conf(None) server_conf.set_auth_conf(AuthConf.AuthConf()) self.emit('status-changed', 'linkToServer', True) load_page_callback(firstboot.pages.localUsers) return self.show_status() try: server_conf = serverconf.get_server_conf(None) load_page_callback(LinkToServerConfEditorPage, { 'ldap_is_configured': self.ldap_is_configured, 'auth_method': self.get_auth_method(), 'ad_is_configured': self.ad_is_configured, }) except serverconf.ServerConfException as e: self.show_status(__STATUS_ERROR__, e) except Exception as e: self.show_status(__STATUS_ERROR__, e)
def next_page(self, load_page_callback): if self.ui.radioOmit.get_active(): self.emit('status-changed', 'linkToServer', True) load_page_callback(firstboot.pages.linkToChef) return self.show_status() try: server_conf = None if self.ui.radioAuto.get_active(): url = self.ui.txtUrl.get_text() server_conf = serverconf.get_server_conf(url) load_page_callback(LinkToServerConfEditorPage, { 'server_conf': server_conf, 'ldap_is_configured': self.ldap_is_configured, 'unlink_from_ldap': self.ui.chkUnlinkLDAP.get_active(), 'chef_is_configured': self.chef_is_configured, 'unlink_from_chef': self.ui.chkUnlinkChef.get_active() }) except serverconf.ServerConfException as e: self.show_status(__STATUS_ERROR__, e) except Exception as e: self.show_status(__STATUS_ERROR__, e)
def load_page(self, params=None): self.emit('status-changed', 'dateSync', not __REQUIRED__) if serverconf.json_is_cached(): self.serverconf = serverconf.get_server_conf(None) self.ui.txtHost.set_text(self.serverconf.get_ntp_conf().get_host())
def on_btnSync_clicked(self, widget): self.ui.btnSync.set_sensitive(False) if self.ui.chkAutoconf.get_active(): url = self.ui.txtAutoconf.get_text() try: self.serverconf = serverconf.get_server_conf(url) self.ui.txtHost.set_text(self.serverconf.get_ntp_conf().get_host()) except Exception as e: self.set_status(1, str(e)) self.ui.btnSync.set_sensitive(True) return cmd = 'ntpdate -u %s' % (self.ui.txtHost.get_text(),) args = shlex.split(cmd) process = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) #exit_code = os.waitpid(process.pid, 0) exit_code = process.wait() output = process.communicate() output = "%s%s" % (output[0].strip(), output[1].strip()) self.ui.btnSync.set_sensitive(True) self.set_status(exit_code, output)
def finish_initializing(self): self.show_status() self.json_cached = serverconf.json_is_cached() self.unlink_ldap = False self.unlink_ad = False self.ldap_is_configured = serverconf.ldap_is_configured() self.ad_is_configured = serverconf.ad_is_configured() is_configured = self.ldap_is_configured or self.ad_is_configured server_conf = serverconf.get_server_conf(None) auth_type = server_conf.get_auth_conf().get_auth_type() self.ui.radioNone.set_active(True) self.ui.boxUnlinkOptions.set_visible(is_configured) self.ui.boxAuthSection.set_visible(not is_configured) self.main_window.btnNext.set_sensitive(True) self.ui.chkUnlinkLDAP.set_visible(self.ldap_is_configured) self.ui.chkUnlinkAD.set_visible(False) if not is_configured and auth_type != '': if auth_type == 'ad': self.ui.radioAD.set_active(True) else: self.ui.radioLDAP.set_active(True)
def load_page(self, params=None): #content = serverconf.get_json_content() self.serverconf = serverconf.get_server_conf(None) self.gcc_conf = self.serverconf.get_gcc_conf() self.chef_conf = self.serverconf.get_chef_conf() self.ui.txtUrlChef.set_text(self.gcc_conf.get_uri_gcc()) self.ui.txtUser.set_text(self.gcc_conf.get_gcc_username()) self.ui.txtPassword.set_text(self.gcc_conf.get_gcc_pwd_user())
def finish_initializing(self): self.gcc_is_configured = serverconf.gcc_is_configured() server_conf = serverconf.get_server_conf(None) self.show_status() if server_conf.get_gcc_conf().get_gcc_link(): self.emit('page-changed', LinkToChefConfEditorPage, {}) self.ui.chkUnlinkChef.set_visible(self.gcc_is_configured) self.ui.chkLinkChef.set_visible(not self.gcc_is_configured)
def finish_initializing(self): self.gcc_is_configured = serverconf.gcc_is_configured() server_conf = serverconf.get_server_conf(None) self.show_status() if server_conf.get_gcc_conf().get_gcc_link(): self.emit('page-changed', LinkToChefConfEditorPage,{}) self.ui.chkUnlinkChef.set_visible(self.gcc_is_configured) self.ui.chkLinkChef.set_visible(not self.gcc_is_configured)
def load_page(self, params=None): self.emit('status-changed', 'localUsers', not __REQUIRED__) self.serverconf = serverconf.get_server_conf(None) self.init_treeview() self.reload_page() self.ui.lblGroups.set_visible(False) self.ui.txtGroups.set_visible(False)
def load_page(self, params=None): self.emit('status-changed', 'autoConfig', not __REQUIRED__) self.ui.chkAutoconf.set_visible(False) if serverconf.json_is_cached(): self.ui.boxCheckAutoconf.set_visible(True) self.ui.chkAutoconf.set_visible(True) self.ui.txtAutoconf.set_sensitive(False) self.serverconf = serverconf.get_server_conf(None)
def load_page(self, params=None): self.emit('status-changed', 'dateSync', not __REQUIRED__) self.ui.chkAutoconf.set_active(False) self.ui.txtAutoconf.set_sensitive(False) if serverconf.json_is_cached(): self.ui.boxCheckAutoconf.set_visible(False) self.serverconf = serverconf.get_server_conf(None) self.ui.txtHost.set_text(self.serverconf.get_ntp_conf().get_host())
def finish_initializing(self): self.gcc_is_configured = serverconf.gcc_is_configured() server_conf = serverconf.get_server_conf(None) self.show_status() self.ui.btnUnlinkLocally.set_visible( self.gcc_is_configured or serverconf.chef_is_configured()) self.ui.chkUnlinkChef.set_visible(self.gcc_is_configured) self.ui.chkLinkChef.set_visible(not self.gcc_is_configured) if server_conf.get_gcc_conf().get_gcc_link( ) and not self.gcc_is_configured: self.ui.chkLinkChef.set_active(True)
def load_page(self, params=None): if serverconf.json_is_cached() and not self.chef_is_configured: self.json_cached = True server_conf = serverconf.get_server_conf(None) self.emit('page-changed', LinkToChefConfEditorPage, { 'server_conf': server_conf, 'chef_is_configured': self.chef_is_configured, 'unlink_from_chef': False }) else: self.json_cached = False
def next_page(self, load_page_callback): if self.ui.chkAutoconf.get_active(): url = self.ui.txtGCC.get_text() if url != '' and url != None: try: json = serverconf.get_json_autoconf(url) # content = serverconf.get_json_content() self.serverconf = serverconf.get_server_conf(json) except Exception as e: self.set_status(1, str(e)) return load_page_callback(AutoConfigResult)
def next_page(self, load_page_callback): if not serverconf.json_is_cached() or (serverconf.json_is_cached() and self.ui.chkAutoconf.get_active()): url = self.ui.txtGCC.get_text() if url != "" and url != None: try: json = serverconf.get_json_autoconf(url) # content = serverconf.get_json_content() self.serverconf = serverconf.get_server_conf(json) except Exception as e: self.set_status(1, str(e)) return load_page_callback(firstboot.pages.dateSync)
def next_page(self, load_page_callback): if not serverconf.json_is_cached() or ( serverconf.json_is_cached() and self.ui.chkAutoconf.get_active()): url = self.ui.txtGCC.get_text() if url != '' and url != None: try: json = serverconf.get_json_autoconf(url) # content = serverconf.get_json_content() self.serverconf = serverconf.get_server_conf(json) except Exception as e: self.set_status(1, str(e)) return load_page_callback(firstboot.pages.dateSync)
def load_page(self, params=None): self.server_conf = serverconf.get_server_conf(None) self.ui.lblVersionValue.set_label(self.server_conf.get_version()) self.ui.lblOrganizationValue.set_label(self.server_conf.get_organization()) # self.ui.lblNotesValue.set_label(self.server_conf.get_notes()) self.method = params['auth_method'] if self.method == 'ldap': self.ui.checkSpecific.hide() if self.server_conf.get_auth_conf().get_auth_type() == 'ldap': ldap_conf = self.server_conf.get_auth_conf().get_auth_properties() self.ui.txtUrlLDAP.set_text(ldap_conf.get_url()) self.ui.txtBaseDN.set_text(ldap_conf.get_basedn()) self.ui.txtBaseDNGroup.set_text(ldap_conf.get_basedngroup()) self.ui.txtBindDN.set_text(ldap_conf.get_binddn()) self.ui.txtPassword.set_text(ldap_conf.get_password()) self.ui.adBox.set_visible(False) self.ui.ldapBox.set_visible(True) self.link_ldap = True else: #os.system('DEBCONF_PRIORITY=critical DEBIAN_FRONTEND=noninteractive dpkg-reconfigure resolvconf') self.ui.ldapBox.set_visible(False) self.ui.adBox.set_visible(True) self.link_ad = True if self.server_conf.get_auth_conf().get_auth_type() == 'ad': if self.server_conf.get_auth_conf().get_auth_properties().get_specific_conf(): self.ui.checkSpecific.set_active(True) self.ui.txtWorkgroup.set_editable(False) self.ui.txtDomain.set_editable(False) else: ad_conf = self.server_conf.get_auth_conf().get_auth_properties().get_ad_properties() self.ui.txtDomain.set_text(ad_conf.get_domain()) self.ui.checkSpecific.hide() self.ui.txtWorkgroup.set_text(ad_conf.get_workgroup()) else: self.ui.checkSpecific.hide() self.update_server_conf = True if params['ldap_is_configured'] or params['ad_is_configured']: self.ui.lblDescription.set_visible(False)
def next_page(self, load_page_callback): if self.ui.radioOmit.get_active() or \ (self.chef_is_configured and not self.ui.chkUnlinkChef.get_active()): self.emit('status-changed', 'linkToChef', True) load_page_callback(firstboot.pages.localUsers) return self.show_status() try: server_conf = None if not self.chef_is_configured: if self.ui.radioAuto.get_active(): url = self.ui.txtUrl.get_text() server_conf = serverconf.get_server_conf(url) load_page_callback(LinkToChefConfEditorPage, { 'server_conf': server_conf, 'chef_is_configured': self.chef_is_configured, 'unlink_from_chef': self.ui.chkUnlinkChef.get_active() }) elif self.ui.chkUnlinkChef.get_active(): result, messages = serverconf.setup_server( server_conf=server_conf, link_chef=False, unlink_chef=True ) load_page_callback(LinkToChefResultsPage, { 'result': result, 'server_conf': server_conf, 'messages': messages }) except serverconf.ServerConfException as e: self.show_status(__STATUS_ERROR__, e) except Exception as e: self.show_status(__STATUS_ERROR__, e)
def load_page(self, params=None): self.server_conf = serverconf.get_server_conf(None) self.ui.lblVersionValue.set_label(self.server_conf.get_version()) self.ui.lblOrganizationValue.set_label( self.server_conf.get_organization()) # self.ui.lblNotesValue.set_label(self.server_conf.get_notes()) self.method = params['auth_method'] if self.method == 'ldap': self.ui.checkSpecific.hide() if self.server_conf.get_auth_conf().get_auth_type() == 'ldap': ldap_conf = self.server_conf.get_auth_conf( ).get_auth_properties() self.ui.txtUrlLDAP.set_text(ldap_conf.get_url()) self.ui.txtBaseDN.set_text(ldap_conf.get_basedn()) self.ui.txtBaseDNGroup.set_text(ldap_conf.get_basedngroup()) self.ui.txtBindDN.set_text(ldap_conf.get_binddn()) self.ui.txtPassword.set_text(ldap_conf.get_password()) self.ui.adBox.set_visible(False) self.ui.ldapBox.set_visible(True) self.link_ldap = True else: #os.system('DEBCONF_PRIORITY=critical DEBIAN_FRONTEND=noninteractive dpkg-reconfigure resolvconf') self.ui.ldapBox.set_visible(False) self.ui.adBox.set_visible(True) self.link_ad = True if self.server_conf.get_auth_conf().get_auth_type() == 'ad': if self.server_conf.get_auth_conf().get_auth_properties( ).get_specific_conf(): self.ui.checkSpecific.set_active(True) self.ui.txtWorkgroup.set_editable(False) self.ui.txtDomain.set_editable(False) else: ad_conf = self.server_conf.get_auth_conf( ).get_auth_properties().get_ad_properties() self.ui.txtDomain.set_text(ad_conf.get_domain()) self.ui.checkSpecific.hide() self.ui.txtWorkgroup.set_text(ad_conf.get_workgroup()) else: self.ui.checkSpecific.hide() self.update_server_conf = True if params['ldap_is_configured'] or params['ad_is_configured']: self.ui.lblDescription.set_visible(False)
def load_page(self, params=None): self.emit("status-changed", "autoConfig", not __REQUIRED__) self.ui.chkAutoconf.set_visible(False) url_config = self.fbe.get_url() url = self.cmd_options.url if url == None or len(url) == 0: url = url_config if url == None or len(url) == 0: url = "" self.ui.txtGCC.set_text(url) if serverconf.json_is_cached(): self.ui.boxCheckAutoconf.set_visible(True) self.ui.chkAutoconf.set_visible(True) self.ui.txtGCC.set_sensitive(False) # content = serverconf.get_json_content() self.serverconf = serverconf.get_server_conf(None)
def load_page(self, params=None): self.emit('status-changed', 'autoConfig', not __REQUIRED__) self.ui.chkAutoconf.set_visible(False) url_config = self.fbe.get_url() url = self.cmd_options.url if url == None or len(url) == 0: url = url_config if url == None or len(url) == 0: url = '' self.ui.txtGCC.set_text(url) self.ui.boxCheckAutoconf.set_visible(True) self.ui.chkAutoconf.set_visible(True) self.ui.txtGCC.set_sensitive(False) # content = serverconf.get_json_content() if serverconf.json_is_cached(): self.serverconf = serverconf.get_server_conf(None)
def next_page(self, load_page_callback): if self.unlink_ldap == True or self.unlink_ad == True: server_conf = None result, messages = serverconf.setup_server( server_conf=server_conf, unlink_ldap=self.unlink_ldap, unlink_ad=self.unlink_ad ) load_page_callback(LinkToServerResultsPage, { 'result': result, 'server_conf': server_conf, 'messages': messages }) return if self.ui.radioNone.get_active() or (self.ldap_is_configured or self.ad_is_configured): self.emit('status-changed', 'linkToServer', True) load_page_callback(firstboot.pages.linkToChef) return self.show_status() try: server_conf = None if self.json_cached: server_conf = serverconf.get_server_conf(None) load_page_callback(LinkToServerConfEditorPage, { 'server_conf': server_conf, 'ldap_is_configured': self.ldap_is_configured, 'auth_method': self.get_auth_method(), 'ad_is_configured': self.ad_is_configured, }) except serverconf.ServerConfException as e: self.show_status(__STATUS_ERROR__, e) except Exception as e: self.show_status(__STATUS_ERROR__, e)
def load_page(self, params=None): # content = serverconf.get_json_content() self.serverconf = serverconf.get_server_conf(None) if 'result' in params: self.result = params['result'] if 'messages' in params: for m in params['messages']: if m['type'] == 'error': icon = Gtk.STOCK_DIALOG_ERROR else: icon = Gtk.STOCK_YES box = self.new_message(m['message'], icon) self.ui.boxMessageContainer.pack_start(box, False, False, 0) if self.result == True: self.ui.lblDescription.set_text(_('The configuration was \ updated successfully.')) self.emit('status-changed', 'linkToServer', True) else: self.ui.lblDescription.set_text(_('There are some errors you must fix.')) self.emit('status-changed', 'linkToServer', False)
def next_page(self, load_page_callback): if (self.ui.chkLinkChef.get_visible() and not self.ui.chkLinkChef.get_active()) or \ (self.gcc_is_configured and not self.ui.chkUnlinkChef.get_active()): self.emit('status-changed', 'linkToChef', True) load_page_callback(firstboot.pages.linkToServer) return self.show_status() try: server_conf = None if not self.gcc_is_configured: load_page_callback(LinkToChefConfEditorPage) elif self.ui.chkUnlinkChef.get_active(): server_conf = serverconf.get_server_conf(None) ## TODO Implement unlink GCC an Chef into serverconf Class gcc_flag = open(__GCC_FLAG__, 'r') content = gcc_flag.read() gcc_flag.close() gcc_flag_json = json.loads(content) server_conf.get_gcc_conf().set_uri_gcc(gcc_flag_json['uri_gcc']) server_conf.get_gcc_conf().set_gcc_nodename(gcc_flag_json['gcc_nodename']) server_conf.get_gcc_conf().set_gcc_link(False) server_conf.get_gcc_conf().set_run(True) json_server = serverconf.validate_credentials(gcc_flag_json['uri_gcc']+'/auth/config/') json_server = json.loads(json_server) pem = json_server['chef']['chef_validation'] server_conf.get_gcc_conf().set_gcc_username(json_server['gcc']['gcc_username']) serverconf.create_pem(pem) chef_flag = open(__CHEF_FLAG__, 'r') content = chef_flag.read() chef_flag.close() chef_flag_json = json.loads(content) server_conf.get_chef_conf().set_url(chef_flag_json['chef_server_url']) server_conf.get_chef_conf().set_node_name(chef_flag_json['chef_node_name']) server_conf.get_chef_conf().set_admin_name(json_server['gcc']['gcc_username']) server_conf.get_chef_conf().set_chef_link(False) password = serverconf.ACTUAL_USER[1] if password == None: raise Exception(_('Error in user and password')) messages = [] messages += serverconf.unlink_from_gcc(password) messages += serverconf.unlink_from_chef() result = len(messages) == 0 if result: content = serverconf.get_json_content() if content != None: gcc_conf_cached = GCCConf.GCCConf() gcc_conf_cached.load_data(content['gcc']) chef_conf_cached = ChefConf.ChefConf() chef_conf_cached.load_data(content['chef']) server_conf.set_chef_conf(chef_conf_cached) server_conf.set_gcc_conf(gcc_conf_cached) else: server_conf.set_chef_conf(ChefConf.ChefConf()) server_conf.set_gcc_conf(GCCConf.GCCConf()) load_page_callback(LinkToChefResultsPage, { 'result': True, 'messages': messages }) except serverconf.ServerConfException as e: self.show_status(__STATUS_ERROR__, e) except Exception as e: self.show_status(__STATUS_ERROR__, e)
def next_page(self, load_page_callback): if (self.ui.chkLinkChef.get_visible() and not self.ui.chkLinkChef.get_active()) or \ (self.gcc_is_configured and not self.ui.chkUnlinkChef.get_active()): self.emit('status-changed', 'linkToChef', True) load_page_callback(firstboot.pages.linkToServer) return self.show_status() try: server_conf = None if not self.gcc_is_configured: load_page_callback(LinkToChefConfEditorPage) elif self.ui.chkUnlinkChef.get_active(): server_conf = serverconf.get_server_conf(None) ## TODO Implement unlink GCC an Chef into serverconf Class gcc_flag = open(__GCC_FLAG__, 'r') content = gcc_flag.read() gcc_flag.close() gcc_flag_json = json.loads(content) server_conf.get_gcc_conf().set_uri_gcc( gcc_flag_json['uri_gcc']) server_conf.get_gcc_conf().set_gcc_nodename( gcc_flag_json['gcc_nodename']) server_conf.get_gcc_conf().set_gcc_link(False) server_conf.get_gcc_conf().set_run(True) json_server = serverconf.validate_credentials( gcc_flag_json['uri_gcc'] + '/auth/config/') json_server = json.loads(json_server) pem = json_server['chef']['chef_validation'] server_conf.get_gcc_conf().set_gcc_username( json_server['gcc']['gcc_username']) serverconf.create_pem(pem) chef_flag = open(__CHEF_FLAG__, 'r') content = chef_flag.read() chef_flag.close() chef_flag_json = json.loads(content) server_conf.get_chef_conf().set_url( chef_flag_json['chef_server_url']) server_conf.get_chef_conf().set_node_name( chef_flag_json['chef_node_name']) server_conf.get_chef_conf().set_admin_name( json_server['gcc']['gcc_username']) server_conf.get_chef_conf().set_chef_link(False) password = serverconf.ACTUAL_USER[1] if password == None: raise Exception(_('Error in user and password')) messages = [] messages += serverconf.unlink_from_gcc(password) messages += serverconf.unlink_from_chef() result = len(messages) == 0 if result: content = serverconf.get_json_content() if content != None: gcc_conf_cached = GCCConf.GCCConf() gcc_conf_cached.load_data(content['gcc']) chef_conf_cached = ChefConf.ChefConf() chef_conf_cached.load_data(content['chef']) server_conf.set_chef_conf(chef_conf_cached) server_conf.set_gcc_conf(gcc_conf_cached) else: server_conf.set_chef_conf(ChefConf.ChefConf()) server_conf.set_gcc_conf(GCCConf.GCCConf()) load_page_callback(LinkToChefResultsPage, { 'result': True, 'messages': messages }) except serverconf.ServerConfException as e: self.show_status(__STATUS_ERROR__, e) except Exception as e: self.show_status(__STATUS_ERROR__, e)
def next_page(self, load_page_callback): if self.unlink_ldap == True or self.unlink_ad == True: messages = [] auth_flag = open(__AUTH_FLAG__, 'r') content = auth_flag.read() auth_flag.close() auth_flag_json = json.loads(content) server_conf = serverconf.get_server_conf(None) server_conf.get_auth_conf().set_auth_type( auth_flag_json['auth_type']) if auth_flag_json['auth_type'] == 'ad': retval = serverconf.auth_dialog( _('Authentication Required'), _('Please, provide administration credentials for the Active Directory.' )) ad_conf = server_conf.get_auth_conf().get_auth_properties() ad_conf.get_ad_properties().set_user_ad(retval[0]) ad_conf.get_ad_properties().set_passwd_ad(retval[1]) messages += serverconf.unlink_from_sssd() result = len(messages) == 0 if result: server_conf = serverconf.get_server_conf(None) auth_conf = server_conf.get_auth_conf() content = serverconf.get_json_content() if content != None: auth_conf_cached = AuthConf.AuthConf() auth_conf_cached.load_data(content['auth']) server_conf.set_auth_conf(auth_conf_cached) else: server_conf.set_auth_conf(AuthConf.AuthConf()) if self.unlink_ldap: auth_conf.set_auth_type('ldap') #os.remove(__LDAP_FLAG__) else: auth_conf.set_auth_type('ad') #os.remove(__AD_FLAG__) auth_conf.set_auth_link(False) load_page_callback(LinkToServerResultsPage, { 'result': True, 'messages': None }) return if self.ui.radioNone.get_active() or (self.ldap_is_configured or self.ad_is_configured): if self.ui.radioNone.get_active(): server_conf = serverconf.get_server_conf(None) server_conf.set_auth_conf(AuthConf.AuthConf()) self.emit('status-changed', 'linkToServer', True) load_page_callback(firstboot.pages.localUsers) return self.show_status() try: if len(socket.gethostname()) > 15: raise Exception( _("The hostname can't not be longer than 15 characters")) server_conf = serverconf.get_server_conf(None) load_page_callback( LinkToServerConfEditorPage, { 'ldap_is_configured': self.ldap_is_configured, 'auth_method': self.get_auth_method(), 'ad_is_configured': self.ad_is_configured, }) except serverconf.ServerConfException as e: self.show_status(__STATUS_ERROR__, e) except Exception as e: self.show_status(__STATUS_ERROR__, e)
# # This software is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this package; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA __author__ = "Antonio Hernández <*****@*****.**>" __copyright__ = "Copyright (C) 2011, Junta de Andalucía <*****@*****.**>" __license__ = "GPL-2" import network import dateSync import pcLabel import linkToServer import localUsers import installSoftware from firstboot import serverconf content = serverconf.get_json_content() #Fist initialization of ServerConf if the json is cached sc = serverconf.get_server_conf(content) pages = [ 'network', 'autoConfig', 'dateSync', 'pcLabel', 'linkToChef', 'linkToServer', 'localUsers', 'installSoftware' ]
# the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This software is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this package; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA __author__ = "Antonio Hernández <*****@*****.**>" __copyright__ = "Copyright (C) 2011, Junta de Andalucía <*****@*****.**>" __license__ = "GPL-2" import network import dateSync import pcLabel import linkToServer import localUsers import installSoftware from firstboot import serverconf content = serverconf.get_json_content() #Fist initialization of ServerConf if the json is cached sc = serverconf.get_server_conf(content) pages = ['network','autoConfig','dateSync','pcLabel', 'linkToChef', 'linkToServer', 'localUsers', 'installSoftware']
def load_page(self, params=None): self.server_conf = serverconf.get_server_conf(None) self.ui.lblVersionValue.set_label(self.server_conf.get_version()) self.ui.lblOrganizationValue.set_label(self.server_conf.get_organization()) self.ui.lblNotesValue.set_label(self.server_conf.get_notes())
def load_page(self, params=None): self.emit('status-changed', 'dateSync', not __REQUIRED__) self.serverconf = serverconf.get_server_conf(None) self.ui.txtHost.set_text(self.serverconf.get_ntp_conf().get_uri_ntp())