def setup(self): security_proxy = SECURITY.get_proxy() realm = RealmData.from_structure(security_proxy.Realm) if not realm.name: return try: argv = ["discover", "--verbose"] + realm.discover_options + [realm.name] output = util.execWithCapture("realm", argv, filter_stderr=True) except OSError: # TODO: A lousy way of propagating what will usually be # 'no such realm' # The error message is logged by util return # Now parse the output for the required software. First line is the # realm name, and following lines are information as "name: value" self.packages = ["realmd"] self.discovered = "" lines = output.split("\n") if not lines: return self.discovered = lines.pop(0).strip() realm_log.info("Realm discovered: %s", self.discovered) for line in lines: parts = line.split(":", 1) if len(parts) == 2 and parts[0].strip() == "required-package": self.packages.append(parts[1].strip()) realm_log.info("Realm %s needs packages %s", self.discovered, ", ".join(self.packages))
def execute(self): if not self.discovered: return security_proxy = SECURITY.get_proxy() realm = RealmData.from_structure(security_proxy.Realm) for arg in realm.join_options: if arg.startswith("--no-password") or arg.startswith( "--one-time-password"): pw_args = [] break else: # no explicit password arg using implicit --no-password pw_args = ["--no-password"] argv = ["join", "--install", conf.target.system_root, "--verbose" ] + pw_args + realm.join_options rc = -1 try: rc = util.execWithRedirect("realm", argv) except OSError: pass if rc == 0: realm_log.info("Joined realm %s", realm.name)
def setup(self): security_proxy = SECURITY.get_proxy() realm = RealmData.from_structure(security_proxy.Realm) if not realm.name: return try: argv = ["discover", "--verbose" ] + realm.discover_options + [realm.name] output = util.execWithCapture("realm", argv, filter_stderr=True) except OSError: # TODO: A lousy way of propagating what will usually be # 'no such realm' # The error message is logged by util return # Now parse the output for the required software. First line is the # realm name, and following lines are information as "name: value" self.packages = ["realmd"] self.discovered = "" lines = output.split("\n") if not lines: return self.discovered = lines.pop(0).strip() realm_log.info("Realm discovered: %s", self.discovered) for line in lines: parts = line.split(":", 1) if len(parts) == 2 and parts[0].strip() == "required-package": self.packages.append(parts[1].strip()) realm_log.info("Realm %s needs packages %s", self.discovered, ", ".join(self.packages))
def SetRealm(self, realm: Structure): """Specify of the enrollment in a realm. The DBus structure is defined by RealmData. :param realm: a dictionary with a specification """ self.implementation.set_realm(RealmData.from_structure(realm))
def SetRealm(self, realm: Structure): """Specify of the enrollment in a realm. The DBus structure is defined by RealmData. :param realm: a dictionary with a specification """ self.implementation.set_realm(RealmData.from_structure(realm))
def execute(self): if not self.discovered: return security_proxy = SECURITY.get_proxy() realm = RealmData.from_structure(security_proxy.Realm) for arg in realm.join_options: if arg.startswith("--no-password") or arg.startswith("--one-time-password"): pw_args = [] break else: # no explicit password arg using implicit --no-password pw_args = ["--no-password"] argv = ["join", "--install", util.getSysroot(), "--verbose"] + pw_args + realm.join_options rc = -1 try: rc = util.execWithRedirect("realm", argv) except OSError: pass if rc == 0: realm_log.info("Joined realm %s", realm.name)