Git Product home page Git Product logo

design-center's Introduction

design-center's People

Contributors

alecto3-d avatar atsaloli avatar bahamat avatar bheilman avatar dansrepo avatar dmitry84 avatar estenberg avatar filler avatar jooooooon avatar jremond avatar kacf avatar lpefferkorn avatar matthewcattell avatar michaelclelland avatar mvpel avatar ncharles avatar neilhwatson avatar nickanderson avatar nishesj avatar olehermanse avatar ph1l avatar tzz avatar vpodzime avatar xenuser avatar zzamboni avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

design-center's Issues

Cleanup tmp directories after yourself

The temporary directories that are created are left behind, its not a big deal, they are empty, but it would be nice if they were removed when you are done with them.

vcs_mirror sketch does not create the target directories

This is what I got when I ran the vcs_mirror sketch:

Q: "...sr/bin/git clon": fatal: could not create leading directories of '/mirrors/design-center': Permission denied
I: Last 1 quoted lines were generated by promiser "/usr/bin/git clone -b master https://github.com/cfengine/design-center.git /mirrors/design-center"

cf-sketch> list -v

The following sketches are installed:

  1. CFEngine::stdlib (library)
  2. VCS::vcs_mirror (configured)
    Instance #1: (Activated on 'any')
    branch: master
    nowipe: !any
    origin: https://github.com/cfengine/design-center.git
    path: /mirrors/design-center
    runas: cfengine
    umask: 022
    vcs: /usr/bin/git

cf-sketch>

I was expecting it to create /mirrors/design-center

abortclass/cowboy sketch autoclear trigger

It was suggested this week that an autoclear mode be added to this sketch.

Looking for thoughts.
should it clear x time from ctime or mtime of the checked file, or x time from the first time CFEngine finds the file?

Clearing based on c or mtime gives the user more control and possibly is more understandable to the user.

What behaviour would you expect to happen if you removed and recreated the trigger file? or just touched the trigger file.

The idea being to make it increasingly more painful to work in cowboy mode but still allow the local admin to make the decision.

yumclient doesn't write in tzz fork, branch feature/cfsketch/redesign

Nick, maybe you can help me with this one. It's an issue with the new cf-sketch interface. Everything looks good here; assuming you have DC in ~source/design-center this command works fine:

~/source/design-center/tools/cf-sketch/cf-sketch.pl --install CFEngine::stdlib --install-source=~/source/design-center/sketches/cfsketches --deactivate-all --install Repository::Yum::Client --activate Repository::Yum::Client=/home/tzz/source/design-center/sketches/package_management/yumclient/params/demo.json --generate
cf-agent -KI -f /home/tzz/.cfagent/inputs/cf-sketch-runfile.cf -Dverbose -Ddebug -Dtest

And the output, to me, looks good. But the actual editing is never done! I thought it might be because of the $(editor) bundle name in a variable, but if I use a literal string it's the same result.

R: DEBUG repo_yum_client_config  baseline baseurl=file:///var/www/html/yum_repos/myrepo
R: DEBUG repo_yum_client_config  baseline enabled=1
R: DEBUG repo_yum_client_config  baseline name=myrepo
R: DEBUG repo_yum_client_config  baseline gpgcheck=no
R: DEBUG repo_yum_client_config  empty_section: true, editor=$(editor)
R: DEBUG repo_yum_client_config  required baseline baseurl defined = file:///var/www/html/yum_repos/myrepo
R: DEBUG repo_yum_client_config  ensure_absent is not set; writing /tmp/baseline.repo
R: DEBUG repo_yum_client_config  repos_dir: /tmp
 !! Method invoked repairs
R: DEBUG repo_yum_client_config  repo1 gpgcheck=no
R: DEBUG repo_yum_client_config  repo1 name=repo1
R: DEBUG repo_yum_client_config  repo1 enabled=1
R: DEBUG repo_yum_client_config  repo1 baseurl=file:///var/www/html/yum_repos/myrepo
R: DEBUG repo_yum_client_config  required repo1 baseurl defined = file:///var/www/html/yum_repos/myrepo
R: DEBUG repo_yum_client_config  ensure_absent is not set; writing /tmp/repo1.repo
 !! Method invoked repairs
