{"id":22313302,"url":"https://github.com/nwops/puppet-repl-module","last_synced_at":"2025-10-17T05:01:20.884Z","repository":{"id":57670285,"uuid":"56332192","full_name":"nwops/puppet-repl-module","owner":"nwops","description":"Puppet function to inject the puppet-repl into puppet code.","archived":false,"fork":false,"pushed_at":"2016-11-08T00:14:56.000Z","size":17,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-01T03:36:12.860Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nwops.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-04-15T15:55:09.000Z","updated_at":"2016-04-15T16:03:37.000Z","dependencies_parsed_at":"2022-09-26T20:40:59.054Z","dependency_job_id":null,"html_url":"https://github.com/nwops/puppet-repl-module","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nwops%2Fpuppet-repl-module","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nwops%2Fpuppet-repl-module/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nwops%2Fpuppet-repl-module/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nwops%2Fpuppet-repl-module/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nwops","download_url":"https://codeload.github.com/nwops/puppet-repl-module/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245577930,"owners_count":20638412,"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":[],"created_at":"2024-12-03T22:06:54.795Z","updated_at":"2025-10-17T05:01:15.827Z","avatar_url":"https://github.com/nwops.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/nwops/puppet-repl-module.svg?branch=master)](https://travis-ci.org/nwops/puppet-repl-module)\n\n# Puppet Repl\nThis module contains a function `start_repl` and is for use with the\n[puppet-repl gem](https://github.com/nwops/puppet-repl).\n\nThe function is used for starting the puppet repl from inside the puppet code.\n\nThe function will inject the scope, node and environment data into the repl and will\nallow you to poke around to see variables, functions, facts, classes, and resources defined in the current scope.\n\n*NOTICE*: This module has been deprecated by the nwops/debug module, Please see https://github.com/nwops/puppet-debug\n\n## Requirements\nEnsure you have installed the puppet-repl gem `gem install puppet-repl`\nor place this in your Gemfile `gem 'puppet-repl', '\u003e= 0.3'` for your puppet module.\n\nThis also requires puppet 3.8+ with future parser enabled.\n\nYou will also want to include this module in your fixtures file if using for rspec-puppet\nunit testing.\n\n```\nrepl:\n   repo: https://github.com/nwops/puppet-repl-module\n```\n\n## Usage\n**DO NOT RUN THIS ON YOUR PUPPET SERVER OR IN PRODUCTION**\n\nPlanes will fall out of the sky, and kittens will die.  Do you really want that?\nAlthough there is a safety mechanism to prevent the this function from being called\nunder a daemonized puppet run.  \n\nIn order to start the puppet-repl from within code just place the `start_repl()`\nfunction inside your manifest code where you want the scope to be injected.\nThis will automatically call the repl `whereami` command and show where in the code\nthe `start_repl()` function was called from.  This makes it obvious where in the code\nyou are evaulating from.  This gives you the ability to step through your codce.  To goto \nthe next iteration just use the `exit` command and the compiler will continue to compile where it previously left of. \n\nExample:\n\n```puppet\nclass repl::repl_test(\n  $var1 = 'value1',\n  $var2 = ['value1', 'value2', 'value3']\n)\n{\n  # dummy resources so we can show list of resources\n  file{'/tmp/test.txt': ensure =\u003e present, mode =\u003e '0755'}\n  service{'httpd': ensure =\u003e running}\n\n  # how to find values with an empheral scope\n  $var2.each | String $item | {\n    file{\"/tmp/${item}\": ensure =\u003e present}\n    start_repl({'run_once' =\u003e true})\n  }\n  start_repl({'run_once' =\u003e true})\n  if $var1 == 'value1' {\n    start_repl({'run_once' =\u003e true})\n  }\n}\n```\n\nExample Repl session when inside the each block.  Notice the item variable.\n\n```ruby\nRuby Version: 2.3.1\nPuppet Version: 4.7.0\nPuppet Repl Version: 0.3.3\nCreated by: NWOps \u003ccorey@nwops.io\u003e\nType \"exit\", \"functions\", \"vars\", \"krt\", \"whereami\", \"facts\", \"resources\", \"classes\",\n     \"play\", \"classification\", \"reset\", or \"help\" for more information.\n\n          8:   service{'httpd': ensure =\u003e running}\n          9:\n         10:   # how to find values with an empheral scope\n         11:   $var2.each | String $item | {\n         12:     file{\"/tmp/${item}\": ensure =\u003e present}\n      =\u003e 13:     start_repl({'run_once' =\u003e false})\n         14:   }\n         15:   start_repl({'run_once' =\u003e false})\n         16:   if $var1 == 'value1' {\n         17:     start_repl({'run_once' =\u003e false})\n         18:   }\n1:\u003e\u003e $item\n =\u003e \"value1\"\n\u003e\u003e\n```\n\nIf using with rspec-puppet, only the facts you define in your test suite will be present in the repl.\n\nFor more information on how to use the puppet repl please refer to the [documentation](https://github.com/nwops/puppet-repl)\n## Troubleshooting\nThis module and puppet-repl gem are very new, there will be bugs.  Please\nfile them at [puppet-repl gem](https://github.com/nwops/puppet-repl/issues).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnwops%2Fpuppet-repl-module","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnwops%2Fpuppet-repl-module","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnwops%2Fpuppet-repl-module/lists"}