Seems Ansible failed to get the temp files - ansible

Ansible failed while running the tasks and referring file/folder not exists in the ansible temp folder of a target machine. It has been working fine and not sure why all of sudden it stopped working
changed : false
module_stderr : Shared connection to 10.131.132.11 closed.\r\n
module_stdout : Traceback (most recent call last):\r\n File \"/root/.ansible/tmp/ansible-tmp-1662460628.845051-105063944436404/AnsiballZ_setup.py\", line 113, in <module>\r\n try:\r\n File \"/root/.ansible/tmp/ansible-tmp-1662460628.845051-105063944436404/AnsiballZ_setup.py\", line 98, in _ansiballz_main\r\n json_params = f.read()\r\n File \"/usr/lib64/python2.7/tempfile.py\", line 321, in mkdtemp\r\n dir = gettempdir()\r\n File \"/usr/lib64/python2.7/tempfile.py\", line 265, in gettempdir\r\n tempdir = _get_default_tempdir()\r\n File \"/usr/lib64/python2.7/tempfile.py\", line 212, in _get_default_tempdir\r\n (\"No usable temporary directory found in %s\" % dirlist))\r\nIOError: [Errno 2] No usable temporary directory found in ['/tmp', '/var/tmp', '/usr/tmp', '/root']\r\n
msg : MODULE FAILURE\nSee stdout/stderr for the exact error
rc : 1

You can start by checking the permissions if they changed.
I think the disk is probably full. I had the same issue and it was the case.
You can type df -h
Also you can verify the inode.
You can type df -i

Related

Volttron on MacOS issue with vcfg

Running into the issue below while trying to run vcfg command in Volttron on my Mac use iTerm. Any help would be much appreciated.
'''
(volttron)cg#Carolyns-MacBook-Pro volttron % vcfg
Your VOLTTRON_HOME currently set to: /Users/cg/.volttron
Is this the volttron you are attempting to setup? [Y]:
Message bus set to zmq
What is the vip address? [tcp://127.0.0.1]:
What is the port for the vip address? [22916]:
Is this instance web enabled? [N]: Y
Traceback (most recent call last):
File "/Users/cg/volttron/env/bin/vcfg", line 11, in <module>
load_entry_point('volttron', 'console_scripts', 'vcfg')()
File "/Users/cg/volttron/volttron/platform/config.py", line 593, in _main
main()
File "/Users/cg/volttron/volttron/platform/instance_setup.py", line 862, in main
wizard()
File "/Users/cg/volttron/volttron/platform/instance_setup.py", line 748, in wizard
do_web_enabled_zmq(volttron_home)
File "/Users/cg/volttron/volttron/platform/instance_setup.py", line 433, in do_web_enabled_zmq
'https://' + get_hostname())
File "/Users/cg/volttron/volttron/utils/__init__.py", line 27, in get_hostname
with open('/etc/hostname') as fp:
IOError: [Errno 2] No such file or directory: '/etc/hostname'
'''
/etc/hostname does not exist on Mac. The documentation for Volttron indicates that it only supports Linux operating systems.. It seems like you'll have to use a Linux host (or use virtualization).

`ansible --version` command throws an ERROR