R: Found repo baseline in array cfsketch_g._001_Repository__Yum__Client_repos.  Will configure it in /tmp
R: Found repo repo1 in array cfsketch_g._001_Repository__Yum__Client_repos.  Will configure it in /tmp
 !! Method invoked repairs

remove not updating installed sketches list

cf-sketch> list

The following sketches are installed:

1. CFEngine::stdlib (library)
2. System::tzconfig (not configured)
3. Utilities::abortclasses (not configured)
4. Utilities::ipverify (not configured)
5. Utilities::tmux::SessionManager (configured)
6. VCS::vcs_mirror (not configured)

cf-sketch> remove sketch VCS::vcs_mirror

cf3> /tmp/9etQnbC4UP/jC2CJWbiaA:485,1: syntax error, near token 'B'
cf3> /tmp/9etQnbC4UP/../../home/cmdln/.cfagent/inputs/sketches/CFEngine/stdlib/cfengine_stdlib.cf:3,126: syntax error, near token 'Not creating parent '
cf3> /tmp/9etQnbC4UP/../../home/cmdln/.cfagent/inputs/sketches/CFEngine/stdlib/cfengine_stdlib.cf:3,127: syntax error, near token ';'
cf3> /tmp/9etQnbC4UP/../../home/cmdln/.cfagent/inputs/sketches/CFEngine/stdlib/cfengine_stdlib.cf:7,48: syntax error, near token 'variables_ok.path_ex'
cf3> /tmp/9etQnbC4UP/../../home/cmdln/.cfagent/inputs/sketches/CFEngine/stdlib/cfengine_stdlib.cf:9,106: syntax error, near token 'Sorry, we could not '
cf3> /tmp/9etQnbC4UP/../../home/cmdln/.cfagent/inputs/sketches/CFEngine/stdlib/cfengine_stdlib.cf:9,107: syntax error, near token ';'
cf3> /tmp/9etQnbC4UP/../../home/cmdln/.cfagent/inputs/sketches/CFEngine/stdlib/cfengine_stdlib.cf:11,1: syntax error, near token '}'
Successfully removed VCS::vcs_mirror from /home/cmdln/.cfagent/inputs/sketches/VCS/vcs_mirror

cf-sketch> list

The following sketches are installed:

1. CFEngine::stdlib (library)
2. System::tzconfig (not configured)
3. Utilities::abortclasses (not configured)
4. Utilities::ipverify (not configured)
5. Utilities::tmux::SessionManager (configured)
6. VCS::vcs_mirror (not configured)

cf-sketch> remove sketch VCS::vcs_mirror

I did not find an installed sketch that matches 'VCS::vcs_mirror' - not removing it.

cf-sketch> list

The following sketches are installed:

1. CFEngine::stdlib (library)
2. System::tzconfig (not configured)
3. Utilities::abortclasses (not configured)
4. Utilities::ipverify (not configured)
5. Utilities::tmux::SessionManager (configured)
6. VCS::vcs_mirror (not configured)

Tests

We should probably have them.
It would be cool it there was something to test with various versions automatically to help validate compatibility.

I started playing with the default.sub testing thing from core with the latest updates to Security::limits

local_user_management fails to edit shadow in one weird case

With these settings:

  "users[jesse][gecos]"          string => "Jesse A";
  "users[jesse][uid]"            string => "502";
  "users[jesse][gid]"            string => "502";
  "users[jesse][home]"           string => "/home/jesse";
  "users[jesse][shell]"          string => "/bin/bash";
  "users[jesse][passwdhash]"     string => "$6$/Zx5Qr9k$wLTAuRpBUQNEEPnJhstQQe/rU/Veq69s.Ysqzm7EmSbQ9QZSxdJRR5YRUYP1jyRP5D4ddtlkzSXIzAGh6iNmV/";
  # Optional settings
  "users[jesse][groupname]"      string => "jesse";

I get weird non-convergent edits in /etc/shadow (the first line is inserted many times):

