Code Monkey home page Code Monkey logo

iwc-tfc-client's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

iwc-tfc-client's Issues

`wait_plan` dot not detect plan in `errored` state

Describe the bug
I create a run in a workspace :

gke_creation_run = gke_workspace.create("run", message="Plan cluster creation")

Then I wait for run plan as in example :

# Wait for the run plan execution
        if gke_creation_run.wait_plan(timeout=200,
                                      progress_callback=lambda run, duration: print(
                                          f"{run.id} status is {run.status}")):
            print(f"{gke_creation_run.id} reached the target status ({gke_creation_run.status})")
            # Display log of the plan (with ANSI color)
            print(gke_creation_run.plan.log_colored)

        else:
            print(f"{gke_creation_run.id} is pending. Don't wait...")

The status is always "pending" until timeout although in terraform enterprise my run is in error (because of misconfiguration) :

INFO:     127.0.0.1:57722 - "DELETE /gke-cluster?name=string HTTP/1.1" 200 OK
run-gHzo3zSWazxy7TQc status is pending
run-gHzo3zSWazxy7TQc status is pending
run-gHzo3zSWazxy7TQc status is pending
run-gHzo3zSWazxy7TQc status is pending
run-gHzo3zSWazxy7TQc status is pending
run-gHzo3zSWazxy7TQc status is pending
....
run-gHzo3zSWazxy7TQc is pending. Don't wait...

To Reproduce

Apply a run in an incomplete workspace (Example : Missing a mandatory var)

Expected behavior

Retrieved Status should be "errored" instead of "pending" so that gke_creation_run.wait_plan could exit

Using include on workspaces search fails with 'list' object has no attribute 'id'

The full stack trace looks like

Traceback (most recent call last): File "<userdir>/dev/terraform-cloud-helpers/.venv/lib/python3.9/site-packages/tfc_client/tfc_client.py", line 71, in factory return tfc_class(client=self, data=data, include=include) File "<userdir>/dev/terraform-cloud-helpers/.venv/lib/python3.9/site-packages/tfc_client/tfc_object.py", line 59, in __init__ if rel.id == included_data["id"]: AttributeError: 'list' object has no attribute 'id'

I did do a bit of debugging and found that the object it is referencing is rel on this line

if rel.id == included_data["id"]:

and rel_name is 'outputs' and rel is an empty list []

Unable to create notification-configurations

Describe the bug
I am unable to create a notification configuration from that sample in the README

To Reproduce
Try creating a notification with:

# Create a Notification configuration
my_notification = new_ws.create(
    "notification-configuration",
    enabled=True,
    name="MyNotif",
    url="https://httpstat.us/200",
    destination_type=NotificationsDestinationType.generic,
    token="TestToken",
    triggers=[NotificationTrigger.created],
)

Expected behavior
Creates a notification config

Screenshots or similare

Traceback (most recent call last):
  File "tf_create_workspace_tfcclient.py", line 21, in <module>
    ws.create(
  File "/Users/arwintugade/work/okta/lib/python3.8/site-packages/tfc_client/tfc_objects.py", line 339, in create
    return super().create(object_type, url_prefix=url_prefix, **kwargs)
  File "/Users/arwintugade/work/okta/lib/python3.8/site-packages/tfc_client/tfc_objects.py", line 110, in create
    api_response = self.client._api.post(path=path, data=payload.json())
  File "/Users/arwintugade/work/okta/lib/python3.8/site-packages/tfc_client/api_caller.py", line 140, in post
    return self._call(method="post", **kwargs)
  File "/Users/arwintugade/work/okta/lib/python3.8/site-packages/tfc_client/api_caller.py", line 67, in _call
    raise APIException(f"APIError code: {response.status_code}", response)
tfc_client.exception.APIException: ('APIError code: 404', <Response [404]>)

Desktop (please complete the following information):

  • OS: OSX
  • Version: 10.15.6
  • Python version 3.8.5
  • pip freeze of your environment
astroid==2.4.2
awscli==1.18.115
beautifulsoup4==4.9.1
boto3==1.14.38
botocore==1.17.38
certifi==2020.6.20
cffi==1.14.1
chardet==3.0.4
click==7.1.2
colorama==0.4.3
configparser==3.8.1
cryptography==3.0
dnspython==2.0.0
docutils==0.15.2
email-validator==1.1.1
fido2==0.8.1
gimme-aws-creds==2.3.4
idna==2.10
inflection==0.5.1
isort==5.5.3
jmespath==0.10.0
keyring==21.3.0
lazy-object-proxy==1.4.3
mccabe==0.6.1
okta==0.0.4
pep8==1.7.1
pyasn1==0.4.8
pycodestyle==2.6.0
pycparser==2.20
pydantic==1.6.1
pylint==2.6.0
pyterprise==0.0.15
python-dateutil==2.8.0
PyYAML==5.3.1
requests==2.24.0
rsa==4.5
s3transfer==0.3.3
six==1.15.0
soupsieve==2.0.1
tfc-client==0.7.2
toml==0.10.1
urllib3==1.25.10
wrapt==1.12.1

Allow to update notifications

Is your feature request related to a problem? Please describe.
Seems not to be able to update workspace notification
ex :

notifs = ws.get_list("notification-configurations")
notifs[0].enabled = False   # should disable notif

Describe the solution you'd like
some hint to fix this :

Alors l'objet TFCNotificationConfiguration n'hérite pas de Modifiable. Du coup, pas de modif ... mais c'est peut-être un oublie ... faudrait tester d'ajouter Modifiable sur la class TFCNotificationConfiguration puis utilise la methode .modify()

[CRITICAL] This repository visibility has been set to private

The visibility of this repository has been prevently set to private in order to avoid misconfiguration...

If you really wanted this repository to be public and available on Internet outside of Adeo, please open a Pull Request to add this repository in the whitelist here.
You can also discuss with us in the #factory Slack channel.

The Adeo Github Admins.

/cc @alex-ikse
/cc @adeo/software-factory @adeo/OpSecurity

[CRITICAL] This repository visibility has been set to private

The visibility of this repository has been prevently set to private in order to avoid misconfiguration...

If you really wanted this repository to be public and available on Internet outside of Adeo, please open a Pull Request to add this repository in the whitelist here.
You can also discuss with us in the #factory Slack channel.

The Adeo Github Admins.

/cc @alex-ikse
/cc @adeo/software-factory @adeo/OpSecurity

Generator for paginated object list stop before sending the last block of object

Describe the bug
The lib retreive paginated object 20 by 20 by default.
If i have 43 objects, i only receive 40

To Reproduce
Create 43 workspaces, then loop on it and count how many workspace was printed ;)

