Does clouds.yaml work with python-api cinderclient as well? - openstack

I noticed by accident that openstack.connect() automatically tries to access the clouds.yaml file. I tried to replicate this for the cinderclient, but it didn't work. I know of no documentation of that feature, therefore I just guessed:
from cinderclient import client
from keystoneauth1 import loading
loader = loading.get_plugin_loader('password')
auth_cinder = loader.load_from_options()
I also tried the other load commands given by loading, but none of them worked without further parameters like openstack.connect() did.
If I just missed the full documentation of this feature, I would love to be pointed towards the right direction.

Related

"First Load JS" size problem Next.js. (Using immutable.js)

In my project(Next.js v10), the immutable library is used to work with redux. Now I tackled the issue of optimization, because I ran into the problem of "red" first load js.
I am not very strong in this yet, but I try to learn and understand everything. I applied dynamic import on the pages themselves, as it is advised everywhere, and it helped a lot, since the situation was even worse than now. I checked _document.js and _app.js, everything seems to be fine except:
//_app.js
const {serialize, deserialize} = require('json-immutable');
...
const wRedux = withRedux(makeStore, {
serializeState: state => state ? serialize(state) : state,
deserializeState: state => state ? deserialize(state) : state
})(MyApp);
export default wRedux;
As it works now, I get:
If I turn off the use of serialize and deserialize completely (in _app.js), and index.tsx (no redux request and no imports other than React) just returns an empty div => I get this:
const wRedux = withRedux(makeStore, {
serializeState: state => state,
deserializeState: state => state
})(MyApp);
Some chunks are missing, but the immutable chunk remains in place(
though for some reason its size is slightly different, but the hash is the same):
I found this article: https://betterprogramming.pub/try-these-instead-of-using-immutable-js-with-redux-f5bc3bd30190 and check https://www.npmtrends.com/immutable-vs-immer-vs-seamless-immutable
The problem is that the whole project is already on the syntax immutable-js (post.get ('prop'))
My questions:
How much better Immer will be?
Will he(Immer) also "go into the general chunk"?
What other ways are there to reduce the size of "First Load JS shared by all"?
Perhaps there are some other shortcomings that I do not notice due to lack of experience, but they can be seen on the reports?
Thanks for any help!
I published the results of my work, I hope this will help someone(Sorry for my English :)).
Ditching immutable.js in favor of Immer did make sense (156 => 123):
Also, if anyone is interested, take a closer look at your chunks. As you can see from my question, in addition to Immutable, http-status.js was also "added" to the general First Load JS. This is a standard file with a set of response codes, from which I needed only one (I just wrote the number manually and removed the import), and the file where it was imported is distributed to the entire application. Additionally, I revised the connection of third-party scripts and used the internal optimization of fonts in next v10:
Also, in conjunction with immutable, json-immutable was used, which is no longer required, which removed 2 more small chunks.
And my previously problematic chunk now looks like this:
Finally: "First Load JS shared by all" has been reduced from 156 kB to 111kB (28.85%)
P.S. I have such a big _app.js chunk because I have Automatic Static Optimization disabled due to getInitialProps

VaadinServlet.getCurrent returns null

I have a Vaadin7 application I am trying to move to Vaadin12 and there is a line of code where I call VaadinServlet.getCurrent() to get the servlet ( I actually need to configuration information ). It is returning null. What is happening and how can I fix?
Obviously, this line of code works fine in Vaadin7.
Ok, it was a simple solution: I just had to change import com.vaadin.server.VaadinServlet; to import com.vaadin.flow.server.VaadinServlet;. There is a addon we use that seems to reference vaadin 7 stuff, and thus neither of us noticed the wrong import statement. Either we should have stopped using this addon or updated it to the latest version.
Lesson to learn from this: make sure you are no referencing Vaadin 7 via depencies in your pom, I guess.

Issue when importing JSON via 'require' in Meteor

The following code works to load a local, static JSON file:
var stories = require('../stories/stories.json');
Now I want to load a file based on a variable, e.g. do something like this:
var storiesPath = '../stories/stories.json';
var stories = require(storiesPath);
But this triggers an error:
Error: Cannot find module '../stories/stories.json'
at require (packages/modules-runtime.js:123:19)
at meteorInstall.server.main.js (server/main.js:7:15)
Is there any way to get this working? I assume that I could load my file via the Meteor http package instead but I'd rather not add another package if I can avoid it.
Thanks for your hints
Like I said in the comment, you can easily use a variable in a require, e.g.,
> var x = 'fs';
> require(x).readFile
[Function]
So that's not the problem you are dealing with. Are you sure your first case indeed works? It would be surprising. I think you might be running into project file layout issues, due to the use of a relative path. I would stay away from that. And fortunately you can quite easily by using an asset! You can put your json file in private/ in your project folder and then use:
const stories = JSON.parse(Assets.getText('stories.json'));

What is the RKUIManager?

I get an error with RKUIManager, or more precisely:
Could not invoke RKUIManager.manageChildren
It appears for example when I'm using firebase with React Native and try to set a reference in the constructor of a component with a prop. For ex:
messagesRef = FBRef.child("Messages").child(this.props.currentMeetingID)
If I change it to the following it works, and yes, I have checked if this.props.currentMeetingID is a legitimate value.
messagesRef = FBRef.child("Messages").child("123456789")
I can't seem to locate the problem nor reproduce it perfectly. I'm just trying to figure out if it's my machine or some kind of bug elsewhere.
Right now I'm just looking for info about what RKUIManager actually is.
If I nullcheck this.props.currentMeetingID I fix it, easy fix but nowhere to be found on the internet so I'll leave it here for anyone passing by. Probably me in a couple of weeks...

Atom Interfering Keymap Config?

I have this in Atom my kepmap file:
'.editor':
'ctrl-i': 'window:toggle-invisibles'
'.editor':
'ctrl-t': 'editor:toggle-indent-guide'
ctrl-t works but ctrl-i doesn't.
Just deleting the
'.editor':
'ctrl-t': 'editor:toggle-indent-guide'
makes ctrl-i work again.
Why would that be? How to I clear the interference?
You'll notice both bindings share the same class even if they don't share the same keystroke, try putting them together like so:
'.editor':
'ctrl-i': 'window:toggle-invisibles'
'ctrl-t': 'editor:toggle-indent-guide'
And you could even be more specific to avoid having them overwritten whenever you install new packages, like so:
'.workspace .editor:not(.mini)':
'ctrl-i': 'window:toggle-invisibles'
'ctrl-t': 'editor:toggle-indent-guide'
That's just an example, you can be even more specific adding .pane, but the previous one does the job.
You can also use the Key Binding Resolver by ctrl+.(that's the "dot" or "period"), or querying the command palette by ctrl+shift+P and searching for resolver, bam you are there (that one you knew for sure, I just mention it for other people who may be reading this and may not be familiar with basic functionality).
The key binding resolver will help you monitor how other bindings may be interfering.
Look:
Let me know if it worked.

Resources