Good Day guys
I have installed ansible on my mac, it was successfully installed but then when I run the command ansible --version it throws me a n error:
Unhandled error:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/ansible/config/manager.py", line 559, in update_config_data
value, origin = self.get_config_value_and_origin(config, configfile)
File "/Library/Python/2.7/site-packages/ansible/config/manager.py", line 503, in get_config_value_and_origin
value = ensure_type(value, defs[config].get('type'), origin=origin)
File "/Library/Python/2.7/site-packages/ansible/config/manager.py", line 124, in ensure_type
value = tempfile.mkdtemp(prefix=prefix, dir=value)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/tempfile.py", line 339, in mkdtemp
_os.mkdir(file, 0700)
OSError: [Errno 13] Permission denied: '/Users/patrick/.ansible/tmp/ansible-local-37505vvsQNX'
Traceback (most recent call last):
File "/usr/local/bin/ansible", line 62, in <module>
import ansible.constants as C
File "/Library/Python/2.7/site-packages/ansible/constants.py", line 174, in <module>
config = ConfigManager()
File "/Library/Python/2.7/site-packages/ansible/config/manager.py", line 291, in __init__
self.update_config_data()
File "/Library/Python/2.7/site-packages/ansible/config/manager.py", line 571, in update_config_data
raise AnsibleError("Invalid settings supplied for %s: %s\n" % (config, to_native(e)), orig_exc=e)
ansible.errors.AnsibleError: Invalid settings supplied for DEFAULT_LOCAL_TMP: [Errno 13] Permission denied: '/Users/patrick/.ansible/tmp/ansible-local-37505vvsQNX'
Appreciate your help guys.
Check if this is similar to iiab/iiab/issue 1212:
After some more digging, I found the real source of this problem was hardcoded paths in ansible.cfg
Or the more recent ansible/galaxy-dev issue 107, which leads to PR 110:
The default ansible temp dir ~/.ansible/tmp is accessed by ansible-doc via the galaxy-importer.
This works OK in the galaxy-dev local env, but on the CI environment it attempts to create dir /.ansible/tmp and fails.
This PR changes the default ansible temp dir to /tmp/ansible which is outside the user home (and in the local env, /tmp has greater permissions)
Try and change DEFAULT_LOCAL_TMP to /tmp.
~/.ansible/tmp is probably root, so not accessible. chown it to user
I have disabled 'gathering' in ansible.cfg to fix the issue.
# gathering = False
Below error occurring before commenting this.
~ % ansible
Unhandled error:
Traceback (most recent call last):
File "/opt/homebrew/Cellar/ansible/6.6.0/libexec/lib/python3.10/site-packages/ansible/config/manager.py", line 627, in update_config_data
value, origin = self.get_config_value_and_origin(config, configfile)
File "/opt/homebrew/Cellar/ansible/6.6.0/libexec/lib/python3.10/site-packages/ansible/config/manager.py", line 586, in get_config_value_and_origin
raise AnsibleOptionsError('Invalid value "%s" for configuration option "%s", valid values are: %s' %
ansible.errors.AnsibleOptionsError: Invalid value "False" for configuration option "setting: DEFAULT_GATHERING ", valid values are: implicit, explicit, smart

HDFS: Errno 22 on attempt to edit an existing file in mounted NFS volume

Summary: I mounted HDFS nfs volume in OSX and it will not let me edit existing files. I can append and create files with content but not "open them with write flag".
Originally, I asked about a particular problem with JupyterLab failing to save notebooks into nfs mounted volumes but while trying to dig down to the roots, I realized (hopefully right) that it's about editing existing files.
I mounted HDFS nfs on OSX and I can access the files, read and write and whatnot. JupyterLab though can do pretty much everything but can't really save notebooks.
I was able to identify the pattern for what's really happening and the problem boils down to this: you can't open existing files in nfs volume for write:
This will work with a new file:
with open("rand.txt", 'w') as f:
f.write("random text")
But if you try to run it again (the file has been created now and the content is there), you'll get the following Exception:
---------------------------------------------------------------------------
OSError Traceback (most recent call last)
<ipython-input-15-94a46812fad4> in <module>()
----> 1 with open("rand.txt", 'w') as f:
2 f.write("random text")
OSError: [Errno 22] Invalid argument: 'rand.txt'
I am pretty sure the permissions and all are ok:
with open("seven.txt", 'w') as f:
f.write("random text")
f.writelines(["one","two","three"])
r = open("seven.txt", 'r')
print(r.read())
random textonetwothree
I can also append to files no problem:
aleksandrs-mbp:direct sasha$ echo "Another line of text" >> seven.txt && cat seven.txt
random textonetwothreeAnother line of text
I mount it with the following options:
aleksandrs-mbp:hadoop sasha$ mount -t nfs -o
vers=3,proto=tcp,nolock,noacl,sync localhost:/
/srv/ti/jupyter-samples/~Hadoop
Apache documentation suggests that NFS gateway does not support random writes. I tried looking at mount documentation but could not find anything specific that points to enforcing sequential writing. I tried playing with different options but it doesn't seem to help much.
This is the exception I get from JupyterLab when it's trying to save the notebook:
[I 03:03:33.969 LabApp] Saving file at /~Hadoop/direct/One.ipynb
[E 03:03:33.980 LabApp] Error while saving file: ~Hadoop/direct/One.ipynb [Errno 22] Invalid argument: '/srv/ti/jupyter-samples/~Hadoop/direct/.~One.ipynb'
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/notebook/services/contents/filemanager.py", line 471, in save
self._save_notebook(os_path, nb)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/notebook/services/contents/fileio.py", line 293, in _save_notebook
with self.atomic_writing(os_path, encoding='utf-8') as f:
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/contextlib.py", line 82, in __enter__
return next(self.gen)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/notebook/services/contents/fileio.py", line 213, in atomic_writing
with atomic_writing(os_path, *args, log=self.log, **kwargs) as f:
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/contextlib.py", line 82, in __enter__
return next(self.gen)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/notebook/services/contents/fileio.py", line 103, in atomic_writing
copy2_safe(path, tmp_path, log=log)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/notebook/services/contents/fileio.py", line 51, in copy2_safe
shutil.copyfile(src, dst)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/shutil.py", line 115, in copyfile
with open(dst, 'wb') as fdst:
OSError: [Errno 22] Invalid argument: '/srv/ti/jupyter-samples/~Hadoop/direct/.~One.ipynb'
[W 03:03:33.981 LabApp] 500 PUT /api/contents/~Hadoop/direct/One.ipynb?1534835013966 (::1): Unexpected error while saving file: ~Hadoop/direct/One.ipynb [Errno 22] Invalid argument: '/srv/ti/jupyter-samples/~Hadoop/direct/.~One.ipynb'
[W 03:03:33.981 LabApp] Unexpected error while saving file: ~Hadoop/direct/One.ipynb [Errno 22] Invalid argument: '/srv/ti/jupyter-samples/~Hadoop/direct/.~One.ipynb'
This is what I see in the NFS logs at the same time:
2018-08-21 03:05:34,006 ERROR org.apache.hadoop.hdfs.nfs.nfs3.RpcProgramNfs3: Setting file size is not supported when setattr, fileId: 16417
2018-08-21 03:05:34,006 ERROR org.apache.hadoop.hdfs.nfs.nfs3.RpcProgramNfs3: Setting file size is not supported when setattr, fileId: 16417
Not exactly sure what this means but if I understand the RFC, it should be part of implementation:
Servers must support extending the file size via SETATTR.
I understand the complexity behind mounting hdfs and letting clients write all they want while keeping these files distributed and maintain integrity. Is there though a compromise that would enable writes via nfs?

Golang: Preview of managed VM app returns error

I'm trying to preview a Go docker (App Engine ManagedVM) app using the gcloud preview app run command.
But I keep getting this error:
Traceback (most recent call last):
File "/Users/jwesonga/google-cloud-sdk/platform/google_appengine/dev_appserver.py", line 83, in <module>
_run_file(__file__, globals())
File "/Users/jwesonga/google-cloud-sdk/platform/google_appengine/dev_appserver.py", line 79, in _run_file
execfile(_PATHS.script_file(script_name), globals_)
File "/Users/jwesonga/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 985, in <module>
main()
File "/Users/jwesonga/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 978, in main
dev_server.start(options)
File "/Users/jwesonga/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 774, in start
self._dispatcher.start(options.api_host, apis.port, request_data)
File "/Users/jwesonga/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/dispatcher.py", line 182, in start
_module, port = self._create_module(module_configuration, port)
File "/Users/jwesonga/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/dispatcher.py", line 262, in _create_module
threadsafe_override=threadsafe_override)
File "/Users/jwesonga/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/module.py", line 1463, in __init__
super(ManualScalingModule, self).__init__(**kwargs)
File "/Users/jwesonga/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/module.py", line 514, in __init__
self._module_configuration)
File "/Users/jwesonga/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/module.py", line 237, in _create_instance_factory
module_configuration=module_configuration)
File "/Users/jwesonga/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/vm_runtime_factory.py", line 78, in __init__
timeout=self.DOCKER_D_REQUEST_TIMEOUT_SECS)
File "/Users/jwesonga/google-cloud-sdk/platform/google_appengine/google/appengine/tools/docker/containers.py", line 740, in NewDockerClient
client.ping()
File "/Users/jwesonga/google-cloud-sdk/./lib/docker/docker/client.py", line 711, in ping
return self._result(self._get(self._url('/_ping')))
File "/Users/jwesonga/google-cloud-sdk/./lib/docker/docker/client.py", line 76, in _get
return self.get(url, **self._set_request_timeout(kwargs))
File "/Users/jwesonga/google-cloud-sdk/platform/google_appengine/lib/requests/requests/sessions.py", line 468, in get
return self.request('GET', url, **kwargs)
File "/Users/jwesonga/google-cloud-sdk/platform/google_appengine/lib/requests/requests/sessions.py", line 456, in request
resp = self.send(prep, **send_kwargs)
File "/Users/jwesonga/google-cloud-sdk/platform/google_appengine/lib/requests/requests/sessions.py", line 559, in send
r = adapter.send(request, **kwargs)
File "/Users/jwesonga/google-cloud-sdk/platform/google_appengine/lib/requests/requests/adapters.py", line 384, in send
raise Timeout(e, request=request)
requests.exceptions.Timeout: (<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x10631c7d0>, 'Connection to 192.168.59.104 timed out. (connect timeout=60)')
ERROR: (gcloud.preview.app.run) DevAppSever failed with error code [1]
I've confirmed that docker is up and running using boot2docker status which returns running This was working before but after a machine reboot, nothing seems to work. Any ideas?
The main issue is:
File "/Users/jwesonga/google-cloud-sdk/platform/google_appengine
/lib/requests/requests/adapters.py", line 384, in send
raise Timeout(e, request=request)
requests.exceptions.Timeout:
(<requests.packages.urllib3.connection.VerifiedHTTPSConnection object
at 0x10631c7d0>, 'Connection to 192.168.59.104 timed out.
(connect timeout=60)')
ERROR: (gcloud.preview.app.run) DevAppSever failed with error code [1]
Which is often the case when you have a proxy, and is discussed in pip issue 1805
It is supposed to be fixed in pip1.6, but just in case, you can try the workaround of alexandrem
/opt/venvs/ironic/lib/python2.6/site-packages/pip/_vendor/requests
/adapters.patch.py /opt/venvs/ironic/lib/python2.6/site-packages
/pip/_vendor/requests/adapters.py
209c209
if True or not proxy in self.proxy_manager:
^^^^
basically I just add a True to the condition on line 209 of the adapter.py to always create a ProxyManager instance, thus skipping the pool manager logic.
The gcloud command enable the ah_host process and also created the docker image of your app and passes it to the Docker daemon, in your case it seems that your docker daemon is not responding to the request. So to make sure,perform "sudo docker -d" to check if the Docker daemon is running on your machine or not.
Also check that, the path of the certificate you set correctly and value of the TLS_VERIFY is TRUE.
Go through the documentation [1] for the installation of Docker on MacOS
[1] https://docs.docker.com/installation/mac/

Windows hg authorisation failed

I have an hg repository in Windows, but the following comands :
hg pull
hg push
hg incoming
hg outgoing
all have the result :
abort: authorization failed
When I try to access my repository by a web browser, it asks for my credentials. I input them and I can access them without problems from the web browser.
In my mercurial.ini file, I've added
[auth]
bb.username = MyUserName
bb.password = MyPwd
and I've checked that the environment variable HGRCPATH is correct, but it didn't solve anything.
The output of hg incoming --debug --traceback is :
using http://My/Repo/url.com
sending capabilities command
Traceback (most recent call last):
File "mercurial\dispatch.pyc", line 97, in _runcatch
File "mercurial\dispatch.pyc", line 778, in _dispatch
File "mercurial\dispatch.pyc", line 549, in runcommand
File "mercurial\dispatch.pyc", line 869, in _runcommand
File "mercurial\dispatch.pyc", line 840, in checkargs
File "mercurial\dispatch.pyc", line 775, in <lambda>
File "mercurial\util.pyc", line 512, in check
File "mercurial\extensions.pyc", line 143, in wrap
File "mercurial\util.pyc", line 512, in check
File "hgext\mq.pyc", line 3528, in mqcommand
File "mercurial\util.pyc", line 512, in check
File "mercurial\commands.pyc", line 3854, in incoming
File "mercurial\hg.pyc", line 548, in incoming
File "mercurial\hg.pyc", line 500, in _incoming
File "mercurial\hg.pyc", line 122, in peer
File "mercurial\hg.pyc", line 102, in _peerorrepo
File "mercurial\httppeer.pyc", line 264, in instance
File "mercurial\httppeer.pyc", line 57, in _fetchcaps
File "mercurial\httppeer.pyc", line 197, in _call
File "hgext\largefiles\proto.pyc", line 174, in httprepocallstream
File "mercurial\httppeer.pyc", line 121, in _callstream
Abort: authorization failed
abort: authorization failed
If that's all you have in the [auth] section of the mercurial.ini you're missing the required .prefix entry. It's required to know what sites to use that username and password on. See http://www.selenic.com/mercurial/hgrc.5.html#auth for details on how to use the prefix.
Also make sure you see a http/s URL when you do hg paths. If you're seeing the ssh URLs then you need to set up a key not a password (or switch to the http/s URLs).

Resources