logo
down
shadow

cfEngine3 - class if package is installed


cfEngine3 - class if package is installed

Content Index :

cfEngine3 - class if package is installed
Tag : development , By : Kbotei
Date : November 25 2020, 03:01 PM

I hope this helps . I tweaked your policy a bit and provided comments in line. I think your main issue was that you were expecting the index of the returned packagesmatching() data to be indexed by package name, instead of a numeric id.
bundle agent main
{
vars:

    # Return data from cfengines internal cache about any packages matching the
    # name cfengine-nova
    "p"
      data => packagesmatching("cfengine.*", ".*", ".*", ".*");

    # Get the index (list of keys) from this data structure for iteration

    # Each value in the list is a number which is the position of the JSON
    # object in the data returned from packagesmatching(). For example, if
    # cfengine-nova-hub is the only package found to be installed that matches
    # then the data structure returend to p will look like the following
    # snippet. Note it's the 0th element inside the array ([]).
    #
    # [
    #   {
    #      "arch":"x86_64",
    #      "method":"dpkg",
    #      "name":"cfenigne-nova-hub",
    #      "version":"3.10.1-1"
    #   }
    # ]

    "i" slist => getindices(p);
    "c" slist => classesmatching( ".*", "defined_from=$(this.bundle)");

classes:

    # Iterate over the packages found, if one of their names matches
    # cfengine-nova.* then define the class cfengine_installed.

    "cfengine_installed"
      expression => regcmp( "cfengine.*", "$(p[$(i)][name])" ),
      meta => { "defined_from=$(this.bundle)" };

reports:

    # Emit the version of cfengine from the internal sys var
    "CFEngine $(sys.cf_version)";

    # Iterate over the index (i) of the data returned from packagesmatching
    # cfengine-nova (p) and print the name of each package.

    "CFEngine cached knowledge of $(p[$(i)][name]) $(p[$(i)][version])";

    "Found the class '$(c)' defined from $(this.bundle)";

    cfengine_installed::

        "CFEngine is installed ";

        # Bonus :-)

        # In case you had multiuple packages returned, you might want to make
        # this more strict, or it will emit the version of each package found
        # by packagesmatching.

        "CFEngine Package Version : $(p[$(i)][version])"
          if => strcmp( "cfengine-nova-hub", "$(p[$(i)][name])" );
}
R: CFEngine 3.10.1
R: CFEngine cached knowledge of cfengine-nova-hub 3.10.1-1
R: Found the class 'cfengine_installed' defined from main
R: CFEngine is installed 
R: CFEngine Package Version : 3.10.1-1

Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

Can I access locally-installed packages from a globally-installed package?


Tag : node.js , By : Brian Cupps
Date : March 29 2020, 07:55 AM
it should still fix some issue require will not only lookup the package inside $(CWD)\node_modules but also inside all node_modules of parent, grandparent, etc. So you can use resolve on npm to solve this problem
FILE: your_global_command.js
// npm install resolve
var resolve = require('resolve').sync;

// Lookup for local module at current working dir
function require_cwd(name) {
    var absolute_path = resolve(name, { basedir: process.cwd() });
    return require(absolute_path);
}

// Load local express
// this will throw an error when express is not found as local module
var express = require_cwd('express');

Error importing module from package, package itself imported but empty, pip says package installed and up-to-date


