import argparse

parser = argparse.ArgumentParser()
parser.add_argument('ghcomment', type=str) # this is for test-me-please phrases
parser.add_argument('--focus', type=str, default="")
parser.add_argument('--kernel_version', type=str, default="")
parser.add_argument('--k8s_version', type=str, default="")
parser.add_argument('--retrieve', type=str, default="focus")

args = parser.parse_args()

print(args.__dict__[args.retrieve])

import argparse

parser = argparse.ArgumentParser()
parser.add_argument('ghcomment', type=str) # this is for test-me-please phrases
parser.add_argument('--focus', type=str, default="")
parser.add_argument('--kernel_version', type=str, default="")
parser.add_argument('--k8s_version', type=str, default="")
parser.add_argument('--retrieve', type=str, default="focus")

args = parser.parse_args()

# Update kernel_version to expected format
args.kernel_version = args.kernel_version.replace('.', '')
if args.kernel_version == "netnext":
	args.kernel_version = "net-next"

print(args.__dict__[args.retrieve])

Format test-only's kernel_version to avoid mistakes
test: Format test-only's kernel_version to avoid mistakes

I often try to start test-only builds with e.g.:

    test-only --kernel_version=4.19 --focus="..."

That fails because our tests expect "419". We can extend the Python
script used to parse argument to recognize that and update
kernel_version to the expected format.

Signed-off-by: Paul Chaignon <a027184a55211cd23e3f3094f1fdc728df5e0500@cilium.io>

  import argparse
  
  parser = argparse.ArgumentParser()
  parser.add_argument('ghcomment', type=str) # this is for test-me-please phrases
  parser.add_argument('--focus', type=str, default="")
  parser.add_argument('--kernel_version', type=str, default="")
  parser.add_argument('--k8s_version', type=str, default="")
  parser.add_argument('--retrieve', type=str, default="focus")
  
  args = parser.parse_args()
  
+ # Update kernel_version to expected format
+ args.kernel_version = args.kernel_version.replace('.', '')
+ if args.kernel_version == "netnext":
+ 	args.kernel_version = "net-next"
+ 
  print(args.__dict__[args.retrieve])
  
Format test-only's kernel_version to avoid mistakes
## Code Before:
import argparse

parser = argparse.ArgumentParser()
parser.add_argument('ghcomment', type=str) # this is for test-me-please phrases
parser.add_argument('--focus', type=str, default="")
parser.add_argument('--kernel_version', type=str, default="")
parser.add_argument('--k8s_version', type=str, default="")
parser.add_argument('--retrieve', type=str, default="focus")

args = parser.parse_args()

print(args.__dict__[args.retrieve])

## Instruction:
Format test-only's kernel_version to avoid mistakes
## Code After:
import argparse

parser = argparse.ArgumentParser()
parser.add_argument('ghcomment', type=str) # this is for test-me-please phrases
parser.add_argument('--focus', type=str, default="")
parser.add_argument('--kernel_version', type=str, default="")
parser.add_argument('--k8s_version', type=str, default="")
parser.add_argument('--retrieve', type=str, default="focus")

args = parser.parse_args()

# Update kernel_version to expected format
args.kernel_version = args.kernel_version.replace('.', '')
if args.kernel_version == "netnext":
	args.kernel_version = "net-next"

print(args.__dict__[args.retrieve])