$(shadowentry[jesse])
 jesse:$6$/Zx5Qr9k$wLTAuRpBUQNEEPnJhstQQe/rU/Veq69s.Ysqzm7EmSbQ9QZSxdJRR5YRUYP1jyRP5D4ddtlkzSXIzAGh6iNmV/:15435:0:99999:7:::

I can't trace the problem but it seems regular expression-related. The same thing works fine for two other users.

AUTOLOADs are hard to debug!

This is why I don't like too-clever AUTOLOADs. Can you please think about changing the code so it doesn't use AUTOLOADs? I'll try to fix this specific issue, but generally I don't want to be debugging layers upon layers of indirection.

perl -MCarp::Always ~/source/design-center/tools/cf-sketch/cf-sketch.pl --expert --search

https://raw.github.com/zzamboni/design-center/features/ease_of_use/sketches/libraries/copbl/sketch.json is not an object at /home/tzz/source/design-center/tools/cf-sketch/perl-lib/DesignCenter/Repository.pm line 39
    DesignCenter::Repository::AUTOLOAD('https://raw.github.com/zzamboni/design-center/features/ease_o...', '/home/tzz/.cfagent/inputs/sketches/CFEngine/stdlib/sketch.json') called at /home/tzz/source/design-center/tools/cf-sketch/perl-lib/DesignCenter/Repository.pm line 305
    DesignCenter::Repository::install('DesignCenter::Repository=HASH(0x10808a0)', 'ARRAY(0x11135a8)', 1) called at /home/tzz/source/design-center/tools/cf-sketch/perl-lib/DesignCenter/Repository.pm line 39
    DesignCenter::Repository::AUTOLOAD('https://raw.github.com/zzamboni/design-center/features/ease_o...', '/home/tzz/.cfagent/inputs/sketches/CFEngine/stdlib/sketch.json') called at /home/tzz/source/design-center/tools/cf-sketch/perl-lib/DesignCenter/Repository.pm line 305
    DesignCenter::Repository::install('DesignCenter::Repository=HASH(0x10808a0)', 'ARRAY(0x11135a8)', 1) called at /home/tzz/source/design-center/tools/cf-sketch/cf-sketch.pl line 97

Where should I put new bodys?

