def find_hosts_for_master_packages(): from univention.appcenter.udm import get_machine_connection, search_objects lo, pos = get_machine_connection() hosts = [] for host in search_objects('computers/domaincontroller_master', lo, pos): hosts.append((host.info.get('fqdn'), True)) for host in search_objects('computers/domaincontroller_backup', lo, pos): hosts.append((host.info.get('fqdn'), False)) try: local_fqdn = '%s.%s' % (ucr_get('hostname'), ucr_get('domainname')) local_is_master = ucr_get('server/role') == 'domaincontroller_master' hosts.remove((local_fqdn, local_is_master)) except ValueError: # not in list pass return hosts
def _get_userdn(self, args): username = self._get_username(args) if not username: return None lo, pos = self._get_ldap_connection(args=None, allow_machine_connection=True) users = search_objects('users/user', lo, pos, uid=username) if users: return users[0].dn else: self.fatal('Cannot find user %s' % username)
def _find_hosts_for_master_packages(self, args): lo, pos = self._get_ldap_connection(args, allow_machine_connection=True) hosts = [] for host in search_objects('computers/domaincontroller_master', lo, pos): hosts.append((host.info.get('fqdn'), True)) for host in search_objects('computers/domaincontroller_backup', lo, pos): hosts.append((host.info.get('fqdn'), False)) try: local_fqdn = '%s.%s' % (ucr_get('hostname'), ucr_get('domainname')) local_is_master = ucr_get( 'server/role') == 'domaincontroller_master' hosts.remove((local_fqdn, local_is_master)) except ValueError: # not in list pass return hosts
def get_appcenter_hosts(self, lo, pos): ret = [] for role in ['domaincontroller_master', 'domaincontroller_backup', 'domaincontroller_slave', 'memberserver']: objs = search_objects('computers/%s' % role, lo, pos) for obj in objs: if not 'serverRole' in obj.info: continue if 'docker' in obj.info.get('objectFlag', []): continue ret.append(obj) return ret
def to_dict(cls, apps): self = cls() lo, pos = self._get_ldap_connection(args=None, allow_machine_connection=True) hosts = self.get_appcenter_hosts(lo, pos) if ucr_is_false('appcenter/domainwide'): hostname = ucr_get('hostname') hosts = [host for host in hosts if host['name'] == hostname] get = get_action('get') ret = [] app_ldap_objects = search_objects('appcenter/app', lo, pos) for app in apps: if not app: ret.append(None) else: app_dict = get.to_dict(app) app_dict['installations'] = self._get_installations(app, hosts, app_ldap_objects) app_dict['is_installed_anywhere'] = any(inst['version'] for inst in app_dict['installations'].itervalues()) app_dict['fully_loaded'] = True ret.append(app_dict) return ret
def _write_json(self): self.logger.info('Gathering AppAttributes...') locales = [locale.split('.')[0] for locale in self.ucr.get('locale', 'en_US.UTF-8:UTF-8').split() if '.' in locale] if 'en_US' not in locales: locales.append('en_US') cache = {} custom_attributes_base = 'cn=custom attributes,cn=univention,%s' % self.ucr.get('ldap/base') for current_locale in locales: locale_cache = cache[current_locale] = {} app_objs = search_objects('appcenter/app', self.lo, self.po) apps = {} for app_obj in app_objs: app_version = app_obj['version'] app_id = app_obj['id'][:-len(app_version) - 1] app = AllApps().find(app_id, app_version=app_version) if app: if app.id in apps: if apps[app.id] > app: continue apps[app.id] = app for app in apps.itervalues(): for attribute in app.umc_options_attributes: attribute, option_name = (attribute.split(':', 1) * 2)[:2] objs = search_objects('settings/extended_attribute', self.lo, self.po, custom_attributes_base, CLIName=attribute) for obj in objs: for module in obj['module']: if search_objects('settings/extended_options', self.lo, self.po, custom_attributes_base, objectClass=obj['objectClass'], module=module): # a newer version of the App is installed that uses the # superior settings/extended_option continue if module not in locale_cache: locale_cache[module] = {} option_def = locale_cache[module] group_name = obj['groupName'] for loc, desc in obj['translationGroupName']: if loc == current_locale: group_name = desc break tab_name = obj['tabName'] for loc, desc in obj['translationTabName']: if loc == current_locale: tab_name = desc break short_description = obj['shortDescription'] for loc, desc in obj['translationShortDescription']: if loc == current_locale: short_description = desc break if obj['syntax'] == 'boolean': boolean_values = ['1', '0'] elif obj['syntax'] in ['TrueFalseUp', 'TrueFalseUpper']: boolean_values = ['TRUE', 'FALSE'] elif obj['syntax'] == 'TrueFalse': boolean_values = ['true', 'false'] elif obj['syntax'] == 'OkOrNot': boolean_values = ['OK', 'Not'] else: continue default = int(obj['default'] == boolean_values[0]) attributes = [] layout = [] option_def[option_name] = { 'label': group_name or tab_name, 'description': short_description, 'default': default, 'boolean_values': boolean_values, 'attributes': attributes, 'layout': layout, 'attribute_name': obj['CLIName'], } base = dn2str(str2dn(obj.dn)[1:]) for _obj in search_objects('settings/extended_attribute', self.lo, self.po, base, univentionUDMPropertyModule=module): if obj.dn == _obj.dn: continue if _obj['disableUDMWeb'] == '1': continue attributes.append(_obj['CLIName']) if _obj['tabAdvanced']: group_name = _obj['tabName'] for loc, desc in _obj['translationTabName']: if loc == current_locale: group_name = desc break group_position = _obj['tabPosition'] else: group_name = _obj['groupName'] for loc, desc in _obj['translationGroupName']: if loc == current_locale: group_name = desc break group_position = _obj['groupPosition'] for group in layout: if group['label'] == group_name: break else: group = { 'label': group_name, 'description': '', 'advanced': False, 'is_app_tab': False, 'layout': [], 'unsorted': [], } layout.append(group) group_layout = group['layout'] if group_position: group_position = int(group_position) while len(group_layout) < group_position: group_layout.append([]) group_layout[group_position - 1].append(_obj['CLIName']) else: group['unsorted'].append(_obj['CLIName']) for group in layout: unsorted = group.pop('unsorted') if unsorted: group['layout'].append(unsorted) self.logger.info('Finished') tmp_fname = FNAME + '.tmp' with open(tmp_fname, 'w') as fd: json.dump(cache, fd) shutil.move(tmp_fname, FNAME)
test.click_button("Continue") test.wait_until_all_standby_animations_disappeared() test.wait_for_text("Self Service modules allow users to take care") test.save_screenshot("app_installed") # Erfolgreich? test.wait_for_text("Manage local installation") subprocess.call(['univention-check-join-status']) ucr_load() for key, value in [('appcenter/installed', 'ME'), ('appcenter/apps/self-service/status', 'installed'), ('appcenter/apps/self-service/version', '4.0')]: if ucr_get(key) != value: raise ValueError('%s: %r' % (key, ucr_get(key))) lo, pos = get_machine_connection() app_obj = search_objects('appcenter/app', lo, pos)[0] app_obj.dn == 'univentionAppID=self-service_4.0,cn=self-service,cn=apps,cn=univention,%s' % ucr_get( 'ldap/base') # Können Apps mit NotifyVendor=Yes installiert werden (sollte nicht so sein) ? test.click_button("Back to overview") test.click_element( '//div[contains(concat(" ", normalize-space(@class), " "), " umcGalleryWrapperItem ")][@moduleid="nextcloud"]' ) test.wait_for_text("Nextcloud brings together universal access") test.click_button("Install") test.wait_for_text("License Agreement") test.click_button("Accept license") test.wait_for_text("Install Information") test.click_element( "//*[contains(@class, 'dijitDialog')]//*[contains(@class, 'dijitButton')]//*[contains(text(), 'Install')]"