-
Notifications
You must be signed in to change notification settings - Fork 12
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
testflinger-yaml-generator: add provision parameters for oem_autoinstall connector #76
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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,15 @@ 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='File with username and token for image \ | ||
URL auth') | ||
opt_args.add_argument('--provisionUserData', default="", type=str, | ||
help='user-data file for autoinstall and cloud-init \ | ||
provisioning') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you give the sample file or the link to let us know how to write it? |
||
opt_args.add_argument('--provisionAuthKeys', default="", type=str, | ||
help='authorized_keys file to add in provisioned \ | ||
system') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you give the sample file or the link to let us know how to write it? |
||
opt_args.add_argument('--globalTimeout', type=int, default=43200, | ||
help="Set the testflinger's global timeout. \ | ||
Max:43200") | ||
|
@@ -392,7 +418,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, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could add more detail in the help and give the sample on it?
ie File with username and token for Jenkins image url auth, and it will be the yaml format.
ie. [$JENKINS_USERNAME]\n token = $JENKINS_API_TOKEN