{"id":15022616,"url":"https://github.com/puppetlabs/puppetlabs-transition","last_synced_at":"2025-04-04T19:09:52.136Z","repository":{"id":22948242,"uuid":"26297730","full_name":"puppetlabs/puppetlabs-transition","owner":"puppetlabs","description":"Transition module","archived":false,"fork":false,"pushed_at":"2025-02-04T02:15:47.000Z","size":95,"stargazers_count":20,"open_issues_count":0,"forks_count":21,"subscribers_count":152,"default_branch":"main","last_synced_at":"2025-03-28T18:12:03.381Z","etag":null,"topics":["maintenance-mode","module"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/puppetlabs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-11-07T01:10:05.000Z","updated_at":"2024-11-25T09:51:06.000Z","dependencies_parsed_at":"2024-11-18T17:38:07.115Z","dependency_job_id":"80be5d92-4037-4089-9f5d-f46924c6aea0","html_url":"https://github.com/puppetlabs/puppetlabs-transition","commit_stats":{"total_commits":72,"total_committers":17,"mean_commits":4.235294117647059,"dds":0.6666666666666667,"last_synced_commit":"4ffa74b49ac62999ef940f79ecfce9b2c48577f6"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puppetlabs%2Fpuppetlabs-transition","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puppetlabs%2Fpuppetlabs-transition/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puppetlabs%2Fpuppetlabs-transition/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puppetlabs%2Fpuppetlabs-transition/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/puppetlabs","download_url":"https://codeload.github.com/puppetlabs/puppetlabs-transition/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247234921,"owners_count":20905854,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["maintenance-mode","module"],"created_at":"2024-09-24T19:58:12.443Z","updated_at":"2025-04-04T19:09:52.117Z","avatar_url":"https://github.com/puppetlabs.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Transition\n\n#### Table of Contents\n\n1. [Overview](#overview)\n2. [Module Description - What the module does and why it is useful](#module-description)\n4. [Usage - Configuration options and additional functionality](#usage)\n5. [Reference - An under-the-hood peek at what the module is doing and how](#reference)\n6. [Limitations - OS compatibility, etc.](#limitations)\n\n## Overview\n\nThis module provides a Puppet type and provider for describing conditional\ntransition states. It allows users to describe a scenario where prior to\nperforming a change, a temporary state should be invoked.\n\n## Module Description\n\nConsider the following scenario.\n\nThe desired end state is that the `myapp` service is running, and that the\n`myapp.cfg` file has some specific content. In Puppet this can be modeled with\nthe following code.\n\n````puppet\nfile { '/etc/myapp/myapp.cfg':\n  ensure  =\u003e file,\n  content =\u003e 'enabled=1',\n  notify  =\u003e Service['myapp'],\n}\n\nservice { 'myapp':\n  ensure =\u003e running,\n  enable =\u003e true,\n}\n````\n\nThe `myapp` service, however, is sensitive to the configuration file being\nchanged while it is running. In order to ensure consistency, its developers\nrecommend that the configuration file not be changed while the application is\nrunning.\n\nPuppet is designed to model end state, and by default it cannot model the\ndesired procedure of shutting down `myapp`, modifying `myapp.cfg`, and then\nstarting `myapp` back up.\n\nThe transition module provides a new type that can be used to express\n*intermediate state*, thus modeling transactions such as\n\n1. stop service\n2. modify configuration\n3. start service\n\n## Usage\n\nConceptually, the transition type specifies two things. First, it specifies a\ndesired transition state in the form of a Puppet resource reference and\nparameters for that resource. Second, it specifies an array of other resources\nin the catalog, for which this temporary transition state should be invoked\nprior to changing.\n\n### Example Usage\n\nIn relation to the problem laid out above in the Module Description, the\ntransition type is used used as follows.\n\n````puppet\ntransition { 'stop myapp service':\n  resource   =\u003e Service['myapp'],\n  attributes =\u003e { ensure =\u003e stopped },\n  prior_to   =\u003e File['/etc/myapp/myapp.cfg'],\n}\n\nfile { '/etc/myapp/myapp.cfg':\n  ensure  =\u003e file,\n  content =\u003e 'enabled=1',\n  notify  =\u003e Service['myapp'],\n}\n\nservice { 'myapp':\n  ensure =\u003e running,\n  enable =\u003e true,\n}\n````\n\n### Attributes\n\n#### resource\n\nThe resource for which a transitional state is being defined. This should be a\nresource reference (e.g. `Service['apache']`). This resource will be made to\nautorequire the transitional state.\n\n#### attributes\n\nThe hash of attributes to set on the resource when applying a transitional\nstate. Each hash key must be a valid attribute for the resource being\ntransitioned.\n\n#### prior_to\n\nAn array of resources to check for synchronization. If any of these resources\nare out of sync (change pending), then the transition state will be applied.\nThese resources will each be made to autorequire the transitional state.\n\n## Reference\n\nThe transition type operates by performing a look-ahead operation on the\ncatalog to determine whether or not to create and apply a transient\nsingle-resource state.\n\nThe type automatically adds a `before` edge to each resource in the `prior_to`\nparameter, and a `before` edge to the resource specified in the `resource`\nparameter.\n\nWhen evaluated, the transition provider will retrieve each resource specified\nin the `prior_to` hash from the catalog, and for each resource, invoke each\nmanaged property's`insync?` method. If any of the resources are found to have\nany properties out of sync, the transition resource will apply the transitional\nstate defined by the resource and attribute parameters.\n\nBy requiring that the `resource` parameter refer to a resource that exists in\nthe catalog, there should always exist a desired state which is enforced\nfollowing the transition.\n\n## Limitations\n\n### The resource parameter must refer to a native type\n\nThe `resource` parameter may only refer to a native type, it cannot refer to a\ndefined type. This is because the transition provider operates on the catalog,\nand does not have or assume access to the original Puppet manifest(s) that\nbuild defined types.\n\n### Resources given to `prior_to` should not specify noop\n\nWhile the transition resource operates correctly with the global noop flag set\neither true or false, it does not currently check each individual `prior_to`\nresource to determine if the individual resource is noop. Therefore, do not at\nthis time specify resources in the `prior_to` parameter that use the noop\nmetaparameter.\n\n### Do not transition resources that use resource generators\n\nThe current implementation of the transition type performs resource transitions\nby invoking the equivalent of `puppet resource \u003ctype\u003e \u003cparameters=values\u003e`.\nNotably, this state change operation is done outside the scope of the current\ncatalog. For most resources and types this works just fine, but resources\ninvoked in a way that trigger additional resource generation (`generate` and\n`eval_generate` methods) may have unexpected behavior if a transition using\nthem is attempted.\n\n**tl;dr:** DO NOT attempt to transition a file resource that has either\n`recurse=true` or `purge=true`. There may exist other conditions under which a\nresource should not be transitioned, but we haven't thought of or found them\nyet.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpuppetlabs%2Fpuppetlabs-transition","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpuppetlabs%2Fpuppetlabs-transition","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpuppetlabs%2Fpuppetlabs-transition/lists"}