From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-io1-f47.google.com (mail-io1-f47.google.com [209.85.166.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 98C008C13 for ; Wed, 30 Aug 2023 23:53:38 +0000 (UTC) Received: by mail-io1-f47.google.com with SMTP id ca18e2360f4ac-77a62a84855so12847939f.1 for ; Wed, 30 Aug 2023 16:53:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloudflare.com; s=google; t=1693439617; x=1694044417; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=eyF1bcp2LMJJKiXyx7SHV/otYuiEgSf+90f5C9bo00Q=; b=CDaFcha/vrQqriYCyk2Iof+5ziwK45l+15tnhmGeS5n1ESWXvZMCAbHUqCu6O6GHfX BGzqNBvrragYk9k0wFF80KRRhQYDxfzdsQRXAGySIkO9dTj4xnJA+NaBztsweMXiWVP/ Y07bB7bJmuJHF0j+i99FsqsGqUatsfgoMxX3Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693439617; x=1694044417; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=eyF1bcp2LMJJKiXyx7SHV/otYuiEgSf+90f5C9bo00Q=; b=ksYdQztSJ/plQ+PAbjBIp+NU6TAv0HpZKXQtq5oNxdbrHMw01dQ/hCTTww08xBGnY9 RXweI6d3QZ/pEVTcvSnWxYEnVA9oIGNiI6B89F24NiI83GxxEs8wiGcFsbFDOpa5CsjZ gB18JZX+iA2zFlfrpR3LtJgF3IkKwE4gryaTICGCp41rHKnVM056AQg/STh57bDTFeO5 N4/v5WLv0oslhelcyB6TrhlmeSdTadSD7rZJ7ABvYuf2C6jNh3bW3GwyKFP1zXqeq+9R CYl6ziS66DojGJ0OJbCrtOveUvFq90fHbUN6nlXs7rR4nDXcitP7mHlfxfpjB1t+sm1n 39Rw== X-Gm-Message-State: AOJu0YwzyyOdhxBwi+Ta1Er6tfqUSmEaGz7uqW7sK6qd1WC7InN9Zcm6 5tGUBPPeQiEat3/dcqp5eqy5DQ== X-Google-Smtp-Source: AGHT+IEHKRmlULj6TD/hEUBoM+aYotvaFw8EhZhxaX6q1eT7qVl8dUszyG4fgS5z+5dOl83etZ0b+A== X-Received: by 2002:a05:6602:254a:b0:794:ed2b:2520 with SMTP id cg10-20020a056602254a00b00794ed2b2520mr3419664iob.15.1693439617475; Wed, 30 Aug 2023 16:53:37 -0700 (PDT) Received: from CMGLRV3.. ([2a09:bac5:9478:4be::79:1b]) by smtp.gmail.com with ESMTPSA id dy47-20020a0566381d6f00b0042036f06b24sm63162jab.163.2023.08.30.16.53.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Aug 2023 16:53:37 -0700 (PDT) From: Frederick Lawler To: mcgrof@kernel.org Cc: kdevops@lists.linux.dev, kernel-team@cloudflare.com, Frederick Lawler Subject: [RFC PATCH] fstests: Request inferred user Date: Wed, 30 Aug 2023 18:53:33 -0500 Message-Id: <20230830235333.1658555-1-fred@cloudflare.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: kdevops@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Currently when running make fstests for bare-metal setups, the data_user 'vagrant' is set for the /data partition. This is currently set as the default data_user. We have the option to edit this in extra_vars.yml. make linux checks for an inferred user prior to setting the uid/gid for the /data partition. In the situation where we don't add the 'vagrant' user to the bare-metal, we get a "user does not exist" on make fstests. In both cases we do not want to switch users between the two targets, nor do we want to necessarily ensure that the 'vagrant' user exists on the metal. Therefore, request the inferred user on make fstests. Signed-off-by: Frederick Lawler --- Since this is essentially in two places, I figure this should be more generic and then included in other make targets like cxl. But this is to get the discussion going if this or some other generic approach is preferred. --- playbooks/roles/fstests/tasks/main.yml | 37 ++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/playbooks/roles/fstests/tasks/main.yml b/playbooks/roles/fstests/tasks/main.yml index e2d7ce5295b7..2898833b0732 100644 --- a/playbooks/roles/fstests/tasks/main.yml +++ b/playbooks/roles/fstests/tasks/main.yml @@ -10,6 +10,43 @@ skip: true tags: vars +- name: Get username we are using + command: + cmd: whoami + register: username_on_target + when: + - infer_uid_and_group|bool + +- name: Set target user as a fact + set_fact: + target_user: "{{ username_on_target.stdout }}" + when: + - infer_uid_and_group|bool + +- name: Run getent against the inferred target user + getent: + database: passwd + key: "{{ target_user }}" + register: getent_running_user + when: + - infer_uid_and_group|bool + +- name: Run getent against the inferred target group + getent: + database: group + key: "{{ target_user }}" + register: getent_on_group + when: + - infer_uid_and_group|bool + +- name: Override user and group with inferred settings if feature is enabled + set_fact: + user: "hplip" + data_user: "{{ target_user }}" + data_group: "{{ ((getent_on_group.values() | first).values() | first).keys() | first }}" + when: + - infer_uid_and_group|bool + - include_role: name: create_data_partition tags: [ 'oscheck', 'data_partition' ] -- 2.34.1