Expected behavior
We should receive all objects

Screenshots or similare
N/A

Desktop (please complete the following information):

  • OS: OS X
  • Version: 10.14.6
  • Python version: 3.7.3

the RunStatus enum is incomplete with respect to the API

Describe the bug
When retrieving a run in the status policy_checked, the following error occurs;

  File "pydantic/main.py", line 346, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 1 validation error for RunModel
status
  value is not a valid enumeration member; permitted: 'pending', 'plan_queued', 'planning', 'planned', 'cost_estimating', 'cost_estimated', 'policy_checking', 'policy_override', 'policy_soft_failed', 'confirmed', 'planned_and_finished', 'apply_queued', 'applying', 'applied', 'discarded', 'errored', 'canceled', 'force_canceled' (type=type_error.enum; enum_values=[<RunStatus.pending: 'pending'>, <RunStatus.plan_queued: 'plan_queued'>, <RunStatus.planning: 'planning'>, <RunStatus.planned: 'planned'>, <RunStatus.cost_estimating: 'cost_estimating'>, <RunStatus.cost_estimated: 'cost_estimated'>, <RunStatus.policy_checking: 'policy_checking'>, <RunStatus.policy_override: 'policy_override'>, <RunStatus.policy_soft_failed: 'policy_soft_failed'>, <RunStatus.confirmed: 'confirmed'>, <RunStatus.planned_and_finished: 'planned_and_finished'>, <RunStatus.apply_queued: 'apply_queued'>, <RunStatus.applying: 'applying'>, <RunStatus.applied: 'applied'>, <RunStatus.discarded: 'discarded'>, <RunStatus.errored: 'errored'>, <RunStatus.canceled: 'canceled'>, <RunStatus.force_canceled: 'force_canceled'>])

To Reproduce
just query any run in the state policy_checked:

for ws in org.workspaces:
        print(ws.name)
        for run in ws.runs:
            print(run)

Expected behavior
to be able to deserialize a run in the specified state.

Screenshots or similare
see above.

Desktop (please complete the following information):
n/a

Additional context
A PR was already made -> #8 by https://github.com/james-emerton

ADEO open-source standards

Hi,
This repo does not follow ADEO open-source standards.

Could you please check :

  • if your repo is not open-source, it should be "private" instead of "public"
  • open-source license is Apache 2.0
  • open-source project has at least 2 active maintainer (else archive it)
  • open-source project does not contain strategic code
  • open-source project have excellent documentation
  • open-source project use Github issues for issue-tracking
  • open-source project use Github actions for CI
  • open-source project use Github for artecaft store
  • open-source project use Github pages or static generator for documentation
  • open-source project use SonarQube for code coverage
  • open-source project use Github secrets for eventual secrets

More information in the internal documentation platform :
https://app.gitbook.com/o/0gRlAkSocTvnN36NTnDZ/s/-MbApx99ZCUI1m4jMQo4/road-to-open-source/criterias

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.