Chef kitchen.local.yml "attributes:" overrides sticking after removed - overriding

I have this issue with chef, namely kitchen.local.yml.
It overrides kitchen.yml, that works.
But when I remove the overridden attribute, it behaves like it is not removed. It looks like it is somehow cached.
I can only change the value. This causes issues because i can't get the default attribute coming from the attributes/*.rb.
This is .kitchen.local.yml:
suites:
- name: default
run_list: [ "recipe[bbcpd-bpds-api]" ]
attributes: {
"bbcpd-bpds-api": {
"redis": {
#"host": "${REDIS_PORT_6379_TCP_ADDR:-10.0.2.2FOOO}",
### This above seems to stick even though commented out.
### Changing it FOOO to BAAR works.
### But removing keeps the BAAR appearing
### unless I `kitchen destroy` and recreate again.
}
}
I didn't find the FOOO value on host machine except for the commented out line and logs.
On the guest machine (VM), I found it in /tmp:
kitchen/dna.json:{"bbcpd-bpds-api":{"update_mode":true,"redis":{"dbIndex":"12","host":"${REDIS_PORT_6379_TCP_ADDR:-10.0.2.2FOOO}"},"storage":{"ccr":{"url":"https://ccr-dev-citc.bbcollab.com/v1","client":"BPDS-Client-Id","secret":"ABCDEFGHABCDEFGHABCDEFGHABCDEFGHABCDEFGHunzoneunzoneunzoneunzoneunzoneunzoneunzoneunzone","tokenexpiry":"60","site":"Dev","container":"DevBPDSContainer"}},"libreoffice":{"binary":"/opt/libreoffice5.4/program/soffice"}},"run_list":["recipe[bbcpd-bpds-api]"]}
kitchen/nodes/default-centos-72.json: "host": "${REDIS_PORT_6379_TCP_ADDR:-10.0.2.2FOOO}",
I am not quite sure what is the role of these, but I suspected these are somehow involved in keeping the state.
I have tried to delete /tmp but then, kitchen converge stopped working. It needed kitchen create to fix. But the ...FOOO value appeared there again.
Running kitchen destroy && kitchen create makes the value go away, but since there is no caching for the VM base image, it takes around 15 minutes, so I would like to avoid it.
Questions:
Where are these values being cached so that they stick even after removed from .kitchen.local.yml?
How can I disable/clear that caching?

This is just how it works, sorry. You have to destroy and recreate the instance to see changes in attribute settings.

Related

How to recover accidentally deleted cells in Jupyter Notebook

I'm working in a .ipynb file in VSCode and I tried to undo some lines by using ESC + Z, but for some reason either I undid too much or I pressed something else, but around 30 of my cells all got deleted. I don't know how to redo and I'm scared I lost all my work!
How can I recover these cells???
Thanks
edit: I found the code that I've run using %history but I was hoping to get my Markdown cells as well because I wrote a lot of information there
edit 2: I noticed that my cells weren't just deleted, but my files actually just changed to a different spot in history, as my first few cells contained something different than it did before the cells disappeared. Does that change the answer to this question at all?
I did post a workaround to recover some stuff, but I'd still appreciate if someone let me know what happened in my 2nd edit, thanks!
If you hit the 'Z' key it will undo moves and deletes. Note, not CTRL+Z, but 'Z' by itself. link to the GitHub issue.
This happens constantly for me. So incredibly annoying! It happens when I hit or mishit CMD+Z. No amount of ESC-Z will recreate the deleted cell. Nothing in any menu have so far recreated the lost. I have deleted all shortcuts for 'delete cell' but it makes no difference at all. Just about to give up on VSCode for this reason alone.
I had a similar issue where I was hitting CTRL+Z outside of the cell when I thought I was inside the cell (usually because running current cell makes you lose cell focus).
Sometime it just "undid" the last created cell somewhere else in my notebook, and I actually lost some cells because I didn't realized right away what happened and just continued working.
I thought I would share my solution to this problem (because Google sent me on this post, and more people might be interested).
Redefining the Keyboard Shortcuts worked for me.
I removed the CTRL+Z shortcut when I'm not inside a cell (you can still access it with the menu Edit > Undo). I did the same for CTRL+SHIFT+Z, and so on.
To do this, I added theses rules to my keybindings.json:
{ "key": "ctrl+z", "command": "-undo" },
{ "key": "ctrl+z", "command": "undo", "when": "!notebookEditorFocused || inputFocus" },
{ "key": "ctrl+shift+z", "command": "-redo" },
{ "key": "ctrl+shift+z", "command": "redo", "when": "!notebookEditorFocused || inputFocus" },
{ "key": "ctrl+y", "command": "-redo" },
{ "key": "ctrl+y", "command": "redo", "when": "!notebookEditorFocused || inputFocus" },
I also removed the Z shortcut from Jupyter extension because I don't like it.
{ "key": "z", "command": "-undo", "when": "notebookEditorFocused && !inputFocus" },
This solution worked for me:
Open the command pallet (ctrl+shift+p on windows)
Select the "Undo" command
Not sure why it works. Does vscode disable the ctrl-z shortcut when outside a cell?
Ok, this is crazy but since I'm in Visual Studio Code, I tried right clicking on my .ipynb file and clicking "Convert to Python Script".
This recovered every single line including Markdown Code that I had before I did something to delete my cells.
Might be worth a try if you deleted your Jupyter Cells in Visual Studio Code
I found a way to get the lost cells back, which saved me an enormous amount of time as I did not have to recreate those cells. If you open the timeline (bottom left corner of the screen), you can go back in time when you still had those cells, copy the content and paste it in a new cell.
Update: you might have to upgrade to the latest version if Timeline is not available for you.
%history is a life saver but i will also note: When you run %history not all the code will show, given the amount of lines - you must navigate to the output file where you will see all the history, it is displayed there. The option to open the output file is usually given at the top of the page in VS code anyway.
I came to this thread after facing a similar situation as I lost a day's work as well but, I wasn't going to give up!
So, if you have setup Auto Save on VS Code and have wsl2 enabled and are using VS code from wsl, you have to navigate to this path
> \\wsl.localhost\Ubuntu\home\<user-name>\.vscode-server\data\User\History\.
or simply do
cd (to go to root path)
type explorer.exe . (this will open file explorer)
Navigate to .vscode-server\data\User\History\.
There will be multiple folders, pick one for the file you want to restore and Voila!
just click Z in windows. This saves my a lot of pain. it happens sometimes

Table methods not working anymore

I have a table with different methods, for example, one of them is validateWrite, when setting Field A to value X, Field B and C has to be filled in.
Suddenly (without changing code, I have compared the code with the test enviroment, it does work there) the validateWrite has stopped working.
I have tried to recompile the table, but that did not work.
Any idea why it suddenly (without making other modifications in this enviroment, or generating a CIL) stopped working and what i can try to solve it?
If some piece of code is calling table.doInsert(), it skips the validateWrite() method.
If the environments are truly identical, then I would try closing your AX client and deleting your user caches (see http://dynamics-ax-live.blogspot.com/2010/03/more-information-about-auc-file.html) where you delete all of the *.auc files located at C:\Users\[Username]\AppData\Local
In addition to what that tells you to delete, I'd also remove the *.kti file and all of the files & folders inside of C:\Users\[UserName]\AppData\Local\Microsoft\Dynamics Ax
Then open AX, see if the problem still exists. Then full system compile, CIL build, and delete your usage data.
The preferred route though would be to just drop a breakpoint in and debug the code to see what the execution stack is.

Django 1.8 migration did not take affect

Using Django 1.8 with a SQLite database.
I made a change in models.py that consisted of eliminating two out of four elements from a field choice and editing one of the remaining two:
Original value:
OPTION_INSPECTOR = (
('John Smith', 'John Smith'),
('Taylor', 'Taylor'),
('Hale', 'Hale'),
('James', 'James'),
)
New value:
OPTION_INSPECTOR = (
('John Smith', 'John Smith'),
('Greg Taylor', 'Greg Taylor'),
)
I then ran:
python manage.py makemigrations my_app
I saw nothing unusual, only the changes that I made, if I recall correctly. I do not have the actual output.
Then I ran:
python manage.py migrate my_app
Again, I don't remember anything unusual. But, the model hasn't changed the choices within the dropdown menu on the Admin site. Can anyone suggest a way to make this change successfully?
Thanks!
I am continually changing my app based on feedback from researchers. I have had a lot of issues like what you are describing. I have found that there are a lot of changes I can make to the models before the app total breaks and I have to go back and "remake" it with a fresh model.py file, but eventually, that is what I have had to do. In the meantime (before I remake the app), I make the changes to the model.py, then I run the makemigrations and then migrate. I look and see what the errors are and I make the changes to fix them directly in the database (in my case, MySQL). Typically, I have to do this to add or alter fields. Then, I rerun the make migrations and the migrate, and I get warnings about duplicate fields, but the app keeps working. Like I said though, eventually, I have to remake the app with a fresh model.py file to get rid of all the warnings.

"Undefined property: stdClass"

This error suddenly occurred when Pressflow was added to our Drupal installation. It is coming from a custom module that, prior to Pressflow seemed to work fine. After the addition of Pressflow, running Drush causes this error to display on screen.
The function that is identified as the source of the error looks like this:
function user_search_location_get(&$user) {
if (count($user->user_location_pref)) { // This line is causing the error.
return $user->user_location_pref;
}
// …
}
The error message is the following:
WD php: Notice: Undefined property: stdClass::$user_location_pref in user_search_location_get()
Short answer, in your custom module, you should check if that property exists before you count it. That, or make sure the $user object has that property before you use it.
if (isset($user->user_location_pref) && count($user->user_locaion_pref) > 0) {
return $user->user_locaion_pref;
}
While it is a little more work, when you start developing with notices turned on, you will find errors in your code that otherwise would have not appeared till later, and would have been more difficult to track down.
In your previous environment or install, the PHP error reporting was probably set to not show notices. While I recommend keeping notices on and making your code work with them, you can turn them off through the Drupal 7 UI. Configuration -> Development -> Logging and Errors. Then set the value to 'Errors and Warnings' ... Otherwise, you can set your error reporting level in your php.ini to report all except notices.
Note that Drupal 6 did not force notice reporting on, while Drupal 7 does. That prompts this type of question a lot.
If this is your only notice issue though, it makes more sense to just correct your custom module.

drupal's hook_preprocess_page not working as expected

i am having an issue where hook_preprocess_page 's changes to &$variables is not being rendered, even though it is the last item under $theme_registry['page']['preprocess functions']. logging contents of $variables to a file show the contents changed, but contents appear unchanged on the site. flushed all cache on drupal, flushed all browser caches and still the same result.
/**
* Implementation of hook_preprocess_page().
*/
function grinchlist_preprocess_page(&$variables) {
if (grinchlist_usercheck($variables['user']['uid'])) {
$variables['scripts'] = preg_replace('/<script[^>]*christmas_snow.*<\/script>/','',$variables['scripts']);
}
file_put_contents('/tmp/vars.txt',print_r($variables,true));
}
the /tmp/vars.txt shows the variables properly, but the browser still show the script being loaded.
this may be a silly example, but i've had this issue with the hook_preprocess_page in other instances and it would really help out to understand what is going on here...
thanks.
The reported code contains an error. The IF-statement should be corrected from
if (grinchlist_usercheck($variables['user']['uid'])) {
// ...
}
to
if (grinchlist_usercheck($variables['user']->uid)) {
// ...
}
I am using hook_preprocess_page() in one of my modules, and the invoked function does change the content of the variables.
Then, as also Richard M reported, the function should get the list of the included JavaScript files from drupal_get_js().
I think you probably (assuming this works in the same way as CSS includes) need to call drupal_get_js at the end of your function, like so: $variables['scripts'] = drupal_get_js();.
I know this is an old question but I just struck it and I think I know the answer.
I think jquery_update is causing this.
jquery_update implements hook_theme_registry_alter which changes $theme_registry so that jquery_update_preprocess_page runs last. This is despite what Peter sees in $theme_registry because the alter happens after he looks at it.
jquery_update gets $scripts from drupal_add_js(), fiddles with the array and then resets $variables['scripts'] which overwrites any changes made earlier.
I'm not sure what the perfect solution is. I don't think we're really supposed to mess with the scripts string directly. I have a special one page case so I'm probably going to do the somewhat bad thing of calling my code from jquery_update_preprocess_page. jquery_update for Drupal 6 is unlikely to updated now. That seems better than getting into a dueling battle of who comes last.

Resources