[Puppet Users] Using VS Code with PDK -- how can I manually run puppet-lint?

2022-12-04 Thread Dan Mahoney
Hey there all,

I apologize if this is off-topic.  If it is, please do let me know where 
better to ask.  I tried joining the puppet-vscode slack but it apparently 
only works if I have a puppet.com email address.

I'm on a mac, using Visual Studio Code with the PDK installed via homebrew. 
 The version of puppet-lint included with the PDK runs WAY more tests than 
any previous version of puppet-lint.

So, here are my questions:

1) Obviously the vscode plugin is running some version of puppet-lint 
behind the scenes, but it's unclear as to how I can run that manually in a 
terminal (perhaps with --fix).  When I installed pdk, it put it in 
/opt/puppetlabs/pdk/bin/pdk, but didn't do anything like that for 
puppet-lint.

2) Is there an easy way to grab those extra tests for a system that doesn't 
have them?  It looks to be like 20 different ruby gems, all dumped 
into /opt/puppetlabs/pdk/share/cache/ruby/2.5.0/gems

ls |grep lint | grep check
puppet-lint-absolute_classname-check-3.0.1
puppet-lint-anchor-check-1.0.1
puppet-lint-classes_and_types_beginning_with_digits-check-1.0.0
puppet-lint-file_ensure-check-1.0.0
puppet-lint-leading_zero-check-1.0.0
puppet-lint-legacy_facts-check-1.0.4
puppet-lint-lookup_in_parameter-check-1.0.0
puppet-lint-manifest_whitespace-check-0.1.17
puppet-lint-optional_default-check-1.0.0
puppet-lint-params_empty_string-check-1.0.0
puppet-lint-strict_indent-check-2.0.8
puppet-lint-top_scope_facts-check-1.0.1
puppet-lint-topscope-variable-check-1.0.1
puppet-lint-trailing_comma-check-0.4.2
puppet-lint-unquoted_string-check-2.1.0
puppet-lint-version_comparison-check-1.0.0




-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/e6a2470f-0b71-44d7-a027-41618ae1cc8cn%40googlegroups.com.


[Puppet Users] Create a variable out of a bash command and notify it

2022-12-04 Thread Nir Fishler
Hello,

I'd like to store an output of a bash command into a variable, and then 
print it to stdout using notify in Puppet.

Main goal: get a list of upgrade-able packages and notify the user about it.

I have tried the below but it doesn't seem to work:

$pkgs_list = $("/usr/bin/apt --simulate upgrade | grep '^Inst' | awk -F ' ' 
'{print $2}'")

notify { "STDOUT: ${pkgs_list}": }

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/9793f643-c386-4400-9fba-fd42f3e1269dn%40googlegroups.com.


[Puppet Users] Re: Using VS Code with PDK -- how can I manually run puppet-lint?

2022-12-04 Thread Dan Mahoney
It turns out the answer to my second question is:

gem install voxpupuli-puppet-lint-plugins

...which seems to be a meta package that installs most of the nonstandard 
plugins which were then adopted by pdk.

I'm not sure how we can get those added to official puppet-lint so this 
step isn't necessary.

On Sunday, December 4, 2022 at 3:31:18 AM UTC-8 Dan Mahoney wrote:

> Hey there all,
>
> I apologize if this is off-topic.  If it is, please do let me know where 
> better to ask.  I tried joining the puppet-vscode slack but it apparently 
> only works if I have a puppet.com email address.
>
> I'm on a mac, using Visual Studio Code with the PDK installed via 
> homebrew.  The version of puppet-lint included with the PDK runs WAY more 
> tests than any previous version of puppet-lint.
>
> So, here are my questions:
>
> 1) Obviously the vscode plugin is running some version of puppet-lint 
> behind the scenes, but it's unclear as to how I can run that manually in a 
> terminal (perhaps with --fix).  When I installed pdk, it put it in 
> /opt/puppetlabs/pdk/bin/pdk, but didn't do anything like that for 
> puppet-lint.
>
> 2) Is there an easy way to grab those extra tests for a system that 
> doesn't have them?  It looks to be like 20 different ruby gems, all dumped 
> into /opt/puppetlabs/pdk/share/cache/ruby/2.5.0/gems
>
> ls |grep lint | grep check
> puppet-lint-absolute_classname-check-3.0.1
> puppet-lint-anchor-check-1.0.1
> puppet-lint-classes_and_types_beginning_with_digits-check-1.0.0
> puppet-lint-file_ensure-check-1.0.0
> puppet-lint-leading_zero-check-1.0.0
> puppet-lint-legacy_facts-check-1.0.4
> puppet-lint-lookup_in_parameter-check-1.0.0
> puppet-lint-manifest_whitespace-check-0.1.17
> puppet-lint-optional_default-check-1.0.0
> puppet-lint-params_empty_string-check-1.0.0
> puppet-lint-strict_indent-check-2.0.8
> puppet-lint-top_scope_facts-check-1.0.1
> puppet-lint-topscope-variable-check-1.0.1
> puppet-lint-trailing_comma-check-0.4.2
> puppet-lint-unquoted_string-check-2.1.0
> puppet-lint-version_comparison-check-1.0.0
>
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/f029a449-27e1-42a3-a512-660f5d864eb8n%40googlegroups.com.


