From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-io1-f45.google.com (mail-io1-f45.google.com [209.85.166.45]) (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 A66CC111BF for ; Thu, 31 Aug 2023 13:51:26 +0000 (UTC) Received: by mail-io1-f45.google.com with SMTP id ca18e2360f4ac-79216d8e2cfso30549439f.1 for ; Thu, 31 Aug 2023 06:51:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloudflare.com; s=google; t=1693489885; x=1694094685; darn=lists.linux.dev; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=3qz5oVS/mab13f4hSVKjuOPMKJ1bXjFus1+nNsNGCsY=; b=BweFBWNMbDouLmtbEBskL4ZIWqx1F1RMMbXYOcmpPNZmaGQNvSwtXqsSnQ9tc0nnX3 OfysCOWNV5U6ZUlbbUQInFfkVXebchIwmapYbFhs8TRKdpndBNP2gxpkHeHCPeEEpmup CG9q6W5s7lKwxhGVnZDYyeeuSjsA74s7lDE9M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693489885; x=1694094685; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=3qz5oVS/mab13f4hSVKjuOPMKJ1bXjFus1+nNsNGCsY=; b=MWV6Q1LhZvDfyS7DdfeBL0YTBHim2zkbSsYsBBSZ1PveqMwx16ZFK9ZFRdagv8QNeo ov+63Hjz0mPxPjdeSzlPorgGmZkG7gI0DVscBw+LR2Tkz+s02rLynP+xH5ztolvf+JpO D6f3vHp2XxYdZI/adizetUeyKFf5N1CcTNmkP0hWDGu2/0J4ZfqkC7DKDDopv/bzKuMW ifwvAPQpIUHtyb5LWItRMRww+0a8KAYRKn5HH6xGqdnMJaxxaH3zgnrlOxnJzwA1Nc2b 0LoGDETiSGZlU/P6B8FAF6WaNF0cc8y0c9ksxzrkaolWb7Nxp5fdfH0lD9k0ByuPWt3d oNKQ== X-Gm-Message-State: AOJu0YwEO/pfy4DSDNoR8ed4MuHqKO7LiWUiIe0Kwhi7jsRu7l7Nd23E m1z0JPGZEoHbQqbVt+ypUJc4NL8OBq2gZsp6iso= X-Google-Smtp-Source: AGHT+IF7nCtEaFQyUcY+4B0g0J5SwHw29LN8if03TithBCQ4RMHSUSQ/uhO7331qBRxKhTxqza8AoA== X-Received: by 2002:a6b:6d11:0:b0:794:c9a2:5fe3 with SMTP id a17-20020a6b6d11000000b00794c9a25fe3mr6051219iod.4.1693489885437; Thu, 31 Aug 2023 06:51:25 -0700 (PDT) Received: from CMGLRV3 ([2a09:bac5:9478:4be::79:1a]) by smtp.gmail.com with ESMTPSA id k19-20020a5e8913000000b007871aa2f144sm436360ioj.16.2023.08.31.06.51.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Aug 2023 06:51:25 -0700 (PDT) Date: Thu, 31 Aug 2023 08:51:22 -0500 From: Frederick Lawler To: Jeff Layton Cc: mcgrof@kernel.org, kdevops@lists.linux.dev, kernel-team@cloudflare.com Subject: Re: [RFC PATCH] fstests: Request inferred user Message-ID: References: <20230830235333.1658555-1-fred@cloudflare.com> Precedence: bulk X-Mailing-List: kdevops@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Thu, Aug 31, 2023 at 06:13:23AM -0400, Jeff Layton wrote: > On Wed, 2023-08-30 at 18:53 -0500, Frederick Lawler wrote: > > 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" > > Why "hplip" here? This was mostly copy/pasted from ./playbooks/roles/bootlinux/tasks/main.yml. I see it was introduced in commit f10add06446b ("kdevops: remove ansible galaxy dependency") for that file, but I'm unclear the use there. I'd like to know as well. > > > + 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' ] > > -- > Jeff Layton Fred