Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] wrong duplicate detection #126

Open
alvaromartmart opened this issue Mar 10, 2024 · 2 comments
Open

[bug] wrong duplicate detection #126

alvaromartmart opened this issue Mar 10, 2024 · 2 comments
Milestone

Comments

@alvaromartmart
Copy link
Member

I noticed this issue trying to create two different teams:

teams:
  - name: "launchers"
    organization: "myorg"
    description: "Users with launcher permissions"
    overwrite: true
    members:
      - [email protected]
  - name: "viewers"
    organization: "myorg"
    description: "Users with viewer permissions"
    overwrite: true
    members:
      - [email protected]

Trying to run this through seqerakit resulted in the error "Duplicate 'name' specified in config file for teams: None".

I suspect what might be the reason:

cmd_args = parse_block(block_name, item)
name = find_name(cmd_args)
if name in name_values:
raise ValueError(
f" Duplicate 'name' specified in config file"

  • parse_block doesn't always generate commands with a --name argument, for instance parse_teams_block doesn't as it relies on the participants add...
    members_cmd_args.append(
    [
    "--team",
    str(item["name"]),
    "--organization",
    str(item["organization"]),
    "add",
    "--member",
    str(member),
    ]
    )

I assume that's why it results as None, which is evaluated for uniqueness.

It's very likely that this issue affects other entities.

Warning

Moreover, maybe the name is not enough to check for uniqueness. E.g. I might want to define two workspaces with the same name but in different organizations.

@ejseqera
Copy link
Member

Thanks for reporting @alvaromartmart, I've pushed a fix in #127 that should resolve this. As you rightly suggested, there was an issue in how we check for the value of the name key or --name arg that returned None for when constructing arguments for teams.

Testing with your above example:

$ seqerakit teams.yml --dryrun
DEBUG:root:DRYRUN: Running command tw teams add --name launchers --organization myorg --description 'Users with launcher permissions'
DEBUG:root:DRYRUN: Running command tw teams members --team launchers --organization myorg add --member [email protected]
DEBUG:root:DRYRUN: Running command tw teams add --name viewers --organization myorg --description 'Users with viewer permissions'
DEBUG:root:DRYRUN: Running command tw teams members --team viewers --organization myorg add --member [email protected]

Do you think in addition to checking for name, we should check for workspace for uniqueness? Most resources can't be duplicated within a workspace, but can within an organization, right?

@ejseqera ejseqera added this to the v0.4.7 milestone Mar 19, 2024
@ejseqera
Copy link
Member

Largely fixed in #127 but will leave this discussion open to make this more reliable in the future

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants