diff --git a/Tools/PC/testflinger_yaml_generator/testflinger_yaml_generator.py b/Tools/PC/testflinger_yaml_generator/testflinger_yaml_generator.py index 0443480..4cee88b 100755 --- a/Tools/PC/testflinger_yaml_generator/testflinger_yaml_generator.py +++ b/Tools/PC/testflinger_yaml_generator/testflinger_yaml_generator.py @@ -263,11 +263,28 @@ def __init__(self, cid, default_yaml_file_path="./template/template.yaml", self.is_distupgrade = is_distupgrade def provision_setting(self, is_provision, image="desktop-22-04-2-uefi", - provision_type="distro"): + provision_type="distro", provision_token="", + provision_auth_keys="", provision_user_data=""): if not is_provision: self.yaml_remove_field("provision_data") return setting_dict = {'provision_data': {provision_type: image}} + + # additional parameters if use oem_autoinstall connector + attachments = [] + if provision_user_data: + setting_dict['provision_data']['user_data'] = provision_user_data + attachments.append({'local': provision_user_data}) + if provision_token: + setting_dict['provision_data']['token_file'] = provision_token + attachments.append({'local': provision_token}) + if provision_auth_keys: + setting_dict['provision_data'][ + 'authorized_keys'] = provision_auth_keys + attachments.append({'local': provision_auth_keys}) + if attachments: + setting_dict['provision_data']['attachments'] = attachments + self.yaml_update_field(setting_dict) def reserve_setting(self, is_reserve, lp_username, timeout=120): @@ -326,6 +343,21 @@ def parse_input_arg(): help='The provision image. \ ie, desktop-22-04-2-uefi. \ If didn\'t set this mean no provision') + opt_args.add_argument('--provisionToken', default="", type=str, + help='Optional file with username and token \ + when image URL requires authentication \ + (i.e Jenkins artifact). This file must be \ + in YAML format, i.e: \ + \"username: $JENKINS_USERNAME \\n \ + token: $JENKINS_API_TOKEN\"') + opt_args.add_argument('--provisionUserData', default="", type=str, + help='user-data file for autoinstall and cloud-init \ + provisioning. This argument is a MUST required \ + if deploy the image using the autoinstall image \ + (i.e. 24.04 image)') + opt_args.add_argument('--provisionAuthKeys', default="", type=str, + help='ssh authorized_keys file to add in \ + provisioned system') opt_args.add_argument('--globalTimeout', type=int, default=43200, help="Set the testflinger's global timeout. \ Max:43200") @@ -392,7 +424,10 @@ def parse_input_arg(): builder.provision_setting(is_provision=provision, image=args.provisionImage, - provision_type=args.provisionType) + provision_type=args.provisionType, + provision_token=args.provisionToken, + provision_user_data=args.provisionUserData, + provision_auth_keys=args.provisionAuthKeys) builder.reserve_setting(is_reserve=reserve, lp_username=args.LpID,