Tag : python , By : Fernando
Date : March 29 2020, 07:55 AM
will be helpful for those in need wwii `s comment solved this, using a windows installer did work. I got it from here. Probably properly installing and configuring a compiler would also work.

Powershell `install-package` works fine, but `get-package` doesn't show the package installed


Tag : powershell , By : Neuromaster
Date : March 29 2020, 07:55 AM
This might help you Typo ? You have spelled Pscx wrong twice in your question (Pcsx).
Command behaves as expected on my system.

MySql Workbench installer requires Visual C++ 2015 Redistributable Package to be installed, but it already is installed


Tag : mysql , By : Brian Drum
Date : March 29 2020, 07:55 AM
may help you . It turns out that VC++ 2017 redistributables are the culprit because they delete the registry keys used by VC++ 2015 redistributables. See this Microsoft Developer Community page for solution (TL;DR; you have to repair VC++ 2017 redistributables as this will restore missing 2015 registry keys).
This process is as Eric describes:

Homebrew find installed packages which aren't dependencies of any other installed package


Tag : development , By : Gianluca Riccardi
Date : March 29 2020, 07:55 AM
it helps some times Previously I've had things installed with homebrew which had dependencies which I omitted to remove when I removed the package itself (homebrew of course does not do this automatically for you, for good reason). , It seems like brew leaves would fit your use-case?
% brew leaves --help
Usage: brew leaves

List installed formulae that are not dependencies of another installed formula.
brew list | xargs brew uses --installed > test.txt
% brew uses --help
Usage: brew uses [options] formula

Show formulae that specify formula as a dependency. When given multiple
formula arguments, show the intersection of formulae that use formula. By
default, uses shows all formulae that specify formula as a required or
recommended dependency for their stable builds.
Related Posts Related QUESTIONS :
  • Is it acceptable for invalid XHTML?
  • Anyone soloing using fogbugz?
  • Using MBUnit in TeamCity
  • How to setup a crontab to execute at specific time
  • Linking two Office documents
  • How can I detect if a browser is blocking a popup?
  • Apply filter to t-foreach
  • Lotus Notes convert formula to agent
  • Problem with configuration of odoo for working with pycharm
  • Unexpected number of arguments when calling EM_JS function
  • What does the function state_fidelity() do in Qiskit?
  • Azure function with IoT Hub trigger get send device
  • Cluster similar words using word2vec
  • Add elements into an array then find distinct,
  • Angular8 - error TS2304: Cannot find name
  • Manually polling streams in future implementation
  • How do you perform receipt validation for Android on Xamarin Forms
  • What is the rule behind instruction count in Intel PIN?
  • How to draw some text when click a button in wxWidgets?
  • Restrict entity types in Spacy NER
  • How to animate CN1 Slider progress on load
  • Issue with bwa mem process not running on all output files from previous process
  • Delete videos from playlist using YouTube API
  • How to restart the Hyperledger Composer Playground locally
  • How to configure email alerts in Zabbix Server?
  • Simulator is not working for smart home action with all configured session
  • How parse data using join on Objection.js
  • Assign an array to a property in a Chapel Class
  • Netlogo: How can I obtain the accumulate value in Netlogo?
  • How to populate datasource for listview using api response in react native?
  • Why does gmail API when using history.list method send message ids without the field what action has been preformed on t
  • How to run an append query in ms access vba as part of a transaction
  • Wrong dates shown in Jekyll-based blog
  • How to concatenate two document lists in a webMethods flow service?
  • How to properly set up a site map addition in a customization project
  • IBM Content Collector error calling external Web Service
  • Is (0*1*)* equal to (0 | 1)*?
  • How do I configure phpMyAdmin to start with a blank sql query from the SQL tab?
  • "Objects are not valid as a React child" Redux error when conditionally connecting a component?
  • Displacy results are not showing
  • Strapi / Graphql. What am i doing wrong?
  • How to add Search bar for django template?
  • lookup in presto using single column against a range in lookup table
  • How can you stop videos being stolen on website?
  • Can't code substitution happen in Hybrid Flow?
  • Removed widget remains on parent
  • setup saga middleware with redux-starter-kit's configureStore()
  • How to get cookies from response of scrapy splash
  • I need to do a firebase stream and not a Http Get
  • Unable to compile node-runtime
  • SQLSTATE[42S22]: Column not found: 1054 Unknown column '' in 'where clause'
  • How to extract only the number from a variable
  • disable linter in DAML studio
  • RxJS: How to set exhaustMap concurrent?
  • How to remove perforce (p4) on Ubuntu
  • How do they know mean and std, the input value of transforms.Normalize
  • Why this type is not an Interface?
  • SugarCRM Rest API set_relationship between Contacts and Documents
  • Jira dashboard organization
  • Web worker importScripts fails to place script variables in global scope
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com