I think that cfengine_stdlib.cf is still missing some essential but trivial bodys (see eg. https://cfengine.com/forum/read.php?3,24119,24119#msg-24119). Before contributing sketches, I would like to know whether I should push bodys in cfengine_stdlib.cf or bundle them with sketches. There is also third choice: I can create my_own_stdlib.cf and use only that one.

Feel free to move the discussion elsewhere, if that is required.

Broken runfile produced without fullpath

If --fullpath is not enabled when running --generate, the produced runfile is badly broken, with at least the following:

  • Inputs are specified as "Sketch/dir/file.cf" instead of "sketches/Sketch/dir/file.cf", so they are never found.
  • The bundle_home variable is set to "Sketch/dir", which for some sketches (i.e. cloud_services, which uses it to find its shim.pl script) causes breakage.

Erroneous stdlib installation on --search

Please look at this. CFEngine::stdlib should not be installed on a --search command.

perl -MCarp::Always ~/source/design-center/tools/cf-sketch/cf-sketch.pl --expert --search -v
....
Installing CFEngine::stdlib (CFEngine::stdlib) into /home/tzz/.cfagent/inputs/sketches

Add output colorization

It would be nice if output could be colorized and prettified in general, when running in interactive mode (with output to a terminal).

interface_settings sketch does not bring interface back up

Not sure why I didn't see this behaviour previously.

When an interface configuration file is edited it raises a class to signal an interface down and up is needed to apply the new configuration.

When running the agent manually with -KI over ssh the interface is downed after the configuration change but is not brought back up afterwards. Unsure why the ifup promise is not executing.

one solution would be to run a network restart but that's a little heavy handed as it affects all interfaces not just the one being edited.

There is no way to specify list of packages during interactive configuration of WordPress sketch.

11:43 @zzamboni the interactive configuration mode is still very basic, no good way to specify complex data structures
11:43 @zzamboni for "packages" it should ask you to enter the elements one by one, doesn't it?
11:46 < atsaloli_home> Parameter 'packages' must be a LIST().
11:46 < atsaloli_home> Please enter packages: php
11:46 < atsaloli_home> Sorry, but an unknown validation type LIST() was requested. We'll fail the validation, too.
11:46 < atsaloli_home> Invalid value, please reenter it.
11:46 < atsaloli_home> Please enter packages:
11:46 @zzamboni OK, that's a bug

cf-sketch --list fails to find installed sketch

(reported by Nick Anderson)

$ cf-sketch --search sysctl
System::sysctl /home/cmdln/src/cfengine/nickanderson/design-center/sketches/system/sysctl
$ cf-sketch --list sysctl
$ cf-sketch --install System::sysctl
Installing System::sysctl
Checking and installing sketch files.
Everything was up to date - nothing changed.
$ cf-sketch --list sysctl

cf-sketch search is slow

It's taking almost 30 seconds to return a simple search

cf-sketch --expert --search vcs 0.98s user 0.19s system 3% cpu 29.913 total

I didnt do much debugging but I did run through it with perl debugger just looking for "slow" spots

97: $config->repository->install(['CFEngine::stdlib'], 1);
and
135: Parser::command_search(join('|', @{$config->search}));
were slow when I stepped through it with a debugger.
197: my %missing = map { $
=> 1 } $self->missing_dependencies($data->{metadata}->{depends});
was slow

cf-sketch and the blood-stained command prompt

Whenever cf-sketch does a color_die, your command prompt and anything you type stays red until you reset it. Don't know the proper "Perl way" of doing it, but I fixed it awk-style on my end:

END {
    print RESET;
}

interface_settings sketch does not add settings under some conditions

I think this is why I was using set_variable_values2.

I believe this is caused by the classes that set_variable_values sets when a line is detected.

classes => if_ok("$(cindex[$(index)])_in_file"),

so considering that ONBOOT is one of the settings in an interface files that will define something like ONBOOT_in_file if it exists.

All is fine and well for editing the first interface configuration. When I add another interface a new config file is created but ONBOOT isnt added to the file because the class ONBOOT_in_file exists (because of the promises for the first interface).

So where should this be fixed? I would say that the global class set by set_variable_values is not sufficiently unique. Suggestions on what should be added to the set_variable_values classes to make them more unique?

I may just pull set_variable_values into the sketch so that I can make it unique by interface name.

Thoughts?

sketch return values

I'd like to have sketch return values. Within the cf-sketch context, I'm thinking of simply specifying a optional "return_value" key in the metadata, which each sketch is free to write into. There would be a class "can_return_value" available when the "return_value" key is not null. Then other sketches can chain their execution on top of the return value.

Please comment.

Paths in runfile should be relative, not absolute

Paths in the generated runfile should be relative so that it works well regardless of being copied across systems (for example, copied from /var/cfengine/masterfiles on the server to /var/cfengine/inputs on a client).

RFC sketch to manage tmux sessions

If you have a moment, take a look. I have been playing with defaults recently, they are used in the sketch, probably wont ever be triggered if your using cf-sketch to configure the sketch.

https://github.com/nickanderson/design-center/blob/feature/tmux_sessionManager/sketches/utilities/tmux/sessionManager/main.cf

Anyway this sketch manages the existence (or non existence) of a named tmux session. You can give it config options and a command. I use something similar to make sure that my irssi client is up on my server.

  1. I'm not convinced about variable names or sketch names
  2. I'm not sure about the meta entry for vars[tmux_config][type]" string => "SLIST";
    I dont think SLIST is a valid type. Needs to be a string that gets split inside the sketch?
  3. its not namespaced yet.

Automatically update cfsketches

So far the cfsketches file is maintained by hand. We need to implement a mechanism to populate it automatically based on the existing sketches.

Activations should not be indexed by filename

I think activations should not be indexed by filename, as this limits functionality and is confusing.

Confusing because the parameter values are copied into the activations file, so the original filename is no longer needed, yet displaying it might give the impression that it is.

Limits functionality because you cannot use the same base file and override certain parameters with --params to generate multiple activations. Consider this example:

cfma-10022:tmp root# cf-sketch -la
cfma-10022:tmp root# cf-sketch --activate VCS::vcs_mirror=/var/cfengine/inputs/sketches/VCS/vcs_mirror/params/cfengine-core.json
Loading activation params from /var/cfengine/inputs/sketches/VCS/vcs_mirror/params/cfengine-core.json
Activated: VCS::vcs_mirror aparams /var/cfengine/inputs/sketches/VCS/vcs_mirror/params/cfengine-core.json
cfma-10022:tmp root# cf-sketch -la
1   VCS::vcs_mirror /var/cfengine/inputs/sketches/VCS/vcs_mirror/params/cfengine-core.json {"activated":true,"runas":"getenv(\"USER\", 128)","origin":"https://github.com/cfengine/core.git","vcs":"/usr/bin/git","path":"/tmp/cfengine-core","bundle_home":"dirname(\"$(this.promise_filename)\")","branch":"master"}

So far so good. Now I want to activate the same sketch again, but change the checkout directory, so I do:

cfma-10022:tmp root# cf-sketch --activate VCS::vcs_mirror=/var/cfengine/inputs/sketches/VCS/vcs_mirror/params/cfengine-core.json --params path=/some/other/path
Loading activation params from /var/cfengine/inputs/sketches/VCS/vcs_mirror/params/cfengine-core.json
Activated: VCS::vcs_mirror aparams /var/cfengine/inputs/sketches/VCS/vcs_mirror/params/cfengine-core.json
cfma-10022:tmp root# cf-sketch -la
1   VCS::vcs_mirror /var/cfengine/inputs/sketches/VCS/vcs_mirror/params/cfengine-core.json {"activated":true,"runas":"getenv(\"USER\", 128)","origin":"https://github.com/cfengine/core.git","vcs":"/usr/bin/git","path":"/some/other/path","bundle_home":"dirname(\"$(this.promise_filename)\")","branch":"master"}

The original activation has been replaced! I think this is wrong.

I'd rather just assign an ID (like the numeric IDs shown in --list-activations), and maybe allow the user to specify a human-readable tag for that activation, for easier reference.

Thoughts?

sketch categorization and formal "provides" and "requires" tagging

Related to #105, I think sketches should have categorization through "provides" and "requires" attributes, now what we have bundle return values.

The attributes, in turn, should have formal meaning within the DC context.

For example:

sketch Apache::Install provides webserver
sketch Deploy::Docroot requires webserver
webserver = (vhost, site_name, docroot)

Which would result in Apache::Install returning the webserver attributes in the return array, while Deploy::Docroot would use them.

The key, therefore, is to develop a flexible language to express the provides/requires things. I propose we simply make it a JSON file living in DC and see how it goes.

Please comment.

Sysctl gets run (sysctl -p) every time, even when nothing was changed

In System::sysctl in the commands section, on line 76, there is no match for running sysctl -p, which causes it to be run every time. I believe the intent was to have it only run if sysctl_needs_reloaded class is set

https://github.com/cfengine/design-center/blob/master/sketches/system/sysctl/main.cf

diff main.cf main.cf2
77,81c77,80
< sysctl_needs_reloaded::
< "/sbin/sysctl"
< args => "-p",
< classes => if_repaired("sysctl_reloaded"),

< comment => "Reload sysctl after repairing configuration";

"/sbin/sysctl"
args => "-p",
classes => if_repaired("sysctl_reloaded"),
comment => "Reload sysctl after repairing configuration";

Security::SSH - duplicate entries in config

Noticed this, I suspect this has to do with uncommenting default values and adding values at the same time. I have not investigated though.

While it doens't cause any problem. I get complaints from anyone who looks at the configfile itself.

grep Listen /etc/ssh/sshd_config
ListenAddress 172.24.10.10
ListenAddress 172.24.10.10

grep Protocol /etc/ssh/sshd_config
Protocol 2
Protocol 2

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.