Re: [Puppet Users] Create a variable out of a bash command and notify it

2022-12-04 Thread Martin Alfke
Hi Nir,

You want to collect information on nodes and you want to use this information 
in a catalog.
This is what facter is used for. 

/lib/facter/upgradable_packages.rb
Facter.add(:upgradable_packages) do
  setcode do
Facter::Core::Execution.execute("/usr/bin/apt --simulate upgrade | grep 
'^Inst' | awk -F ' ' '{print $2}'")
  end
end

Within your puppet code you can then refer to the fact:

notify { $upgradable_packages: }

Hth,
Martin

> On 4. Dec 2022, at 16:43, Nir Fishler  wrote:
> 
> Hello,
> 
> I'd like to store an output of a bash command into a variable, and then print 
> it to stdout using notify in Puppet.
> 
> Main goal: get a list of upgrade-able packages and notify the user about it.
> 
> I have tried the below but it doesn't seem to work:
> 
> $pkgs_list = $("/usr/bin/apt --simulate upgrade | grep '^Inst' | awk -F ' ' 
> '{print $2}'")
> 
> notify { "STDOUT: ${pkgs_list}": }
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to puppet-users+unsubscr...@googlegroups.com 
> .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/puppet-users/9793f643-c386-4400-9fba-fd42f3e1269dn%40googlegroups.com
>  
> .

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/2E282B6E-6BBF-4BA1-99A0-03105F55C43A%40gmail.com.


Re: [Puppet Users] Create a variable out of a bash command and notify it

2022-12-04 Thread 'Dirk Heinrichs' via Puppet Users
Am Sonntag, dem 04.12.2022 um 07:43 -0800 schrieb Nir Fishler:

Main goal: get a list of upgrade-able packages and notify the user about it.

The puppetlabs-apt module from the Puppet Forge has various facts for this.

HTH...

Dirk

--

Dirk Heinrichs
Senior Systems Engineer, Delivery Pipeline
OpenText ™ Discovery | Recommind
Phone: +49 2226 15966 18
Email: dhein...@opentext.com
Website: 
www.recommind.de
Recommind GmbH, Von-Liebig-Straße 1, 53359 Rheinbach
Vertretungsberechtigte Geschäftsführer Gordon Davies, Madhu Ranganathan, 
Christian Waida, Registergericht Amtsgericht Bonn, Registernummer HRB 10646
This e-mail may contain confidential and/or privileged information. If you are 
not the intended recipient (or have received this e-mail in error) please 
notify the sender immediately and destroy this e-mail. Any unauthorized 
copying, disclosure or distribution of the material in this e-mail is strictly 
forbidden
Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. 
Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten 
haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. 
Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail sind nicht 
gestattet.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/a09f1640686953fd607a6d380375554ad45c230f.camel%40opentext.com.