pceicicd | 9901302 | 2023-11-21 15:32:28 -0800 | [diff] [blame^] | 1 | """Ubuntu 20.04 on a hardware type of your choice.""" |
| 2 | |
| 3 | import geni.portal as portal |
| 4 | # Import the ProtoGENI library. |
| 5 | import geni.rspec.pg as rspec |
| 6 | |
| 7 | pc = portal.Context() |
| 8 | |
| 9 | pc.defineParameter('hardware_type', 'Hardware type', portal.ParameterType.NODETYPE, '') |
| 10 | |
| 11 | params = pc.bindParameters() |
| 12 | |
| 13 | request = pc.makeRequestRSpec() |
| 14 | |
| 15 | node = request.RawPC('node-0') |
| 16 | node.hardware_type = params.hardware_type |
| 17 | node.disk_image = 'urn:publicid:IDN+emulab.net+image+emulab-ops//UBUNTU20-64-STD' |
| 18 | |
| 19 | # manipulate the authorized key for root access |
| 20 | node.addService(rspec.Execute(shell="bash", command="sudo chown osc_int -R /root && tail -1 ~/.ssh/authorized_keys >> /root/.ssh/authorized_keys && rm /root/.ssh/id_rsa* && sudo chown root -R /root")) |
| 21 | |
| 22 | pc.printRequestRSpec(request) |