text:
Action class with repeater type field

Hello,
How can make an action class with a repeater type field?
"Unexpected type of array when attempting to save attribute "repeater_field", try adding it to the $jsonable property." on line 751 of /site/vendor/october/rain/src/Database/Model.php

Repeater fields are not supported at the moment. We have added this to our internal list of improvements. Thanks!

Resurrecting this issue, from what I understand, what prevents the saving of RuleAction is related to repeater in this section of ocrober/rain/src/Database/Model.php:

I commented out the Exception line, and it saved successfully. After that, the beforeSave of the RuleAction model is executed, transferring the data to config_data and clearing the previously filled attributes.
Is there a way to bypass this somehow? Perhaps by executing beforeSave earlier or by using an attribute in the model to disable this jsonable validation?

@prhost This line has been removed in OCMS v3.6 for other reasons. It should be fixed when this version is released.

authors: daftspunk prhost webmaxx

repo: rainlab/notify-plugin


text:
🛑 RiotSkin4CN-Download is down

In 375f49d, RiotSkin4CN-Download (https://s-cd-4307-general.oss.dogecdn.com/riotskin4cn/live.json) was down:

HTTP code: 0
Response time: 0 ms

Resolved: RiotSkin4CN-Download is back up in bb59d37 after 10 minutes.

source: gharchive/issue

license: MIT

license_type: permissive

license_source: github-api


text:
🛑 RiotSkin4CN-Download is down

In d84b6f7, RiotSkin4CN-Download (https://s-cd-4307-general.oss.dogecdn.com/riotskin4cn/live.json) was down:

HTTP code: 0
Response time: 0 ms

Resolved: RiotSkin4CN-Download is back up in b183e07.


text:
Fails to install with new project created by angular-cli

Created a empty project with latest angular-cli, then trying to install this module fails with the following error.
npm ERR! Linux 4.4.36-8-default
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "angular2-google-map-auto-complete" "--save"
npm ERR! node v7.3.0
npm ERR! npm  v3.10.10
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn

npm ERR! angular2-google-map-auto-complete@2.0.3 postinstall: `typings install`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the angular2-google-map-auto-complete@2.0.3 postinstall script 'typings install'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the angular2-google-map-auto-complete package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     typings install
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs angular2-google-map-auto-complete
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls angular2-google-map-auto-complete
npm ERR! There is likely additional logging output above.

Seems like the postinstall tries to use a global typings install instead of the one in their deps.

Hi ,
run following command before install it
npm install -g typescript

I'm running into this same issue. I've tried your recommended solution and I still get the same error

nvm got it to work with
npm install typings

authors: codestation mbusbyHub rajan-g

license: mit

license_source: bigquery


text:
alacritty-themes stopped working since TOML config

Describe the bug
A clear and concise description of what the bug is.
To Reproduce
use alacritty-themes

See error

const NoAlacrittyFileFoundError = new Error(
                                  ^

Error: No Alacritty configuration file found.
Expected one of the following files to exist:
/home/neo29/.config/alacritty/alacritty.yml
/home/neo29/.alacritty.yml
Or you can create a new one using `alacritty-themes --create`
    at Object.<anonymous> (/usr/lib/node_modules/alacritty-themes/src/helpers/index.js:6:35)
    at Module._compile (node:internal/modules/cjs/loader:1375:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1434:10)
    at Module.load (node:internal/modules/cjs/loader:1206:32)
    at Module._load (node:internal/modules/cjs/loader:1022:12)
    at Module.require (node:internal/modules/cjs/loader:1234:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/usr/lib/node_modules/alacritty-themes/bin/cli.js:12:5)
    at Module._compile (node:internal/modules/cjs/loader:1375:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1434:10)

Expected behavior
usual behaviour with choices
A clear and concise description of what you expected to happen.
Operating System:

[ ] Windows
[ ] Ubuntu
[ ] Pop Os
[X] Arch gnome on wayland
[ ] Other, which one?

Add your alacritty.yml content
decorations = "None"
opacity = 0.85

[font]
size = 10

[cursor]
style = { blinking = "Always" }

[colors.primary]
background = "#20201d"
foreground = "#a6a28c"

[colors.cursor]
text   = "#20201d"
cursor = "#a6a28c"

[colors.normal]
black   = "#20201d"
red     = "#d73737"
green   = "#60ac39"
yellow  = "#cfb017"
blue    = "#6684e1"
magenta = "#b854d4"
cyan    = "#1fad83"
white   = "#a6a28c"

[colors.bright]
black   =  "#7d7a68"
red     =  "#d73737"
green   =  "#60ac39"
yellow  =  "#cfb017"
blue    =  "#6684e1"
magenta =  "#b854d4"
cyan    =  "#1fad83"
white   =  "#fefbec"

warning new toml config

I get this too, of course - everyone with the newest version will.

Still waiting for this.. Note that the official installation instructions and configuration documentation tell people to use the new TOML configuration file... so you're losing a lot of potential users with this lack of support.

Still waiting for this.. Note that the official installation instructions and configuration documentation tell people to use the new TOML configuration file... so you're losing a lot of potential users with this lack of support.

What do you mean " waiting for this"?  You can install it manually in 5 minutes.

@emilBeBri Of course it's what I ended up doing after alacritty-themes didn't work. Just trying to be helpful to let developers know this issue breaks this project for anybody following the latest setup documentation - and that it's been over three months since the issue was noticed.

@wcheek ok that makes sense.

I made a new release v6.0.0 in npm, please check and let me know or any issues

@rajasegar So fast.
It looks like it works now. There are a few issues I see.
First problem
Before replacing my entire custom config file the TOML parser threw an error about one of my keybindings:
C:\Users\104104\AppData\Roaming\npm\node_modules\alacritty-themes\node_modules\@iarna\toml\lib\toml-parser.js:17
  const terr = new TomlError(err.message)
               ^

TomlError: Control characters (codes < 0x1f and 0x7f) are not allowed in strings, use \u007f instead at row 320, col 16, pos 4793:
319: [[keyboard.bindings]]
      at TOMLParser.parseBasicString (C:\Users\104104\AppData\Roaming\npm\node_modules\alacritty-themes\node_modules\@iarna\toml\lib\toml-parser.js:670:22)
      at TOMLParser.runOne (C:\Users\104104\AppData\Roaming\npm\node_modules\alacritty-themes\node_modules\@iarna\toml\lib\parser.js:64:30)
      at TOMLParser.goto (C:\Users\104104\AppData\Roaming\npm\node_modules\alacritty-themes\node_modules\@iarna\toml\lib\parser.js:87:17)
      at TOMLParser.recordEscapeReplacement (C:\Users\104104\AppData\Roaming\npm\node_modules\alacritty-themes\node_modules\@iarna\toml\lib\toml-parser.js:678:19)
      at TOMLParser.runOne (C:\Users\104104\AppData\Roaming\npm\node_modules\alacritty-themes\node_modules\@iarna\toml\lib\parser.js:64:30)
      at TOMLParser.returnNow (C:\Users\104104\AppData\Roaming\npm\node_modules\alacritty-themes\node_modules\@iarna\toml\lib\parser.js:107:17)
      at TOMLParser.parseUnicodeReturn (C:\Users\104104\AppData\Roaming\npm\node_modules\alacritty-themes\node_modules\@iarna\toml\lib\toml-parser.js:783:21)
      at TOMLParser.runOne (C:\Users\104104\AppData\Roaming\npm\node_modules\alacritty-themes\node_modules\@iarna\toml\lib\parser.js:64:30)
      at TOMLParser.parse (C:\Users\104104\AppData\Roaming\npm\node_modules\alacritty-themes\node_modules\@iarna\toml\lib\parser.js:45:22) {
    fromTOML: true,
    wrapped: null,
    line: 319,
    col: 15,
    pos: 4793
  },
  code: undefined,
  line: 319,
  col: 15,
  pos: 4793
}

Here is the suspect key binding:
[[keyboard.bindings]]
chars = "\u001b^?"
key = "Back"
mods = "Alt"

Second problem
I did the fix the error suggested and the TOML parser successfully ran but has completely replaced my config with a simple import of the theme.. this is not really ideal since I lost some of my custom settings.. I'm able to add them back under the import.. but if I use alacritty-themes again, my custom settings are again removed.
Does alacritty-themes not preserve custom configs?

It should, I think during the yml to toml conversion, there is some bug introduced, will fix it asap and let you folks know

Pushed a new release 6.0.2 in npm

Remove the preview option for now since it is buggy, you have to apply the theme to see the changes
If your old config is not preserved, you can restore them by renaming the latest backup file
 mv alacritty.toml.xxxxxx.bak alacritty.toml
Also ensure you remove these sections in your old config file to the new theme to take effect:

[colors.bright]
[colors.normal]
[colors.primary]

I tested the new version
No preview of the themes when scrollling...
is it normal?

@Neo-29 Yes it is intended, since the preview functionality is buggy I turned it off temporarily
will update this thread once it is fixed

authors: Neo-29 emilBeBri rajasegar wcheek

repo: rajasegar/alacritty-themes


text:
🛑 PlayStore API is down

In 781cfd1, PlayStore API (https://api-playstore.rajkumaar.co.in) was down:

HTTP code: 502
Response time: 214 ms

Resolved: PlayStore API is back up in 852614d.


text:
Change variable name to uniqueIdentifier

Hello,
Can you please change the name of the variable file.uniqueIdentifier
Currently it is file.identifier
Because of that it is giving undefined.

You can check on line no. 744 in file https://github.com/rajneeshraghav/resumable-file-uploads/blob/master/resumable.js

Hello @aniruddha-mahamuni-bh , Thanks for suggestion. we will release new version next week.

authors: aniruddha-mahamuni-bh rajneeshraghav

repo: rajneeshraghav/resumable-file-uploads


text:
Fixes mangled printing when hitting a breakpoint without a stacktrace.

I think the problem is that in else the topic variable is taken from with (https://docs.raku.org/syntax/with orwith without):

As with the other chainable constructs, an else completing a with/if..orwith/elsif chain will itself topicalize to the value of the prior (failed) condition's topic (either the topic of with or the final orwith or elsif).

thank you!

source: gharchive/pull-request

repo: raku-community-modules/App-MoarVM-Debug


text:
Add PaNOSC Search API Data Model

Description:
Similar to DataGateway API's database backend, the data model should be defined using classes etc. You can see the DB backend modelling of ICAT in datagateway_api/common/database/models.py. This should be as simple as using the data model defined in the example implementation. We have discussed using pydantic for this which looks like it could be useful.
Within these classes, the relationships between entities need to be defined. In the database backend, SQLAlchemy did this nicely using Column(). Obviously we can't use that library in this case, so we should consider how this can be defined. Maybe just defining the fields as listed in the docs will be enough so long as you can validate what values they are set as - I guess Pydantic will help with that.
There should probably be tests to cover each class/entity of the data model, to ensure they are implemented correctly. I guess it needs to be tested that each attribute of an entity can be fetched/set using sensible values?
Acceptance criteria:

[ ] Implement data model like database backend models.py
[ ] Add tests for each class of the data model

The data model documentation and the data models in the example SearchAPI do not seem to be consistent.
Affiliation

The Field cell in the Relationships table is set as affiliations. Perhaps this is a mistake given it is referring to the Member class and the affiliation.json model file has a members field?
The affiliation.json model file has an id field instead of pid as listed in the Properties table. Which one should be used? If pid then should it be mandatory because it listed as non-mandatory in the table?

Dataset

The description at the top specifies that Technique is optional but the cardinality for it in the Relationships table is specified as 1,*. Was this mistaken for Parameter because its cardinality is listed as 0,*?
The dataset.json model file has a document field rather than documents like specified in the Relationships table. Should it be singular or plural? If singular like in the JSON model file then I guess that the cardinality is wrong in the table?
The dataset.json model file has a score field but this is not listed in the Properties table. Should the model have a score field?

Document

The document.json model file has a score field but this is not listed in the Properties table. Should the model have a score field?

File

Why is the Field cell for the Dataset class in the Relationships table blank? Does that mean that there should not be a field for this class in this model? If so then why does the file.json model file has a dataset field?

Instrument

The instrument.json model file has a pid field instead of id as listed in the Properties table. Which one should be used?
The instrument.json model file has a score field but this is not listed in the Properties table. Should the model have a score field?

Member

Why is the Field cell for the Document class in the Relationships table blank? Does that mean that there should not be a field for this class in this model? If so then why does the member.json model file has a document field?
The member.json model file has an affiliation field rather than affiliations like specified in the Relationships table. Should it be singular or plural? If singular like in the JSON model file then I guess that the cardinality is wrong in the table?

Parameter

Why is the Field cell for the Dataset class in the Relationships table blank? Does that mean that there should not be a field for this class in this model? If so then why does the parameter.json model file has a dataset field?
Why is the Field cell for the Document class in the Relationships table blank? Does that mean that there should not be a field for this class in this model? If so then why does the parameter.json model file has a document field?

Person

Why is the Field cell for the Member class in the Relationships table blank? Does that mean that there should not be a field for this class in this model? If so then why does the person.json model file has a members field?

Sample

The Relationships table lists the datasets as a field to this model however the sample.json model file does not have such a field. Should there be a datasets field in this model?
The pid field is listed as non-mandatory in the Properties table but it is set as mandatory in the sample.json model file. Should it be mandatory or not?

Technique

Why is the Field cell for the Dataset class in the Relationships table blank? Does that mean that there should not be a field for this class in this model?

Thanks for looking at this Viktor, I agree with each of your points/questions. I would also point out there seems to be inconsistencies between cardinalities between entities in the data model. One good example of this is Document. This states there is a 0-many relationship to the Member entity, but if you look at that entity, it states there is a 1-1 relationship to Document. This appears to be conflicting and I'm not sure which is correct.

repo: ral-facilities/datagateway-api


text:
Define Just/Maybe in doc examples

Since they are used in example code, would it be possible to add definitions of Just and Maybe to the documentation?
Alternatively, maybe those examples could be replaced with plain JS types or Ramda functions?

I think the changes to the repl should take care of this, next time the docs are built. In that case we will have to be sure we fully qualify which Just/Nothing we mean in the docs

This is on my list of things to do in the documentation.  I think we should document all external types used, such as Ord, Lens, Filterable, etc.  Since we're using Maybe and it's Just and Nothing subtypes in examples, they should also be documented.  This is not something I think is hard to do; it's simply never bubbled to the top of the list.
@MattMS: Is this something you'd care to take a crack at?  The documentation is maintained in a separate project if you are.

I'd love to help out with the documentation but my only hesitation is not being familiar enough with functional programming and the libraries described to do it properly.
Can provide any links to resources I should check out (like the types described)?
I'll also open any other documentation-related issues in that repo.

The examples that spawned this question are sequence and traverse.
Any chance of a plain JS example of their usage?
I have no idea what they are meant to do.

Unfortunately the "plain JS" examples are not as useful as the ADT examples, which is why we chose to use those for illustration.
For example(s): http://goo.gl/ymj54P

Actually the last example (R.sequence(R.of, [[1, 2], [3, 4], [5, 6]]) == [[1, 3, 5], [1, 3, 6], [1, 4, 5], [1, 4, 6], [2, 3, 5], [2, 3, 6], [2, 4, 5], [2, 4, 6]]) helped me finally see what I could do with it.
Are there issues with having simple examples like that following the current ones?

Are there issues with having simple examples like that following the current ones?

no problem at all. let's make it clearer if we can.
(btw traverse is just sequence with a mapping function thrown in.)

Awesome! I'll be able to play around with them now. :smile:
Unfortunately, it's 1am here so my play time will need to be later.

Examples should depict common usage. R.sequence and R.traverse are primarily useful for getting from an A of B to a B of A. Transforming a list of lists into a list of lists doesn't exemplify this inversion.

Examples should depict common usage. R.sequence and R.traverse are primarily useful for getting from an A of B to a B of A. Transforming a list of lists into a list of lists doesn't exemplify this inversion.

I think this is the problem.  The main usage of, say, sequence is probably for something like the first example1 in the documentation:
R.sequence(Maybe.of, [Just(1), Just(2), Just(3)]);   //=> Just([1, 2, 3])

But that is likely to confuse someone who's never seen Maybe.  But examples with the only other type we can comfortably use, lists, don't really show what it's all about.
One suggestion floated recently would be for there to be two levels of documentation for some or all functions, a quick gloss that explains the type signature and gives a brief example or two and a separate,  much more in-depth explanation.  While that sounds great, I'm not sure how to accomplish it, or even if it would really solve this problem.

1 The second example actually seems to be wrong. (http://goo.gl/ZzlJw9

But that is likely to confuse someone who's never seen Maybe.

In that case one is probably not going to find the function useful.

To complete the circle: would it be possible to define Just and Maybe somewhere that is linked from the examples? :stuck_out_tongue_winking_eye:
I would need some links to where I could learn this stuff before I could offer better suggestions.

Sanctuary's S.Just and S.Nothing and ramda-fantasy's 'Maybe.JustandMaybe.Nothing` are defined in the repl

I assume these are what you mean:

https://github.com/plaid/sanctuary

https://github.com/ramda/ramda-fantasy/blob/master/docs/Maybe.md

Definitely seems like useful reading.

Any chance that descriptions will be added to the wiki page on Type Signatures about how concepts like Maybe, Just, and Nothing integrates with Ramda?

@dalgard - your request is a good one. In meantime, have you taken a look at the ramda-fantasy docs, for example Maybe  Here, ramda and Maybe are being used freely together.

@arcseldon: Yeah, thanks. I actually understand the concept of Maybe already – what I'd like to know more about is Ramdas relationship with the types.
I'd like an explicit account of:

How the types are used (duck typing). Can they come from any library? Differences between Ramda Fantasy and Sanctuary types?
How the parallel development of Ramda and any specific type library is organized, assuring me that I can depend on their integration.
Recommendations from the developers in regard to their use.

@dalgard - how are you currently trying to use them ?  Can you offer some code example.

That's the thing, I'm actually waiting for an answer to my questions before I begin using them in a serious way.

@dalgard - I sympathise completely - currently things are not clear for all the aforementioned reasons in this and previous issues. Let's use Maybe as an example, to illustrate my take on things. I am in the same boat as you. Understand the concepts, have little practical experience applying the fantasy types to daily code in JS - have done so in Scala quite a bit using similar API.
Here we shall ignore Sanctuary completely. Lets consider ramda-fantasy as our extension NPM package for ramda in order to get some types such as Maybe. In fact, lets just pick on Maybe and use it with say (randomly choosing a useful everyday function from Ramda) R.find
So simple, vanilla example:
'use strict';

const R = require('ramda');

const numbersA = [1, 2, 3, 4, 5];
const numbersB = [1, 1, 1, 1, 1];

const greaterThanTwo = (a) => a > 2;

const resultA = R.find(greaterThanTwo, numbersA);
console.log(resultA);
//=> 3

const resultB = R.find(greaterThanTwo, numbersB);
console.log(resultB);
//=> undefined

Ok, so all good, but that undefined is a real problem (isn't it?)...
We can introduce Maybe to solve this one as follows, but R.find doesn't know anything about Maybe so lets see if we can bolt it onto the end using composition. First attempt:
const R = require('ramda'),
  RF = require('ramda-fantasy'),
  Maybe = RF.Maybe,
  Just    = Maybe.Just,
  Nothing = Maybe.Nothing;

const numbersA = [1, 2, 3, 4, 5];
const numbersB = [1, 1, 1, 1, 1];

const greaterThanTwo = (a) => a > 2;

const maybeFound = R.compose(Maybe.of, R.find(greaterThanTwo));

const resultA = maybeFound(numbersA).getOrElse(2);
console.log(resultA);
//=> 3

const resultB = maybeFound(numbersB).getOrElse(2);
console.log(resultB);
//=> undefined

Close, but no cigar. Notice that unfortunately we can't just compose with Maybe.of because that would result in a Just(undefined) instead of a Nothing when no result was found...
So, lets bin using Ramda find, and roll our own with baked in support for Maybe.
'use strict';

const R = require('ramda'),
  RF = require('ramda-fantasy'),
  Maybe = RF.Maybe,
  Just    = Maybe.Just,
  Nothing = Maybe.Nothing;

// Returns Maybe.Just(x) if some `x` passes the predicate test
// Otherwise returns Maybe.Nothing()
function find(predicate, xs) {
  return R.reduce(function(result, x) {
    return result.isJust() ? result :
      predicate(x) ? Just(x) : Nothing()
    }, Nothing());
}

const numbersA = [1, 2, 3, 4, 5];
const numbersB = [1, 1, 1, 1, 1];

const greaterThanTwo = (a) => a > 2;

const maybeFound = find(greaterThanTwo);

const resultA = maybeFound(numbersA).getOrElse(2);
console.log(resultA);
//=> 3

const resultB = maybeFound(numbersB).getOrElse(2);
console.log(resultB);
//=> 2

Ok, that works. There must be a better way right?
@CrossEye @buzzdecafe - please can you enlighten us? Or is it that we should roll our own recipes to get the Just / Nothing decision logic in there...

Quick peek in src/Maybe.js shows
function Maybe(x) {
  return x == null ? _nothing : Maybe.Just(x);
}

So you can use that constructor,
Installed into REPL context:
 - ramda@0.19.1 as R
 - ramda-fantasy@0.4.1 as RF
> RF.Maybe(R.find((a) => a > 2, [1, 1, 1, 1, 1]))
_Nothing {}
> RF.Maybe(R.find((a) => a > 2, [1, 1, 1, 1, 3]))
_Just { value: 3 }

data.maybe has Maybe.fromNullable for this purpose.

@arcseldon: Thanks for that. We're definitely in the same boat!

@dalgard - At least we are in a boat, and not drowning :smile:
@raine - thanks for pointing out the Constructor usage! Wow, I think we have just written the needed documentation.. :smile:

@raine: What about the composition example that @arcseldon just posted?

> const safeFind = pipe(find, Maybe)
> safeFind(gt(__, 2), [1,1,1])
_Nothing {}
> safeFind(gt(__, 2), [1,1,3])
_Just { value: 3 }

here's a quick example of safeFind:
const Just = Maybe.Just;
const Nothing = Maybe.Nothing;

var ones = [1,1,1,1,1,1,1];

const safeFind = compose(Maybe, find);

safeFind(gt(__, 0), ones); //=> Just(1)
safeFind(gt(__, 1), ones); //=> Nothing

too late, @raine beat me to an almost identical example

@buzzdecafe - yep, but thank you anyhow - and now we have a Maybe in play, we can just map our way through further compositions etc.

right, the problem is once you are inside that functor you are committed to it. You could stay at a more primitive level by composing with defaultTo or tryCatch

@buzzdecafe - Right.
Seeing as we have made great inroads in this issue towards fully exploring and understanding Ramda and its interplay with Maybe (in this case from ramda-fantasy) - I wanted to go a little further by way of examples, and pull in some valuable commentary from another issue -  do tend to plagiarize the core team alot when it comes to explaining this stuff - on this occasion from @CrossEye..
Stated as is:
Although what is specified by FantasyLand is what Haskell calls typeclasses the basic notion is simply one of algebraic types, types defined by a collection of functions/methods that apply to them and laws about how those functions interact.
The specific types are ones that have shown themselves to be quite useful for many developers over a long time. They are generally fairly abstract, but the laws specifying their interaction make them quite useful. For instance, Functor defines map, and the composition law of Functor says that (in Ramda terms)
compose(map(f), map(g)) ≍ map(compose(f, g))
A number of libraries create types that implement some of these algebraic specifications, including Folktale, RamdaFantasy, and Sanctuary. Ramda itself does not try to implement any of these specifications. But many of its functions delegate to named methods on the relevant objects, and this include almost all of the functions specified by the various algebraic types of FantasyLand.
So taking @buzzdecafe example of safeFind, lets see what happens if we wish to compose a few (contrived in this example) more Ramda functions off the back of the Maybe result. The question is, how do we continue the interplay between vanilla Ramda and Ramda-Fantasy. Well, my first take on this is we just map each of the functions along the pipeline, which is like opening up the Maybe box, applying the needed function on the contents, and then wrapping backup in a Maybe box.  Note in this example, there isn't the possibility of a Nothing decision, it is more about working with Maybe as-is - either passing on the Nothing result unchanged, or else updating the Just value.
'use strict';

const R = require('ramda'),
  compose = R.compose,
  map = R.map,
  find = R.find,
  gt = R.gt,
  increment = R.inc,
  double = R.multiply(2),
  decrement = R.dec,
  flip = R.flip,
  RF = require('ramda-fantasy'),
  Maybe = RF.Maybe,
  Just    = Maybe.Just,
  Nothing = Maybe.Nothing;

var ones = [1,1,1,1,1,1,1];

const findGtZero = find(flip(gt)(0));
const findGtOne = find(flip(gt)(1));

const safeFindGtZero = compose(Maybe, findGtZero);

const safeIncrement = map(increment);
const safeDouble = map(double);
const safeDecrement = map(decrement);

const safeFindAndCalcGtZero = compose(safeDecrement, safeDouble, safeIncrement, safeFindGtZero);

safeFindAndCalcGtZero(ones);
//=> Just(3)

const safeFindGtOne = compose(Maybe, findGtOne);

const safeFindAndCalcGtOne = compose(safeDecrement, safeDouble, safeIncrement, safeFindGtOne);

safeFindAndCalcGtOne(ones);
//=> Nothing

I don't know about you, but that looks horrid to me, so many intermediary functions or map wrapping going on... Can we do better?
Sure, remember this:
compose(map(f), map(g)) ≍ map(compose(f, g))
Well, lets try it out. What we'd expect is:
compose(map(decrement), map(double), map(increment);
to be the same as:
map(compose(decrement, double, increment));
Ok, lets give that a spin:
const safeCalc = map(compose(decrement, double, increment));

const safeFindAndCalcGtZero_delta = compose(safeCalc, safeFindGtZero);

safeFindAndCalcGtZero_delta(ones);
//=> Just(3)

const safeFindAndCalcGtOne_delta = compose(safeCalc, safeFindGtOne);
safeFindAndCalcGtOne_delta(ones);
//=> Nothing

It worked. Amen.
Still not sure I am sold on this style of coding, but going back to what @CrossEye explains:

The specific types are ones that have shown themselves to be quite useful for many developers over a long time

So perhaps the people have already spoken, and my personal bias is more down to what I am familiar with rather than what is truly useful.
I'd be grateful if others could offer up whether they actively program with implementations of fantasy land specs, or whether this stuff (in JavaScript world, where the language doesn't offer baked in support) really is just that - a fantasy?

I'd be grateful if others could offer up whether they actively program with implementations of fantasy land specs

I would too... :)

Stob put it well:

Monad property 4: Monads rarely throw exceptions. Instead they prefer to pretend nothing happened and pass the Empty Monad down the chain. This improves the level of surprise when you get to the end of a long calculation and find that, instead of a nice diagnostic stack trace or the actual answer, you have the computing science equivalent of a belch. But never mind. Admire the smooth, alimentary flow of the functional pipeline that delivered it!

:smile:  priceless.

But never mind. Admire the smooth, alimentary flow of the functional pipeline that delivered it!

Yep, the way it all works out is seductive. There is some good commentary here on Railway oriented programming, which i am guessing many readers of this issue have already seen / read.  Despite the excellent explanations, and extolling the benefits, I am still not entirely convinced.
Tony Hoare, the inventor of null references, also describes it as the Billion Dollar Mistake - and it would be great to be convinced there is indeed a better way...

I'd be grateful if others could offer up whether they actively program with implementations of fantasy land specs, or whether this stuff (in JavaScript world, where the language doesn't offer baked in support) really is just that - a fantasy?

Here's some real-world code which gracefully handles three possible failure conditions:
pipe([get(String, 'more_info'),
      map(pipe([replace('/*-secure-', ''),
                replace('-secure-*/', ''),
                replace(/\\(?=')/g, ''),
                replace(/\\x([0-9A-F]{2})/g,
                        (_, s) => String.fromCharCode(parseInt(s, 16)))])),
      chain(parseJson),
      chain(get(String, 'transactionAdditionalInfo')),
      fromMaybe(''),
      cheerio.load],
     raw);

No conditional logic in sight!
Here's the rough imperative equivalent:
if (typeof raw.more_info === 'string') {
  const normalized = raw.more_info.replace(…).replace(…).replace(…).replace(…);
  let parsed;
  let valid;
  try {
    parsed = JSON.parse(normalized);
    valid = true;
  } catch (err) {
    valid = false;
  }
  if (valid) {
    if (typeof parsed.transactionAdditionalInfo === 'string') {
      const $ = cheerio.load(parsed.transactionAdditionalInfo);
      // Do something with $...
    }
  }
}

// Handle failure...

@davidchambers - thanks for this example, which on face value is compelling.
I'm intrigued enough to try out sanctuary for a few weeks in earnest, and train myself to work with the types, and reach a point where I can make an informed decision for myself. Am picking up Haskell again after a year's absence, so this is all nicely aligned & comes at a good time. Hope you won't mind me asking you a question here or there along the way!  Your talk on functional geekery where you consider how to handle invalid input (00:48:00 onwards) - also in regards to testing - makes alot of sense.

Hope you won't mind me asking you a question here or there along the way!

Not at all! I don't have all the answers, though. :)

Quick update here:
Am a week into this journey, and I would say I am certainly encouraged so far. Must have written a couple hundred test cases exploring usage, and how the data types interact with one another.
In fact, am encouraged to the point where I'd be in favour of enhancing Ramda to provide default support for some data types for its API functions. The main barrier is familiarity with the various constructs for manipulating / working with the data types. Once that barrier starts to disappear usage becomes quite addictive, and it is frustrating to return to plain old javascript equivalents that don't have baked in support.
Taking this simple example using Sanctuary:
const  S = require('sanctuary');
...

it('should handle success and failure scenarios for parseFloat', () => {

    S.parseFloat('xxx');
    // Nothing()

    S.parseFloat('12.34');
    // Just(12.34)

    expect(S.Just('xxx').chain(S.parseFloat)).to.eql(S.Nothing());
    expect(S.Just('12.34').chain(S.parseFloat)).to.eql(S.Just(12.34));

    expect(map(add(3))(S.Just(1))).to.eql(S.Just(4));

  });

The fact that S.parseFloat bakes in the Maybe support does greatly assist "fluent api usage".
Am starting to see the argument for default implementations, and even consider collapsing ramda-fantasy package into ramda core. But I shall hold judgement here for a few more weeks in case I discover any late issues.
On that note, I'd like to start using some of this in Production (commercially at work).
Are there any reservations around ramda-fantasy and prd usage?  Should I opt for Sanctuary / Folktale (in the near term at least)?  The code and test coverage looks comprehensive in ramda fantasy, but I would prefer to mitigate any risks where possible - and need some assurances it is battle tested.
@davidchambers - take it Plaid is using Sanctuary for Production atm, or is it still in incubation?

Am starting to see the argument for default implementations, and even consider collapsing ramda-fantasy package into ramda core.

There is a real argument to be made for that.  (Just ask @davidchambers!  :smile:)  And this has discussed at least as far back as #683.  The reason I've been against doing it goes back to the fundamentals of Ramda.  David described it very well in https://github.com/ramda/ramda/pull/1218#issuecomment-115011615:

Sanctuary embraces correctness in a way that Ramda cannot, given Ramda's goal of remaining approachable to JavaScript programmers with no FP experience. This is a worthwhile goal, as we can't expect such programmers to jump directly to PureScript. This is a smoother upgrade path:
Vanilla JavaScript → Underscore/lodash → Ramda → Sanctuary → PureScript

Remaining approachable involves especially returning from our functions something immediately useful to work-a-day programmers.  head([1, 2, 3]) returns 1.  I can just use that directly, and I don't have to worry about anyone's odd container type to do so.  If it returned Just(1), then it is definitely safer.  The same code could handle the undefined equivalent of head([]) returning Nothing(), but it's far less approachable.  map? chain? Huh?

Are there any reservations around ramda-fantasy and prd usage? Should I opt for Sanctuary / Folktale (in the near term at least)?

I can't really tell you how battle-tested it is.  To me, it's been more of a playground.  @TheLudd or @buzzdecafe or others might be able to give you a clearer view.  If all you're looking for is the safer versions of Ramda functions, especially Maybe wrappers around potentially unsafe calls, then I would definitely go with Sanctuary.
But Sanctuary is not attempting to do what R-F or Folktale are doing, which is to supply substantial useful implementation of various common types.  So if you want to use some of those (Reader, IO, Future/Task, Validator) then you should consider one of these libraries.

@CrossEye - cannot argue against the upgrade path analogy.
head([1, 2, 3]) returns 1 - yep, that is already starting to look suspect now.
Shall continue to mix ramda and sanctuary when required, should suffice.
Thank you also for pointing out that a Fantasy land implementation is still required for some of the other implementations. I am unclear whether I really need IO or Reader at this point, but Future I could see being useful on occasion. I really like the pure way in which nothing happens until you call fork on them - that to me is an advantage over vanilla promise usage.
For instance, wrapping readFile etc might be one way to solve callback syntax - not really had enough practical experience to comment though.
//+ readFile :: String -> Future(Error, String)
const readFile = (filename) => {
    return Future((rej, res) => {
        fs.readFile(filename, 'utf-8', (err, data) => {
            err ? rej(err) : res(data);
          });
      });
  };

Or perhaps to wrap http calls:
 //+ getJSON :: String -> Object -> Future(Error, JSON)
  const getJSON = curry((url, params) => {
      return new Future((rej, res) {
          $.getJSON(url, params, res).fail(rej);
        });
    });

and then invoke:
 //+ posts :: Object -> Future(Error, [Post])
  const posts = compose(map(sortBy('date')), getJSON('/posts'));

  posts({}).fork(logError, renderView);

(source: Monad a Day 2: Future - Thanks Brian)
However, am still a little unclear on its interaction with say bluebird / Q promise libraries for doing more advanced promises manipulation, in parallel etc... would be great to get some examples here. Likewise, i would be grateful if anyone could point out usage of Ramda's composeP  - assuming that is just async waterfall, or joining together promises with .then()  ?

However, am still a little unclear on its interaction with say bluebird / Q promise libraries for doing more advanced promises manipulation, in parallel etc... would be great to get some examples here.

I think many of us here find Promises to be too unlawful to be useful.  I know that I personally prefer to use Futures or Tasks instead.

Likewise, i would be grateful if anyone could point out usage of Ramda's composeP - assuming that is just async waterfall, or joining together promises with .then() ?

Yuri Takhteyev, who introduced the function, wrote about it in December, 2014.

Thank you, the explanation regarding composeP / pipeP was exactly what I was looking for, as well as getting the context / history too.
Example usage:
const getCostWithTaxAsync = R.pipeP(
    getItem, // get a promise for the item
    R.prop('cost'), // pull out the 'cost' property
    R.multiply(1 + TAX_RATE) // multiply it by 1.13
); // returns a promise for the cost with tax

I know that I personally prefer to use Futures or Tasks instead.

Which javascript Future implementation are you using?  (or is that Folktale's renamed data.Task implementation you are referencing?  I was hoping we were eating our own dog food :smile:

Compared with the example above, I do think the composeP and pipeP documentation could be made more approachable. Appreciate it is accurate, but the way the promise propagates itself through the pipe etc doesn't mean every function in the pipe has to be explicitly promise returning. The above example demonstrates nicely that you can just have ordinary Ramda functions anywhere after a Promise returning function is invoked (in same way you can do likewise within a .then() chain using promises directly).

@davidchambers - take it Plaid is using Sanctuary for Production atm, or is it still in incubation?

We've been using Sanctuary heavily in one project, Parse, for the past year. Parse makes great use of Ramda as well. Every Plaid project written in JavaScript uses Ramda. Many use Sanctuary as well, though often in just a handful of places.

But Sanctuary is not attempting to do what R-F or Folktale are doing, which is to supply substantial useful implementation of various common types.

This is a function of my time and attention. I'd love to add a Task type, or receive a pull request for one. ;)

@davidchambers - thank you for your reply. Great, the fact that Ramda and Sanctuary have received heavy usage is reassuring. I was using Ramda version 0.7 in production with a previous Client back in early 2014 - don't like to dwell on such things - sure it was all performant and bug free :see_no_evil:

I'd love to add a Task type, or receive a pull request for one

Not from me you wouldn't :smile:   but i guess I could always cobble something together based on other libraries at a push..  Seriously, IF I get some time I'd really like to have a go, but not making any commitment here. The workload from new Client is really ramping up now so I am going to have less time available.
What are you using at Plaid to fill the gap regarding Fantasy Land data types? Or aren't you using anything unless Sanctuary / Ramda covers it...

Compared with the example above, I do think the composePand pipeP documentation could be made more approachable.

We'd certainly entertain a PR on this!

What are you using at Plaid to fill the gap regarding Fantasy Land data types? Or aren't you using anything unless Sanctuary / Ramda covers it...

plaid/async-problem makes a compelling case for Task, but right now most of our projects use some flavour of Promise. :\
Funnily enough, I think require('data.task') is a significant barrier to entry. Were S.Task to exist there would be less opposition to using tasks. :)

Which javascript Future implementation are you using?  (or is that Folktale's renamed data.Task implementation you are referencing?)

Until recently, I always used data.Task.  I now sometimes use R-F's Future.

I was hoping we were eating our own dog food :smile:

I don't feel that way at all about Ramda-Fantasy.  To me it's mostly been a small learning project, trying to find out what these ADT's are all about.  Of course Ramda itself started that way too, but in my mind R-F hasn't come close to making the transition to being a fully formed library the way Ramda did some time back.  But I may not have the right impression either, as I haven't been very involved.  I've on and off been working on something which is related to the FantasyLand specs, but which is built a very different way.  It's quite far from ready, though.  But this has taken whatever energy I might have put into R-F.
But one of the whole points of Ramda's dispatching mechanism is that Ramda should be able to work well with any compliant implementation of a particular F-L spec.  It might work fine with other objects that have a map, ap, chain, or whatever as well.  So choosing one should have to do with other things besides Ramda.

@Jeff-Tian , you can Open in REPL instead of "Run it here", repl import ramda-fantasy & Sanctuary which contain Maybe and Just.

This does make me wonder, though, if it would be easy enough to update our RunKit implementation to include some version of Maybe  and Either.  I imagine it would be straightforward.  But I've never spent any time on that integration.
Anyone know how to do this?  @ramda/ramda-repl, @ramda/core, @tolmasky?

You can accomplish this fairly trivially by adding something like this:
const { Maybe, Either } = require("ramda-fantasy");

to the preamble of the embed. The preamble property just has code that you want to load before the user-editable portion. It's currently used to get R into scope for example.

To follow up, this line would just need the above added to it.

@tolmasky:  Perfect.  Thank you very much!

@Jeff-Tian , you can Open in REPL instead of "Run it here", Ramda's REPL import ramda-fantasy & Sanctuary which contain Maybe and Just.

Thank you  @adispring . But most of the time I hope I can run it through RunKit, because REPL uses some CDNs that behaves badly in Shanghai:

I know I can use VPN, but if runkit works, then I don't need to bother using it.

I am getting a pull request ready that adds this feature. However, I had a couple questions before submitting:

According to ramda-fantasy's repository, the project is no longer maintained. Is there some alternative Maybe/Either that is preferred? Seems iffy to add a library that is close to deprecation, but happy to do it.
If we do want to use ramda-fantasy, could we perhaps make a minor change to ramda-fantasy to make ramda a peerDependencies instead of dependencies? As is, ramda-fantasy essentially relies on bespoke to deduping to not include ramda twice, whereas by listing ramda as a peerDependency, the deduping intention would be explicit.

Neither of these are deal breakers, and it works as is, but the second point would improve performance for example.

@tolmasky:
I can't see that it would hurt to change it to a peer dependency.  But I should do a little reading first.
I would probably stick with the ramda-fantasy version for now.  Most of the Maybe/Either usages we have have been tested with that repo, and they are very simple.  It should be easy to change to it later.

On a side note, I'm wondering if you've seen any integrations of RunKit with https://tiddlywiki.com/?  I'm working on another project, which I was thinking of documenting with TiddlyWiki, but would love to have runnable snippets.  I haven't done any research on this, so there may be an obvious answer somewhere.  But if you have seen it, could you let me know?

OK, I have filed a pull request to support this: https://github.com/ramda/ramda.github.io/pull/228
@CrossEye I'll take a look at the tiddlywiki thing.

@tolmasky:
Thank you.  I will take a look at the PR this weekend.
Please don't worry much about TiddlyWiki.  I was hoping that you might have already seen such an integration.  If not, it's not a big deal.  If and when I get to that stage, I'll start looking.

Hi @MattMS and @Jeff-Tian, this should be live on the site now, so I think we can close if we can confirm it works the way you'd like now?

Cool! Love it and thanks a ton.

Closing since related pull request has been merged.

authors: CrossEye Jeff-Tian MattMS adispring arcseldon buzzdecafe customcommander dalgard davidchambers raine tolmasky

repo: ramda/ramda


text:
add R.containsBy

See #1349
R.containsWith is usually used in conjunction with a function such as (a, b) => a.x === b.x or (a, b) => f(a) === f(b) (occurrences on GitHub). R.containsBy would be more convenient in such cases.
In the rare cases where the symmetry of R.containsBy is undesirable, one can always use R.any. It's thus unnecessary to retain R.containsWith.

I have always found containsWith very confusing. This is perhaps somewhat better but what I would have expected is something like this (a -> Boolean) -> [a] -> Boolean. I.e. the first argument is a predicate function. If it returns true for any element in the list then this function returns true, otherwise false.

This is perhaps somewhat better but what I would have expected is something like this (a -> Boolean) -> [a] -> Boolean. I.e. the first argument is a predicate function. If it returns true for any element in the list then this function returns true, otherwise false.

You're precisely defined R.any. ;)
I'm happy to deprecate R.containsWith without introducing R.containsBy. I'm eager to remove a confusing function, and I'm willing to add R.containsBy if necessary to achieve this.

You're precisely defined R.any. ;)

Oh, didn't realize that. Must be because I want to use contains with a twist and I have naturally been searching for a similarly named function. Thanks

:herb:

It seems we're comfortable deprecating R.containsWith. The question is whether R.containsBy is actually a useful addition. Can anyone think of a situation in which it's more convenient than R.any?

If we only had R.any then all usage of containsBy would need to be changed from:
R.containsBy(someFn, someValue)

to
R.any(R.compose(R.eq(someValue), someFn))

Idk. I think these two cases look very weird and would certainly not miss it. I think this (and other functions) should only be added from a real need users of ramda feel that they have.

I think this […] should only be added from a real need users of ramda feel that they have.

I agree. I suggest we open a separate pull request simply to deprecate R.containsWith. We can then close this pull request. If in the future a need for R.containsBy arises, we'll know where to look for an implementation. :)

We'll revisit this if there is demand for R.containsBy.

authors: CrossEye TheLudd davidchambers


text:
integrate doctest

This pull request replaces our custom doctest runner with a dependency on doctest, and tweaks the formatting of the doctests accordingly.
Before:
2 * 3 * 7  //=> 42

After:
> 2 * 3 * 7
42

The plus side of this is large: not having a custom component like this to maintain, depending instead on a presumably more battle-tested solution, is clearly a big advantage.
But there is a real downside as well to my mind.  One significant advantage of our current test code is that it's easy to cut and paste into the console.  The idea is that it's runnable as is.  The doctest version makes that much harder, with no compensating advantages I can see for the user.
This definitely seems easier for someone to paste into a REPL/console/editor:
R.prop('x', {x: 100}); //=> 100
R.prop('x', {}); //=> undefined

than this:
> R.prop('x', {x: 100})
100
> R.prop('x', {})
undefined

Of course to me, the whole notion of running the examples took a while to accept.  It wasn't until one day I had a sudden realization that these were not in any way unit tests but were instead some form of documentation verification that it finally sunk in for me.  So maybe my understanding isn't really complete.
I'm hesitant to object, because clearly @davidchambers put a lot of work into this and I really would rather use a ready-made tool than a home-grown one we have to maintain.  But my objection is real.  So David, any chance doctest is looking to support another format?  :smile:

One significant advantage of our current test code is that it's easy to cut and paste into the console.

Doctests depict a REPL session. Well-written doctests depict the REPL session of a user familiarizing herself with the function in question, checking the output for the common case then various edge cases. Doctests can provide the benefit of an exploratory REPL session without the context switching.
Elsewhere in your comment you mention pasting doctests into a text editor. This is something one may wish to do, in order to tweak the code then observe the change in output. This is undoubtedly less convenient in the new format.
On the other hand one can copy doctests from the REPL, so the new format is more convenient for authors.
The fact that I've put a lot of work into this pull request shouldn't affect our decision as to whether to accept it. It should be merged or closed on its merits. :)

Elsewhere in your comment you mention pasting doctests into a text editor. This is something one may wish to do, in order to tweak the code then observe the change in output. This is undoubtedly less convenient in the new format.

Just glanced briefly, but it looks like this might be as easy as looking for every line that starts with > , removing that opening, and throwing a ; on the end. You could put a "Copy" button on the examples on http://ramda.github.io/ramdocs which does the simple reformatting and shows a textarea with the new editor friendly code selected for easy copy/paste.

Even better, @kedashoe, would be to apply this transformation at build time. That way documentation generated from the doctests could be in a copy-friendly format.

Even better, @kedashoe, would be to apply this transformation at build time.

That works both ways, though.  If the output format is not important to you @davidchambers, but only the format to use for testing the examples, then I would suggest that it might be best to do the conversion only on the way in to doctest.

authors: CrossEye davidchambers kedashoe


text:
UuidBinaryOrderedTimeType: configure UuidFactory

What's the supposed way of configuring UuidFactory in UuidBinaryOrderedTimeType? Unless I'm missing something, seems like the only way to do this is to copy-paste the whole class modifying uuidFactory init (because getUuidFactory is private).
More specifically, I'd like to be able to provide a different implementation of NodeProviderInterface (a cached SystemNodeProvider)

Take a look at the examples here and see if they help answer your question. If not, let me know; share some example code, and I'll try to help simplify it so you don't have to subclassUuidFactory.
https://github.com/ramsey/uuid/wiki/Ramsey\Uuid-Cookbook

Apparently I was a bit lost in various UuidFactory's scattered :) and wasn't looking at the code that actually generates uuids, but rather at  UuidBinaryOrderedTimeType (which only converts into binary representation).
Taking a closer look I think I was able to accomplish what was needed - though I'm not sure in the most appropriate way. Here is some draft code:
$cachedNodeProvider = new class(new \Ramsey\Uuid\Provider\Node\SystemNodeProvider) implements \Ramsey\Uuid\Provider\NodeProviderInterface {
    private $originalProvider;
    public function __construct(\Ramsey\Uuid\Provider\Node\SystemNodeProvider $originalProvider)
    {
        $this->originalProvider = $originalProvider;
    }

    public function getNode()
    {
        if (false !== ($node = apcu_fetch('uuid_node'))) {
            return $node;
        }
        $node = $this->originalProvider->getNode();
        apcu_store('uuid_node', $node);
        return $node;
    }
};
$uuidFactory = new \Ramsey\Uuid\UuidFactory();
$uuidFactory->setTimeGenerator(new \Ramsey\Uuid\Generator\DefaultTimeGenerator(
    $cachedNodeProvider,
    new \Ramsey\Uuid\Converter\Time\PhpTimeConverter,
    new \Ramsey\Uuid\Provider\Time\SystemTimeProvider
));
\Ramsey\Uuid\Uuid::setFactory($uuidFactory);

Accompanied by a custom generator (as Ramsey\Uuid\Doctrine\UuidOrderedTimeGenerator does not use the global UuidFactory instance - I wonder why?)
class DoctrineUuidOrderedTimeGenerator extends AbstractIdGenerator
{
    /**
     * @var \Ramsey\Uuid\UuidFactory
     */
    protected $factory;

    public function __construct()
    {
        $this->factory = \Ramsey\Uuid\Uuid::getFactory();

.... equal to original UuidOrderedTimeGenerator

Thanks

When you call \Ramsey\Uuid\Uuid::getFactory();, it should be using the "global" factory that's been statically set on Uuid. Are you setting it before DoctrineUuidOrderedTimeGenerator gets instantiated?

When you call \Ramsey\Uuid\Uuid::getFactory();, it should be using the "global" factory that's been statically set on Uuid

It does. But this is the modified generator; the original just instantiates the fresh factory: https://github.com/ramsey/uuid-doctrine/blob/master/src/UuidOrderedTimeGenerator.php#L18

I see what you mean. There's probably a good argument here for using dependency injection here (passing in a factory) or for calling Uuid::getFactory() inside the UuidOrderedTimeGenerator instead of using new.

There's probably a good argument here for using dependency injection here

That's what I thought as well - unfortunately, the orm does not seem to allow this forcefully newing the passed-in generator class, see: https://github.com/doctrine/doctrine2/blob/24377156b41a5fca37b26579c28f824f779d41ef/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php#L710
and https://github.com/doctrine/doctrine2/issues/5660
This leaves the only choice of invoking Uuid::getFactory() in constructor - I'd submit a pull-request with this.

Thanks for contributing. Your changes are in version 1.4.1.

authors: ramsey sserbin

repo: ramsey/uuid-doctrine


text:
you must be crazy to force ppl to install linux in windows to use sd pal

Why would anyone want to do that ?
Your feature set is good but regular gui that runs in the browser would be nice

Well, no one is forcing anyone to do anything, it's available and it's free!
The only reason that it requires WSL is to be able to use some dependencies that don't support Windows.
Anyway, any constructive criticism is welcomed.


text:
Have not implemented fetching 'earnings' from Yahoo API

Describe bug
Hello,
I am trying to get the earning data from a single company ticker, but this does not seem to be implemented?
I have seen some code examples making use of the function, so I presume it was removed at some point after a Yahoo API change or something similar.
I could not find another issue regarding this. Does any know when this would be implemented, or if there is a possible workaround or alternative to it?
Simple code that reproduces your problem
import yfinance as yf
ticker = yf.Ticker("MSFT")
ticker.get_earnings(freq="quarterly")
Debug log
Have not implemented fetching 'earnings' from Yahoo API
Stack trace:

File "...\FiancialNN.py", line 7, in  (Current frame)
ticker.get_earnings(freq="quarterly")
yfinance.exceptions.YFNotImplementedError: Have not implemented fetching 'earnings' from Yahoo API
Loaded 'yfinance.scrapers.fundamentals'
Loaded 'yfinance.base'
Loaded 'main'
Loaded 'runpy'

yfinance version
0.2.36
Python version
3.11.7
Operating system
No response

Duplicate #1737

repo: ranaroussi/yfinance


text:
arm64: disable manifest creation

Currently no version of luet-mtree is published for arm64 so ci cant
install.
Manually removed so we can regenerate the workflows afterwards
Signed-off-by: Itxaka igarcia@suse.com

@mudler force-pushing this, job was green on the build part

repo: rancher-sandbox/cOS-toolkit


text:
Restoring a backup from local file

Hi,
So I am trying to understand how to do a restore in Rancher and tried to follow the documentation found here: https://rancher.com/docs/rancher/v2.6/en/backups/migrating-rancher/
The problem is that the documentation gives examples with s3/minio but not with local path so I am a bit lost how what do to and I have to admit that I just learning...
So, I have my backup file on one of the node, I am trying to create a file:
[root@node-1 ~]# cat create-deflocation-restore.yaml
apiVersion: resources.cattle.io/v1
kind: Restore
metadata:
  name: restore-pvc-demo
spec:
  backupFilename: daily-4a197c6b-2cff-4dae-bc12-c75a4c72c5f1-2022-05-22T00-00-00Z.tar.gz

So the daily-4a197c6b-2cff-4dae-bc12-c75a4c72c5f1-2022-05-22T00-00-00Z.tar.gz is my backup file.
Of course it is not working:
[root@node-1 ~]# kubectl describe restore restore-pvc-demo
Name:         restore-pvc-demo
Namespace:
Labels:       <none>
Annotations:  <none>
API Version:  resources.cattle.io/v1
Kind:         Restore
Metadata:
  Creation Timestamp:  2022-05-29T00:46:29Z
  Generation:          1
  Managed Fields:
    API Version:  resources.cattle.io/v1
    Fields Type:  FieldsV1
    fieldsV1:
      f:spec:
        f:prune:
        f:storageLocation:
      f:status:
        .:
        f:backupSource:
        f:conditions:
        f:observedGeneration:
        f:restoreCompletionTs:
        f:summary:
    Manager:      backup-restore-operator
    Operation:    Update
    Time:         2022-05-29T00:46:29Z
    API Version:  resources.cattle.io/v1
    Fields Type:  FieldsV1
    fieldsV1:
      f:metadata:
        f:annotations:
          .:
          f:kubectl.kubernetes.io/last-applied-configuration:
      f:spec:
        .:
        f:backupFilename:
    Manager:         kubectl-client-side-apply
    Operation:       Update
    Time:            2022-05-29T00:46:29Z
  Resource Version:  277308
  UID:               14a841f1-0c68-40eb-82f9-28db9fe478a0
Spec:
  Backup Filename:  daily-4a197c6b-2cff-4dae-bc12-c75a4c72c5f1-2022-05-22T00-00-00Z.tar.gz
Status:
  Backup Source:
  Conditions:
    Last Update Time:     2022-05-29T00:46:29Z
    Message:              Backup location not specified on the restore CR, and not configured at the operator level
    Reason:               Error
    Status:               False
    Type:                 Reconciling
    Last Update Time:     2022-05-29T00:46:29Z
    Message:              Retrying
    Status:               Unknown
    Type:                 Ready
  Observed Generation:    0
  Restore Completion Ts:
  Summary:
Events:                   <none>

So I think I need to configure the volume/claim on the operator level (not sure) so the restore job know how to connect to it and get the file.
But I have not real clue on how to do this...
I guess the steps are:

Create a PV and PVC in kubernetes (ex: https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/)
Modifty the backup operator to use it (I see this https://rancher.com/docs/rancher/v2.6/en/backups/configuration/storage-config/ but I have no clue at all how to use helm with custom values and what to put there)
bonus: add a node selector so I can choose where the backup will pick the file from the PVC
Appy the restore job.

Can you assist my with those steps please? I am pretty sure this will help other users and also make the documentation even more usefull.
Thanks!

So here I am from my investigations.
We have those storageclass avaiable:
[root@node-1 ~]# kubectl get storageclasses.storage.k8s.io
NAME                   PROVISIONER                    RECLAIMPOLICY   VOLUMEBINDINGMODE      ALLOWVOLUMEEXPANSION   AGE
local-path (default)   rancher.io/local-path          Delete          WaitForFirstConsumer   false                  24h
longhorn (default)     driver.longhorn.io             Delete          Immediate              true                   20h

I ma using longhorn and local-path could be good but I was not sure how to use this, so I created a local one like this:
[root@node-1 ~]# cat local-storageclass.yaml
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: local-storage
provisioner: kubernetes.io/no-provisioner
volumeBindingMode: Immediate

So
[root@node-1 ~]# kubectl get storageclasses.storage.k8s.io
NAME                   PROVISIONER                    RECLAIMPOLICY   VOLUMEBINDINGMODE      ALLOWVOLUMEEXPANSION   AGE
local-path (default)   rancher.io/local-path          Delete          WaitForFirstConsumer   false                  24h
local-storage          kubernetes.io/no-provisioner   Delete          Immediate              false                  63m
longhorn (default)     driver.longhorn.io             Delete          Immediate              true                   20h

Now let's create the volume and the volume claim
[root@node-1 ~]# cat pv-volume.yaml
apiVersion: v1
kind: PersistentVolume
metadata:
  name: task-pv-volume
  labels:
    type: local
spec:
  storageClassName: local-storage
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: "/backup"
  nodeAffinity:
    required:
      nodeSelectorTerms:
        - matchExpressions:
          - key: kubernetes.io/hostname
            operator: In
            values:
            - node1

I have set a node affinity so I can set the mount where I want (seems logic to me but could be totally stupid and in fact lead me to some issues after)
[root@node-1 ~]# cat pv-claim.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: task-pv-claim
spec:
  storageClassName: local-storage
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 3Gi

So:
[root@node-1 ~]# kubectl get persistentvolumes
NAME             CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS     CLAIM                                      STORAGECLASS    REASON   AGE
backup           10Gi       RWO            Retain           Released   cattle-resources-system/rancher-backup-1                            18h
task-pv-volume   10Gi       RWO            Retain           Bound      default/task-pv-claim                      local-storage            62m
[root@node-1 ~]# kubectl get persistentvolumeclaims
NAME            STATUS   VOLUME           CAPACITY   ACCESS MODES   STORAGECLASS    AGE
task-pv-claim   Bound    task-pv-volume   10Gi       RWO            local-storage   62m

After reading a little more on the backup restore operator, it seems that I have to defined when I install the operator the volume location (again I could be wrong...) I want to use this option (which is my case because my backup files are local)
So I read tis: https://rancher.com/docs/rancher/v2.6/en/backups/configuration/storage-config/#existing-persistent-volume
Seems that I have to deplou the bckup restore operator with custom values. Fine.
I took the template found on the web page above and set volumeName to task-pv-claim.
then execute:
[root@node-1 ~]# helm install rancher-backup rancher-charts/rancher-backup -n cattle-resources-system --version 2.1.2 -f values.yaml
but the pod fail with:
  Events:
  Type     Reason     Age               From               Message
  ----     ------     ----              ----               -------
  Normal   Scheduled  17s               default-scheduler  Successfully assigned cattle-resources-system/rancher-backup-cb4f7564d-w4rw7 to worker-3
  Warning  Failed     16s               kubelet            Failed to pull image "rancher/rancher-backup:v2.1.2": rpc error: code = Unknown desc = failed to pull and unpack image "docker.io/rancher/rancher-backup:v2.1.2": failed to resolve reference "docker.io/rancher/rancher-backup:v2.1.2": pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed
  Warning  Failed     16s               kubelet            Error: ErrImagePull
  Normal   BackOff    15s               kubelet            Back-off pulling image "rancher/rancher-backup:v2.1.2"
  Warning  Failed     15s               kubelet            Error: ImagePullBackOff
  Normal   Pulling    0s (x2 over 16s)  kubelet            Pulling image "rancher/rancher-backup:v2.1.2"

Found that the template on the web page could be wrong:
Instead of:
image:
  repository: rancher/rancher-backup
  tag: v0.0.1-rc10

I use:
image:
  repository: rancher/backup-restore-operator

and now the pod is working correctly.
So, I recreate the restore job but still got issue:
[root@node-1 ~]# kubectl get Restore
NAME               BACKUP-SOURCE   BACKUP-FILE                                                              AGE   STATUS
restore-pvc-demo                   daily-4a197c6b-2cff-4dae-bc12-c75a4c72c5f1-2022-05-22T00-00-00Z.tar.gz   49m   Retrying

[root@node-1 ~]# kubectl describe Restore
..
Spec:
  Backup Filename:  daily-4a197c6b-2cff-4dae-bc12-c75a4c72c5f1-2022-05-22T00-00-00Z.tar.gz
Status:
  Backup Source:
  Conditions:
    Last Update Time:     2022-05-29T15:05:25Z
    Message:              Backup location not specified on the restore CR, and not configured at the operator level

So at that point I am not sure that I have done wrong..
Maybe because the backup restore pod is running on another worker node...
[root@node-1 ~]# kubectl describe pod/rancher-backup-74779d9dfd-fdndh -n cattle-resources-system
Name:         rancher-backup-74779d9dfd-fdndh
Namespace:    cattle-resources-system
Priority:     0
Node:         worker-3/192.168.2.105
Start Time:   Sun, 29 May 2022 11:13:05 -0400
Labels:       app.kubernetes.io/instance=rancher-backup
              app.kubernetes.io/name=rancher-backup
              pod-template-hash=74779d9dfd
              resources.cattle.io/operator=backup-restore
Annotations:  checksum/pvc: 01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b
              checksum/s3: 01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b
Status:       Running
IP:           10.42.5.53
IPs:
  IP:           10.42.5.53
Controlled By:  ReplicaSet/rancher-backup-74779d9dfd
Containers:
  rancher-backup:
    Container ID:   containerd://4404353cda78995dcb2aeef1c8b75d623cd5a99c136db07659edb1242b70a4fe
    Image:          rancher/backup-restore-operator:v2.1.2
    Image ID:       docker.io/rancher/backup-restore-operator@sha256:acbb9ae36580b53ec87a953a18a98e0b0bc0bcefe2100850dee7c66f8a978169
    Port:           <none>
    Host Port:      <none>
    State:          Running
      Started:      Sun, 29 May 2022 11:13:06 -0400
    Ready:          True
    Restart Count:  0
    Environment:
      CHART_NAMESPACE:  cattle-resources-system
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from rancher-backup-token-8f7p9 (ro)
Conditions:
  Type              Status
  Initialized       True
  Ready             True
  ContainersReady   True
  PodScheduled      True
Volumes:
  rancher-backup-token-8f7p9:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  rancher-backup-token-8f7p9
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  kubernetes.io/os=linux
Tolerations:     cattle.io/os=linux:NoSchedule
                 node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                 node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type    Reason     Age   From               Message
  ----    ------     ----  ----               -------
  Normal  Scheduled  34m   default-scheduler  Successfully assigned cattle-resources-system/rancher-backup-74779d9dfd-fdndh to worker-3
  Normal  Pulling    34m   kubelet            Pulling image "rancher/backup-restore-operator:v2.1.2"
  Normal  Pulled     34m   kubelet            Successfully pulled image "rancher/backup-restore-operator:v2.1.2" in 326.073136ms
  Normal  Created    34m   kubelet            Created container rancher-backup
  Normal  Started    34m   kubelet            Started container rancher-backup

Not sure.. I will try to continur to investigate but any help will be more than welcome.

Ok I may have made a mistake for the custom values for my volume
I now use:
image:
  repository: rancher/rancher-backup
  #tag: v0.0.1-rc10
  #tag: latest
  #tag: v2.1.2

## Default s3 bucket for storing all backup files created by the rancher-backup operator
s3:
  enabled: false
  ## credentialSecretName if set, should be the name of the Secret containing AWS credentials.
  ## To use IAM Role, don't set this field
  credentialSecretName: creds
  credentialSecretNamespace: ""
  region: us-west-2
  bucketName: rancherbackups
  folder: base folder
  endpoint: s3.us-west-2.amazonaws.com
  endpointCA: base64 encoded CA cert
  # insecureTLSSkipVerify: optional

## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/
## If persistence is enabled, operator will create a PVC with mountPath /var/lib/backups
persistence:
  enabled: false

  ## If defined, storageClassName: <storageClass>
  ## If set to "-", storageClassName: "", which disables dynamic provisioning
  ## If undefined (the default) or set to null, no storageClassName spec is
  ##   set, choosing the default provisioner.  (gp2 on AWS, standard on
  ##   GKE, AWS & OpenStack).
  ## Refer to https://kubernetes.io/orage/persistentdocs/concepts/st-volumes/#class-1
  ##
  storageClass: "-"

  ## If you want to disable dynamic provisioning by setting storageClass to "-" above,
  ## and want to target a particular PV, provide name of the target volume
  volumeName: "task-pv-claim"

  ## Only certain StorageClasses allow resizing PVs; Refer to https://kubernetes.io/blog/2018/07/12/resizing-persistent-volumes-using-kubernetes/
  size: 2Gi

global:
  cattle:
    systemDefaultRegistry: ""

nodeSelector: {}

tolerations: []

affinity: {}

and then
helm install rancher-backup-crd rancher-charts/rancher-backup-crd -n cattle-resources-system --create-namespace --version 2.1.2 -f values.yaml
helm install rancher-backup rancher-charts/rancher-backup -n cattle-resources-system --version 2.1.2

Still got his:
[root@node-1 ~]# kubectl describe Restore
Name:         restore-pvc-demo
Namespace:
Labels:       <none>
Annotations:  <none>
API Version:  resources.cattle.io/v1
Kind:         Restore
Metadata:
  Creation Timestamp:  2022-05-29T16:20:46Z
  Generation:          1
  Managed Fields:
    API Version:  resources.cattle.io/v1
    Fields Type:  FieldsV1
    fieldsV1:
      f:spec:
        f:prune:
        f:storageLocation:
      f:status:
        .:
        f:backupSource:
        f:conditions:
        f:observedGeneration:
        f:restoreCompletionTs:
        f:summary:
    Manager:      backup-restore-operator
    Operation:    Update
    Time:         2022-05-29T16:20:46Z
    API Version:  resources.cattle.io/v1
    Fields Type:  FieldsV1
    fieldsV1:
      f:metadata:
        f:annotations:
          .:
          f:kubectl.kubernetes.io/last-applied-configuration:
      f:spec:
        .:
        f:backupFilename:
    Manager:         kubectl-client-side-apply
    Operation:       Update
    Time:            2022-05-29T16:20:46Z
  Resource Version:  654441
  UID:               4095284c-38e7-45b6-b7f0-c18d0e6bcf44
Spec:
  Backup Filename:  daily-4a197c6b-2cff-4dae-bc12-c75a4c72c5f1-2022-05-22T00-00-00Z.tar.gz
Status:
  Backup Source:
  Conditions:
    Last Update Time:     2022-05-29T16:20:46Z
    Message:              Backup location not specified on the restore CR, and not configured at the operator level
    Reason:               Error
    Status:               False
    Type:                 Reconciling
    Last Update Time:     2022-05-29T16:20:46Z
    Message:              Retrying
    Status:               Unknown
    Type:                 Ready
  Observed Generation:    0
  Restore Completion Ts:
  Summary:
Events:                   <none>

So maybe I am wrong.. maybe a custom section in the https://rancher.com/docs/rancher/v2.6/en/backups/configuration/storage-config/#example-values-yaml-for-the-rancher-backup-helm-chart is needed..
Like in this example, the storage is s3, but i need a local storage instead but I have no ideas on how to define this in this yaml file...

Hi,
Thanks for those useful infos, very appreciated :) I have tried to work on it yesterday but not yet been able to make it work. I will do another attempt today for sure.

Ok found it!
[root@node-1 ~]# cat migrationResource.yaml
# migrationResource.yaml
apiVersion: resources.cattle.io/v1
kind: Restore
metadata:
  name: restore-migration
spec:
  backupFilename: daily-4a197c6b-2cff-4dae-bc12-c75a4c72c5f1-2022-05-22T00-00-00Z.tar.gz
  prune: false

And then
[root@node-1 ~]# kubectl apply -f migrationResource.yaml
After checking the logs using:
kubectl -n cattle-resources-system exec deploy/rancher-backup -- ls /var/lib/backups
I see this:
INFO[2022/06/01 18:53:56] restoreResource: Restoring library-nfs-provisioner-0.1.2 of type management.cattle.io/v3, Resource=catalogtemplateversions
INFO[2022/06/01 18:53:56] restoreResource: Namespace cattle-global-data for name library-nfs-provisioner-0.1.2 of type management.cattle.io/v3, Resource=catalogtemplateversions
INFO[2022/06/01 18:53:56] Getting new UID for library-nfs-provisioner
INFO[2022/06/01 18:53:56] restoreResource: Restoring library-nfs-provisioner-0.2.2 of type management.cattle.io/v3, Resource=catalogtemplateversions
INFO[2022/06/01 18:53:56] restoreResource: Namespace cattle-global-data for name library-nfs-provisioner-0.2.2 of type management.cattle.io/v3, Resource=catalogtemplateversions
INFO[2022/06/01 18:53:56] Getting new UID for library-nfs-provisioner
INFO[2022/06/01 18:53:56] restoreResource: Restoring library-prometheus-9.1.0 of type management.cattle.io/v3, Resource=catalogtemplateversions
INFO[2022/06/01 18:53:56] restoreResource: Namespace cattle-global-data for name library-prometheus-9.1.0 of type management.cattle.io/v3, Resource=catalogtemplateversions
INFO[2022/06/01 18:53:56] Getting new UID for library-prometheus
INFO[2022/06/01 18:53:56] restoreResource: Restoring library-prometheus-6.2.1 of type management.cattle.io/v3, Resource=catalogtemplateversions
INFO[2022/06/01 18:53:56] restoreResource: Namespace cattle-global-data for name library-prometheus-6.2.1 of type management.cattle.io/v3, Resource=catalogtemplateversions
INFO[2022/06/01 18:53:56] Getting new UID for library-prometheus
INFO[2022/06/01 18:53:56] Processing controllerRef apps/v1/deployments/rancher
WARN[2022/06/01 18:53:56] Error getting object for controllerRef rancher, skipping it
INFO[2022/06/01 18:53:57] Done restoring

Sp far so good then, time to go with the next steps

So, I have followed the steps in https://rancher.com/docs/rancher/v2.6/en/backups/migrating-rancher/

reinstalled the cert-manager
reinstalled rancher using the same vresion as before

But.. either I am doing something wrong of either I have created my backup not correctly the first time but... even if I can access rancher now, all my deployments are gone...
That's pretty weird, I will try to dig in my old backups and see if it is the same situation after a restore... or maybe I have done something wrong?

I guess the expectation might be wrong here, by default, it backs up and restores Rancher, not everything. The default set of resources that is being backed up can be found here: https://github.com/rancher/backup-restore-operator/tree/master/charts/rancher-backup/files/default-resourceset-contents
If there are resources that match this selection and are not backed up, please share what exactly you are missing.

Oh. So the backup apps in rancher does not backup the workloads definitions, and custom storage definition, kind of thing then?
That's make more sense now even if I am a little surprised to be honest :)
So I guess the ticket can be closed since I have the current process now to restore rancher from the backup file.
I have 2 concerns/comments:

The documentation to backup and to do a migration of rancher on another cluster does not mention anywhere what are the restrictions of the backup. Maybe could be cool to add this somewhere so people will not count only on this backup strategy to get the workloads backups
if the current backup app does not backup workloads and storage definition (for ex) what should we do to backup this? Rely on etcd backup? or is there other way to deal with this part of the backup strategy?
Thanks for any comments.

Can you share where you would like to have more information added? On https://rancher.com/docs/rancher/v2.6/en/backups/, it says:
The rancher-backup operator is used to backup and restore Rancher on any Kubernetes cluster. This application is a Helm chart, and it can be deployed through the Rancher Apps & Marketplace page, or by using the Helm CLI. The rancher-backup Helm chart is [here.](https://github.com/rancher/charts/tree/release-v2.6/charts/rancher-backup)

The backup-restore operator needs to be installed in the local cluster, and only backs up the Rancher app. The backup and restore operations are performed only in the local Kubernetes cluster.

Regarding backing up other resources, there are quite a few ways to do this, all with different approaches and strategies. The operator was created to backup/restore Rancher + migrating Rancher to a different set of nodes. One approach would be that all the other resources that you want to deploy, are in any automation of your choice and you deploy them after the restore of Rancher has been finished (ansible/terraform etc). This would be the recommended path.
If you really want to backup other resources, you could add your own resourcesets and specify what needs to be included in the backup (currently this is scoped to Rancher only) and that's why you don't see any non Rancher resources. I'd have to check to see how this done through the current Helm chart.

@rpelissi Let me know if you need anything else on this.

Hi! Sorry sorry I have been busy with other stuff :)
So In fact I am disapointed not because of the tool but because I have not read correctly the documentation that in fact mention that the resources taken in the backup does not contains workload definitions for ex :) So it's my entire fault!
Now, I still not sure about a DRP plan for that, I mean we have this:

rancher backup
etcd backup

Let say that we lost all our ranchers infra but we still got the backup files for the 2 components listed above, can I:

Restore the rancher backup
Restore etcd
And have my workloads and all components working again (As long as I installed the same way) ?

That's my question.
Also, if we can have an example on how we can add custom resource to the rancher backup, that could be cool too! :)
Thanks!

authors: rpelissi superseb

repo: rancher/backup-restore-operator


text:
ec2 RKE1 cloud provider upgrade warning banner stays when version change is reverted

When upgrading ec2 rke1 clusters to k8s >=1.27, if the cloud provider was aws in-tree the ui changes it to external-aws and shows a warning banner. If the user switches the k8s version back to <1.27, the cloud provider is changed back to aws in-tree, but the banner stays:
https://github.com/rancher/dashboard/assets/42977925/8b05cb13-0571-4cd8-bbf1-bcb92916f7bc

PR to fix this is here: https://github.com/rancher/ui/pull/5105

/backport v2.8.next1

/backport v2.7.next1

/backport v2.8.next1

No longer reproducible as the version v2.9-3ae1c6ac8d3524f8ded4544f1db75fc9e07911a5-head no longer supports kubernetes version lower than 1.27 for RKE1 AWS cluster provisioning

authors: IsaSih gaktive mantis-toboggan-md

repo: rancher/dashboard


text:
Compare against both base-version and base@version

Summary
I am investigating the possibility of integrating https://github.com/semantic-release/semantic-release tool to automate versioning of https://github.com/StackVista/rancher-extension-stackstate and for that matter I wish I can use changeset tag command but the caveat is that it formats the tag as name@version and not name-version as required by the workflow.
I'd like to propose a change to match both tag formats, it should not hurt to have them simultaneously.

Occurred changes and/or fixed issues

Technical notes summary

Areas or cases that should be tested

Areas which could experience regressions

Screenshot/Video

Checklist

[ ] The PR is linked to an issue and the linked issue has a Milestone, or no issue is needed
[ ] The PR has a Milestone
[x] The PR template has been filled out
[x] The PR has been self reviewed
[ ] The PR has a reviewer assigned
[ ] The PR has automated tests or clear instructions for manual tests and the linked issue has appropriate QA labels, or tests are not needed
[ ] The PR has reviewed with UX and tested in light and dark mode, or there are no UX changes

Not needed anymore https://github.com/StackVista/rancher-extension-stackstate/pull/41#discussion_r1827761210


text:
UI - Finish the custom cloud config test in machine registration

This one should have been done in https://github.com/rancher/elemental/issues/196 but a bug was discovered regarding cloud config.
Once the bug fixed, we will be able to finish this test.

I tried to use the cloud config field but there is a syntax error within the cloud config block. After talking with dev, it will be fixed by https://github.com/rancher/elemental-ui/pull/26

Now we can use cloud config, I can remove usage of the machineregistration.yaml file (https://github.com/rancher/elemental/blob/main/tests/assets/machineregistration.yaml) and directly create my own file through the UI.

repo: rancher/elemental


text:
k3s server --data-dir not working correctly

Version:
v1.0.0
Describe the bug
move from k3s server from a VM to another copying  /var/lib/rancher/k3s to /data/k3s
then deploy k3s using --data-dir /data/k3s but k3s crash on start  because is trying to find files in /var/lib/rancher/k3s
Dec 31 13:19:23 neries-master k3s[14705]: time="2019-12-31T13:19:23.226094778Z" level=fatal msg="starting kubernetes: invalid configuration: [unable to read client-cert /var/lib/rancher/k3s/server/tls/client-admin.crt for user due to open /var/lib/rancher/k3s/server/tls/client-admin.crt: no such file or directory, unable to read client-key /var/lib/rancher/k3s/server/tls/client-admin.key for user due to open /var/lib/rancher/k3s/server/tls/client-admin.key: no such file or directory, unable to read certificate-authority /var/lib/rancher/k3s/server/tls/server-ca.crt for local due to open /var/lib/rancher/k3s/server/tls/server-ca.crt: no such file or directory]"

@segator you will probably want to setup a symlink from /var/lib/rancher/k3s to /data/k3s because there are a number of kubeconfigs and other persistent state files that save absolute paths prefixed with the data directory.

then --data-dir it's not working correctly, should be fixed

Same issue in k3s agent

Same issue in k3s agent

my fault.
$ curl -sfL https://get.k3s.io | INSTALL_K3S_CHANNEL=latest K3S_URL=https://xxxx:6443 K3S_TOKEN=TOKEN INSTALL_K3S_CHANNEL=latest sh -s - agent --data-dir=/opt/docker/rancher/k3s/
$ sudo systemctl restart k3s-agent.service

solved my issue

authors: AnnatarHe dweomer segator


text:
ROS ISO - Hosts unable to reach each other within environment.

RancherOS Version: (ros os version)
1.4 ( https://storage.googleapis.com/ros-images/rancheros-mud-2.iso)
Where are you running RancherOS? (docker-machine, AWS, GCE, baremetal, etc.)
vSphere
Created independent ROS instance with listed ISO running 1.6 rancher.
Created separate ROS host with 4 OUD, all OUD on same  user-defined network. (system-docker network create --subnet=172.20.0.0/16 dind)
Added 2 OUD to default environment.
Added 2 OUD to second environment.
Hosts/Containers are unable to reach each other inside the same environments.

Hosts were able to reach other. I just pulled the trigger on this too early.

repo: rancher/os


text:
dhcpcd overwrites resolv.conf when releasing a lease

Signed-off-by: Sven Dowideit SvenDowideit@home.org.au

backported to 1.0.5_ #2110


text:
In a cluster, should not give muti-permissions to the same user

Rancher versions:
rancher/server or rancher/rancher:v2.1.0-rc4
Results:

This is by design.
@vincent99 please correct me if I am wrong

That particular example is not very useful since those roles contain mostly the same permissions, but yes a user can intentionally have multiple roles.  Even if that were restricted, a user can still have multiple roles because they can be a member of multiple groups which have a role (or multiple) in the cluster.
RBAC is strictly additive.  The user gets the union of all the permissions granted by all the role bindings applicable to them.

authors: dongjuanwinhong loganhz vincent99

repo: rancher/rancher


text:
Tiller crashes when downgrading while upgrading

Hey there,
I just had the following problem: I wanted to upgrade a package installed via ranchers catalogs. This package had an error which stopped it from updating. So I decided to roll it back. However, this doesn't work. In the rancher logs I found out that actually tiller is crashing now b/c it can't receive the history.
[main] 2019/06/25 13:45:20 Starting Tiller v2.10+unreleased (tls=false)

[main] 2019/06/25 13:45:20 GRPC listening on :35775

[main] 2019/06/25 13:45:20 Probes listening on :39968

[main] 2019/06/25 13:45:20 Storage driver is ConfigMap

[main] 2019/06/25 13:45:20 Max history per release is 1

[tiller] 2019/06/25 13:45:21 getting history for release gitlab

[storage] 2019/06/25 13:45:21 getting release history for "gitlab"

[tiller] 2019/06/25 13:45:21 preparing update for gitlab

[storage] 2019/06/25 13:45:21 getting deployed releases from "gitlab" history

[storage] 2019/06/25 13:45:21 getting last revision of "gitlab"

[storage] 2019/06/25 13:45:21 getting release history for "gitlab"

[storage] 2019/06/25 13:45:21 getting release history for "gitlab"

panic: runtime error: invalid memory address or nil pointer dereference

[signal SIGSEGV: segmentation violation code=0x1 addr=0x50 pc=0x12e8cc8]

The worst thing about this is, the deployment is stuck and you can't upgrade or do anything with it anymore now.

I could work around, by manually creating and copying the latest tiller artifact (release.vXX) and create the version before this version. It seems like for some reason the tiller artifacts from the config map are being deleted to early. Might be a problem introduced with the max history fix from the last version @superseb

Merging into https://github.com/rancher/rancher/issues/21070

authors: superseb wzrdtales


text:
flakey test in test_app.py, test_helm_timeout

failed along with test_app_custom_values_file: https://drone-pr.rancher.io/rancher/rancher/5138/2/2

test_helm_timeout https://drone-pr.rancher.io/rancher/rancher/7638/2/2

https://github.com/rancher/rancher/issues/26212

authors: cjellick maggieliu rmweir


text:
Errors seen in garbagecollector in rancher server when deleting clusters

What kind of request is this (question/bug/enhancement/feature request): bug
Steps to reproduce (least amount of steps as possible):

Create a cluster
When the cluster comes up Active, delete the cluster from Rancher
Errors seen in rancher server:

E1202 23:03:34.266731      25 garbagecollector.go:314] error syncing item &garbagecollector.node{identity:garbagecollector.objectReference{OwnerReference:v1.OwnerReference{APIVersion:"v1", Kind:"Secret", Name:"c-h2vp8-kubeconfig", UID:"25f63420-ca12-4e5f-9ac2-5d4be6c1bab4", Controller:(*bool)(nil), BlockOwnerDeletion:(*bool)(nil)}, Namespace:"fleet-default"}, dependentsLock:sync.RWMutex{w:sync.Mutex{state:0, sema:0x0}, writerSem:0x0, readerSem:0x0, readerCount:1, readerWait:0}, dependents:map[*garbagecollector.node]struct {}{}, deletingDependents:false, deletingDependentsLock:sync.RWMutex{w:sync.Mutex{state:0, sema:0x0}, writerSem:0x0, readerSem:0x0, readerCount:0, readerWait:0}, beingDeleted:false, beingDeletedLock:sync.RWMutex{w:sync.Mutex{state:0, sema:0x0}, writerSem:0x0, readerSem:0x0, readerCount:0, readerWait:0}, virtual:false, virtualLock:sync.RWMutex{w:sync.Mutex{state:0, sema:0x0}, writerSem:0x0, readerSem:0x0, readerCount:0, readerWait:0}, owners:[]v1.OwnerReference{v1.OwnerReference{APIVersion:"rancher.cattle.io/v1", Kind:"Cluster", Name:"c-h2vp8", UID:"ab57fd14-97c3-43ab-b3b9-5a3847de29b8", Controller:(*bool)(0xc02736f97e), BlockOwnerDeletion:(*bool)(0xc02736f97f)}}}: secrets "c-h2vp8-kubeconfig" not found
E1202 23:03:34.302867      25 garbagecollector.go:314] error syncing item &garbagecollector.node{identity:garbagecollector.objectReference{OwnerReference:v1.OwnerReference{APIVersion:"v1", Kind:"Secret", Name:"import-token-c-h2vp8", UID:"dcac3718-7ea9-45b0-ad7f-9f0a858b35d8", Controller:(*bool)(nil), BlockOwnerDeletion:(*bool)(nil)}, Namespace:"fleet-default"}, dependentsLock:sync.RWMutex{w:sync.Mutex{state:0, sema:0x0}, writerSem:0x0, readerSem:0x0, readerCount:1, readerWait:0}, dependents:map[*garbagecollector.node]struct {}{}, deletingDependents:false, deletingDependentsLock:sync.RWMutex{w:sync.Mutex{state:0, sema:0x0}, writerSem:0x0, readerSem:0x0, readerCount:0, readerWait:0}, beingDeleted:false, beingDeletedLock:sync.RWMutex{w:sync.Mutex{state:0, sema:0x0}, writerSem:0x0, readerSem:0x0, readerCount:0, readerWait:0}, virtual:false, virtualLock:sync.RWMutex{w:sync.Mutex{state:0, sema:0x0}, writerSem:0x0, readerSem:0x0, readerCount:0, readerWait:0}, owners:[]v1.OwnerReference{v1.OwnerReference{APIVersion:"fleet.cattle.io/v1alpha1", Kind:"ClusterRegistrationToken", Name:"import-token-c-h2vp8", UID:"f9d26635-e83a-46c2-b3db-2a362ff01bd4", Controller:(*bool)(0xc00b7682fd), BlockOwnerDeletion:(*bool)(0xc00b7682fe)}}}: secrets "import-token-c-h2vp8" not found
E1202 23:03:34.311005      25 garbagecollector.go:314] error syncing item &garbagecollector.node{identity:garbagecollector.objectReference{OwnerReference:v1.OwnerReference{APIVersion:"v1", Kind:"ServiceAccount", Name:"import-token-c-h2vp8-f9d26635-e83a-46c2-b3db-2a362ff01bd4", UID:"6219149e-f6ea-43a6-aa45-2bcf7904e349", Controller:(*bool)(nil), BlockOwnerDeletion:(*bool)(nil)}, Namespace:"fleet-default"}, dependentsLock:sync.RWMutex{w:sync.Mutex{state:0, sema:0x0}, writerSem:0x0, readerSem:0x0, readerCount:1, readerWait:0}, dependents:map[*garbagecollector.node]struct {}{}, deletingDependents:false, deletingDependentsLock:sync.RWMutex{w:sync.Mutex{state:0, sema:0x0}, writerSem:0x0, readerSem:0x0, readerCount:0, readerWait:0}, beingDeleted:false, beingDeletedLock:sync.RWMutex{w:sync.Mutex{state:0, sema:0x0}, writerSem:0x0, readerSem:0x0, readerCount:0, readerWait:0}, virtual:false, virtualLock:sync.RWMutex{w:sync.Mutex{state:0, sema:0x0}, writerSem:0x0, readerSem:0x0, readerCount:0, readerWait:0}, owners:[]v1.OwnerReference{v1.OwnerReference{APIVersion:"fleet.cattle.io/v1alpha1", Kind:"ClusterRegistrationToken", Name:"import-token-c-h2vp8", UID:"f9d26635-e83a-46c2-b3db-2a362ff01bd4", Controller:(*bool)(0xc0008da06c), BlockOwnerDeletion:(*bool)(0xc0008da06d)}}}: serviceaccounts "import-token-c-h2vp8-f9d26635-e83a-46c2-b3db-2a362ff01bd4" not found
E1202 23:03:34.417167      25 garbagecollector.go:314] error syncing item &garbagecollector.node{identity:garbagecollector.objectReference{OwnerReference:v1.OwnerReference{APIVersion:"fleet.cattle.io/v1alpha1", Kind:"Cluster", Name:"c-h2vp8", UID:"01da805b-89e8-4c0e-9d36-9b59dae24e73", Controller:(*bool)(nil), BlockOwnerDeletion:(*bool)(nil)}, Namespace:"fleet-default"}, dependentsLock:sync.RWMutex{w:sync.Mutex{state:0, sema:0x0}, writerSem:0x0, readerSem:0x0, readerCount:1, readerWait:0}, dependents:map[*garbagecollector.node]struct {}{}, deletingDependents:false, deletingDependentsLock:sync.RWMutex{w:sync.Mutex{state:0, sema:0x0}, writerSem:0x0, readerSem:0x0, readerCount:0, readerWait:0}, beingDeleted:false, beingDeletedLock:sync.RWMutex{w:sync.Mutex{state:0, sema:0x0}, writerSem:0x0, readerSem:0x0, readerCount:0, readerWait:0}, virtual:false, virtualLock:sync.RWMutex{w:sync.Mutex{state:0, sema:0x0}, writerSem:0x0, readerSem:0x0, readerCount:0, readerWait:0}, owners:[]v1.OwnerReference{v1.OwnerReference{APIVersion:"management.cattle.io/v3", Kind:"Cluster", Name:"c-h2vp8", UID:"d3aca4c6-6d19-4461-af72-42215c8fb087", Controller:(*bool)(0xc02b31efb7), BlockOwnerDeletion:(*bool)(0xc02b31efb8)}}}: clusters.fleet.cattle.io "c-h2vp8" not found

Result:
Other details that may be helpful:
issue is seen on 2.5.2 also
Environment information

Rancher version (rancher/rancher/rancher/server image tag or shown bottom left in the UI): 2.5-head - commit id: db350a63b
Installation option (single install/HA): single

Cluster information

Cluster type (Hosted/Infrastructure Provider/Custom/Imported): Node driver DO/AWS

Expected behavior