Commit 4f714a7b authored by Robert Ricci's avatar Robert Ricci

Move the OS install scripts example to the profile version

parent 7a11134e
"""An example of constructing a profile with install and execute services.
manually.
Instructions:
Wait for the profile instance to start, and then log in to the VM via the
ssh port specified below. The install and execute services are handled
automatically during profile instantiation, with no manual intervention
required.
"""
import geni.portal as portal
import geni.rspec.pg as rspec
request = portal.context.makeRequestRSpec()
node1 = request.XenVM("node1")
# Specify the URL for the disk image
node1.disk_image = "<URL to disk image>"
# Install and execute scripts on the VM
node1.addService(rspec.Install(url="http://example.org/sample.tar.gz", path="/local"))
node1.addService(rspec.Execute(shell="bash", command="/local/example.sh"))
pc.printRequestRSpec()
"""An example of constructing a profile with install and execute services.
Instructions:
Wait for the profile instance to start, then click on the node in the topology and choose the `shell` menu item. The install and execute services are handled automatically during profile instantiation, with no manual intervention required.
"""
# Import the Portal object.
import geni.portal as portal
# Import the ProtoGENI library.
import geni.rspec.pg as pg
# Create a portal context.
pc = portal.Context()
# Create a Request object to start building the RSpec.
request = pc.makeRequestRSpec()
# Add a raw PC to the request.
node = request.RawPC("node")
# Install and execute scripts on the node. THIS TAR FILE DOES NOT ACTUALLY EXIST!
node.addService(pg.Install(url="http://example.org/sample.tar.gz", path="/local"))
node.addService(pg.Execute(shell="bash", command="/local/example.sh"))
# Print the RSpec to the enclosing page.
pc.printRequestRSpec(request)
......@@ -248,7 +248,7 @@ and then added to the corresponding interface.
@section[#:tag "geni-lib-example-os-install-scripts"]{Specify an operating system and set install and execute scripts}
@code-sample["geni-lib-os-install-scripts.py"]
@profile-code-sample["PortalProfiles" "os-install-scripts"]
This example demonstrates how to request @bold{services} for a node,
where @(tb) will automate some task as part of the profile instance
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment