Coder Social home page Coder Social logo

Comments (3)

nathan-vu avatar nathan-vu commented on July 18, 2024

user_data can be taken from a file as follows:

user_data_file=open('/tmp/cinit.sh’, ‘rb')
content=base64.b64encode(user_data_file.read()).decode('utf-8’)

We will also be adding a utility function in the next SDK release which will take in a file path and output a Base64-encoded string suitable for use as user_data

from oci-python-sdk.

nathan-vu avatar nathan-vu commented on July 18, 2024

The utility function has now been added to the SDK. An example of using it can be found here

from oci-python-sdk.

sufpro avatar sufpro commented on July 18, 2024

The utility function has now been added to the SDK. An example of using it can be found here

Hi Nathan, using the sample py script, i am trying to run a shell script(.sh), containing yum -y update and install docker commands, these are quite time consuming commands(may take upto 4-5 minutes to finish), i can see the sample py file runs fine and compute instance gets created, but none of the command in shell script gets executed, seems somehow the .sh file i am trying to run through do not run at all or fully, given below is an extract from the py file.
Appreciate any help, as i need to create compute instance along with few software installations using pyton

print('Installing docker')
print()
instance_metadata['user_data'] = oci.util.file_content_as_launch_instance_user_data(
'./install-docker.sh'
)

from oci-python-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.