GithubHelp home page GithubHelp logo

Comments (4)

arthall avatar arthall commented on August 13, 2024

What do you get if you assign the results from UpdatePolicyDetails to a variable before calling update_policy? Like the snippet below.

policy_details = oci.identity.models.UpdatePolicyDetails(statements=template_stmt)
print(policy_details)

The exception you are getting looks like it is coming back from the service, which makes me think that the issue isn't passing a list of strings into UpdatePolicyDetails.

statements_to_be_added is already a list of strings. If you don't see anything wrong with policy_details when you print it and are still getting an error, you can skip the loop and do this.

policy_details = oci.identity.models.UpdatePolicyDetails(statements=statements_to_add))

and use that policy_details when calling update_policy.

from oci-python-sdk.

jauyzed avatar jauyzed commented on August 13, 2024

The print worked flawlessly as you suggested. I think the issue might actually be when calling update_policy on identity object.

policy_details = oci.identity.models.UpdatePolicyDetails(statements=statements_to_add))
print(policy_details)
identity.update_policy(policyid, policy_details) #policyid is a string var

It is still complaining :

oci.exceptions.ServiceError: {'opc-request-id': '8E23F8431FAD4EDA86A7FDA768144A2B/6BDF2E34600832D720EA02CF8134023A/F9FE1ADB1B48ADC72E02D22B11E34734', 'code': 'InvalidParameter', 'message': "'syntax error starting with <<EOF>>'@'line 1, char 73' \n", 'status': 400}

from oci-python-sdk.

arthall avatar arthall commented on August 13, 2024

This leads me to think there is something off in the policy statements that are being sent. If there is no confidential information, would you be willing to post the results from printing policy_details?

Based on the examples you have provided, I expect it to look like this:

{
  "defined_tags": null,
  "description": null,
  "freeform_tags": null,
  "statements": [
    "ALLOW group EXAMPLE TO MANAGE users IN TENANCY"
  ],
  "version_date": null
} 

When I use that as my policy_details when calling update_policy I get an exception, but it's because I don't have a group named EXAMPLE.

'message': 'The group EXAMPLE specified in the policy statement does not exist under current compartment hierarchy.\n'

from oci-python-sdk.

jauyzed avatar jauyzed commented on August 13, 2024

resolved

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.